1‘跨周期使用指标PPP中的A和B的1分钟,3分钟,5分钟的值。分别为:A1,B1,A3,B3,A5,B5.(不用跨周期我不知道可以不可以,能用其他方式设定A1,B1,A3,B3,A5,B5也可以)。 A1D:=A1>B1; A3D:=A3>B3; A5D:=A5>B5; 当前合约的多空可用持仓都小于1并且 (A1>A3)&&A1D&&A3D, SPK; (A1D&&A3D&&A5D)&&当前合约的空头可用仓>0&&当前合约的多头可用仓<1,BPK A1X:=A1<B1; A3X:=A3<B3; A5X:=A5<B5; 当前合约的多空可用持仓都小于1并且(A1<A3)&&A1X&&A3X,BPK; (A1X && A3X && A5X)当前合约的多头可用仓>0&&当前合约的空头头可用仓<1,SPK; 要求:指标PPP从当日的第一根K开始。昨日的数据不计算在内 |
a1:STKINDIEX('','ppp.a',0,1,0,todaybar);
a3:STKINDIEX('','ppp.a',0,17,0,todaybar);
a5:STKINDIEX('','ppp.a',0,2,0,todaybar);
b1:STKINDIEX('','ppp.b',0,1,0,todaybar);
b3:STKINDIEX('','ppp.b',0,17,0,todaybar);
b5:STKINDIEX('','ppp.b',0,2,0,todaybar);
A1D:=A1>B1;
A3D:=A3>B3;
A5D:=A5>B5;
if holding>0 and A1>A3 and A1D and A3D then begin
sell(holding>0,holding,market);
buyshort(holding=0,1,market);
end
if A1D and A3D and A5D and holding<0 then begin
sellshort(holding<0,holding,market);
buy(holding=0,1,market);
end
A1X:=A1<B1;
A3X:=A3<B3;
A5X:=A5<B5;
if holding<0 and A1<A3 and A1X and A3X then begin
sellshort(holding<0,holding,market);
buy(holding=0,1,market);
end
if A1X and A3X and A5X and holding>0 then begin
sell(holding>0,holding,market);
buyshort(holding=0,1,market);
end