请教: 为何没任何信号出现?
ZZ1:=cross(c,ma(c,5));
DD1:=cross(ma(c,5),c);
开多条件:=ZZ1;//开多条件
平多条件:=DD1;//平多条件
开空条件:=DD1;//开空条件
平空条件:=ZZ1;//平空条件
///////////////////////////////////////////////////////////////////////////////////////////////
TR1:=MAX(MAX((HIGH-LOW),ABS(REF(CLOSE,1)-HIGH)),ABS(REF(CLOSE,1)-LOW));
ATR:=MA(TR1,14);
多开RATR:=valuewhen(开多条件 and holding=2,ATR);
空开RATR:=valuewhen(开空条件 and holding=2,ATR);
{
1.开仓2手后自动设止损 X*RATR (X缺省为 1)
2.开仓2手后盈利达到了 Y*RATR, 将2手止损改为保本(成本+2跳)
3.保本后,盈利未达到 Z1*RATR前,忽略所有平仓信号,只有在盈利超过 Z1*RATR的平仓信号出现后才平仓1手。
4.保本后,盈利未达到 Z2*RATR前,忽略所有平仓信号,只有在盈利超过 Z2*RATR的平仓信号出现后才平仓1手。
}
if openprofit<=-2*x*多开RATR then SELL(1,0,market);
if openprofit>=y*多开RATR then begin
if openprofit>=zyx1*多开RATR and openprofit<zyx2*多开RATR and 平多条件 and holding=2 then sell(holding=2,1,market);
if openprofit>=zyx2*多开RATR and 平多条件 and holding=1 then sell(holding=1,1,market);
end
if openprofit<=-1*x*空开RATR then SELLSHORT(1,0,market);
if openprofit>=y*空开RATR then begin
if openprofit>=zyx1*空开RATR and openprofit<zyx2*空开RATR and 平空条件 and holding=2 then SELLSHORT(holding=2,1,market);
if openprofit>=zyx2*空开RATR and 平空条件 and holding=1 then SELLSHORT(holding=1,1,market);
end
资产:asset,noaxis;
X:=1;
Y:=2;
ZYX1:=3;
ZYX2:=4;
{
RATR 就是开仓信号出现当时的ATR值。
1.开仓2手后自动设止损 X*RATR (X缺省为 1)
2.开仓2手后盈利达到了 Y*RATR, 将2手止损改为保本(成本+2跳)(Y缺省为2)
3.保本后,盈利未达到 Zyx1*RATR前,忽略所有平仓信号,只有在盈利超过 Zyx1*RATR的平仓信号出现后才平仓1手。
4.保本后,盈利未达到 Zyx2*RATR前,忽略所有平仓信号,只有在盈利超过 Zyx2*RATR的平仓信号出现后才平仓1手。
}
[此贴子已经被作者于2013/10/14 16:55:42编辑过]