input:NS(5,1,100,1);{
回调比例}
持仓: holding;
tt0:=time<145000;
tt2:=time>145700;//收盘时间
SELLSHORT(tt0 and BP and 持仓<0,持仓,market);
SELLSHORT(tt0 and 持仓<0,持仓,Stopr, LLV(L,ENTERBARS)*(1+NS/100));
BUY(tt0 and BK and 持仓=0,20%,market);
SELL(tt0 and SP and 持仓>0,持仓,market);
SELL(tt0 and 持仓>0,持仓,Stopr, HHV(H,ENTERBARS)*(1-NS/100));
BUYSHORT(tt0 and SK and 持仓=0,20%,market);
有颜色部分如何改 真实交易
呵呵呵,没测试您的代码,眼睛看的,不知您试过没有,说说个人意见。
1:如果是日内,改为STP即可。
2:否则,不知您注意了测试时 跳空的 取值了没有 Low或者High=开盘价?这不合理。
3:如果是这样,需要区分的情况很多种,需要考虑Open,max,min(Stop价,close)的关系,还需考虑Isup,isDown 的开平顺序问题。
这个策略如果您写完美了,也请给我一份,谢谢。
input:NS(5,1,100,1);{
回调比例}
持仓: Tholding;
tt0:=currenttime<145000;
tt2:=currenttime>145700;//收盘时间
TSELLSHORT(tt0 and BP and 持仓<0,持仓,MKT);
TSELLSHORT(tt0 and 持仓<0,持仓,STP, LLV(L,TENTERBARS)*(1+NS/100));
TBUY(tt0 and BK and 持仓=0,20%,MKT);
TSELL(tt0 and SP and 持仓>0,持仓,MKT);
TSELL(tt0 and 持仓>0,持仓,STP, HHV(H,TENTERBARS)*(1-NS/100));
TBUYSHORT(tt0 and SK and 持仓=0,20%,MKT);
金字塔有关程式化交易的教程
http://www.weistock.com/bbs/dispbbs.asp?boardid=2&Id=124
看来你是都没仔细看过