开拓者期货期权程序化系统交易论坛

标题: 小白求助 [打印本页]

作者: yymn504    时间: 2018-3-17 21:52:26     标题: 小白求助

Vars
    NumericSeries SFX;//5天高点
        NumericSeries XFX;//5天低点
        NumericSeries highafter;//记录高点
        NumericSeries hcfudu;//回踩幅度
        BoolSeries con1(False);
        BoolSeries entrycon(False);
        BoolSeries exitcon(false);
       
Begin
    If(BarStatus==0)
        {highafter=h;}
        else{
        highafter=Max(high,highafter[1]);}
        SFX=SwingHigh(1,h,2,5);
        XFX=SwingLow(1,l,2,5);
        PlotNumeric("sfx",sfx);
        PlotNumeric("xfx",xfx);
        con1=CrossOver(h,sfx);
        If(con1=true)hcfudu=sfx-xfx;
        Commentary("hcfudu"+Text(hcfudu));
        entrycon=CrossOver(c[1],sfx[1]);
        exitcon=l<highafter-hcfudu;
        if(entrycon==True and MarketPosition==0)
        Buy(1,o);
        if(exitcon==true and MarketPosition==1)
        Sell(0,Min(highafter-hcfudu,o));
End
[attach]36658[/attach]


想实现的是突破高点做多,回踩超过上一次回踩的幅度就平仓,这个幅度应该怎么样传递下去,请版主和高手们帮忙解决;
作者: yymn504    时间: 2018-3-17 21:57:45

不断比较上升的回调幅度,超过最大的即平仓




欢迎光临 开拓者期货期权程序化系统交易论坛 (http://bbs.tb18.net/) Powered by Discuz! X2