希望帮忙写一个均线上下固定比例的语言
比如20均线上下1%,站上20均线1%开多,下破20均线平多开空
因为对于金字塔还不熟悉,最好能帮助写一个完成的,直接可以导入的,作为独立的系统存在
拜谢
ma20:ma(c,20);
buycond:c>=ma20*1.01;//开仓条件
sellcond:c<=ma20*0.99;//平仓条件
if buycond then buy(holding=0,1,market);
if sellcond then begin sell(holding>0,holding,market); buyshort(holding=0,1,market); end
ma20:ma(c,20);
buycond:c>=ma20*1.01;//开仓条件
sellcond:c<=ma20*0.99;//平仓条件
if buycond then buy(holding=0,1,market);
if sellcond then begin sell(holding>0,holding,market); buyshort(holding=0,1,market); end
信号点指的什么? 软件本身在出信号位置不是有标识的吗? 策略参数优化话,需要在回测里面进行优化,代码里面把原先写死的数值变量,改成参数就行了。
INPUT:n(20,1,120,1),p(1,1,100,1);//参数
ma20:ma(c,N);
buycond:c>=ma20*(1+p/100);//开仓条件
sellcond:c<=ma20*(1-p/100);//平仓条件
if buycond then buy(holding=0,1,market);
if sellcond then begin sell(holding>0,holding,market); buyshort(holding=0,1,market); end
信号点指的什么? 软件本身在出信号位置不是有标识的吗? 策略参数优化话,需要在回测里面进行优化,代码里面把原先写死的数值变量,改成参数就行了。
INPUT:n(20,1,120,1),p(1,1,100,1);//参数
ma20:ma(c,N);
buycond:c>=ma20*(1+p/100);//开仓条件
sellcond:c<=ma20*(1-p/100);//平仓条件
if buycond then buy(holding=0,1,market);
if sellcond then begin sell(holding>0,holding,market); buyshort(holding=0,1,market); end
后面就没有信号出来了,请问下是什么情况呢?谢谢
要么这个单独写一个触发条件,要么就直接在开多条件触发的时候就平空。比如这样:if buycond then begin sellshort(1,holding,MARKET); buy(holding=0,1,market); end
ma20:ma(c,20);
buycond:c>=ma20*1.01;//?a2?ì??t
sellcond:c<=ma20*0.99;//??2?ì??t
if buycond then begin
sellshort(holding<0,1,marketr);
buy(holding=0,1,market);
end
if sellcond then begin
sell(holding>0,holding,market);
buyshort(holding=0,1,market);
end