[PEL] 复制代码 INPUT:M(14,1,300,30);
VARIABLE:ct:=0,atrValue:=0;
ma20:ma(c,20);
ma60:ma(c,60);
TR1:=MAX(MAX((HIGH-LOW),ABS(REF(CLOSE,1)-HIGH)),ABS(REF(CLOSE,1)-LOW));
ATR:MA(TR1,m);
majc:cross(ma20,ma60);
masc:cross(ma60,ma20);
if majc and holding=0 then
begin
buy(majc and holding=0,1,market);
atrValue:=ATR;
end
if holding>0 and ct<=4 and (c-ENTERPRICE)>=atrValue and atrValue<>0 then //每次最新价较上次开仓价上涨一个atr 加仓一次
begin
buy(1,1,market);
ct:=ct+1;
atrValue:=ATR;
end
if masc and holding>0 then
begin
sell(1,holding,market);
ct:=0;
atrValue:=0;
end
这样试下。 |