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

标题: 请大侠帮修改一个信号闪烁问题 [打印本页]

作者: zlqh19000795    时间: 2015-8-12 13:42:40     标题: 请大侠帮修改一个信号闪烁问题

问题描述:做if1508  1分钟k线  程序出现平仓信号后实盘马上平仓,但信号很可能会在该k线这一分钟内闪烁而消失 则应继续持仓,而实盘已平仓。希望平仓改为“平仓信号在该k线走完后的收盘价信号仍然还在时,平仓交易” 如何改:
//平仓继续
        If(MarketPosition == 1)
        {
                If (High >= EntryPrice + ProfitTarget)
                {
                        Sell(0, Max(Open, EntryPrice + ProfitTarget));
                        Commentary("多头止盈");
                }
                Else If (Highest(High, BarsSinceEntry) >= EntryPrice + MinPBCritical && Close < EntryPrice + MinProfitTarget)
                {
                        Sell(0, Close);
                        Commentary("多头最低止盈");
                }
                Else If (ExitLong)
                {
                        Sell(0, Close);
                        Commentary("多头日内平仓");
                }
                If(OpenPeriod == 1)
                {
                        If (Highest(High, BarsSinceEntry) >= EntryPrice + PBCritical && Close <= Highest(High, BarsSinceEntry) - Drawdown)
                                {
                                        Sell(0, Close);
                                        Commentary("多头回撤止盈");
                                }
                }
                If(Highest(BIAS, BarsSinceEntry) >= 20 && BIAS < 9.5)
                {
                        Sell(0, Close);
                        Commentary("BIAS平多");
                        IsFirBShort = False;
                }
        }
        If(MarketPosition==-1)
        {
                If (Low <= EntryPrice - ProfitTarget)
                {
                        BuyToCover(0, Min(Open, EntryPrice - ProfitTarget));
                        Commentary("空头止盈");
                }
                Else If (Lowest(Low, BarsSinceEntry) <= EntryPrice - MinPBCritical && Close > EntryPrice - MinProfitTarget)
                {
                        BuyToCover(0, Close);
                        Commentary("空头最低止盈");
                }
                Else If (ExitShort)
                {
                        BuyToCover(0, Close);
                        Commentary("空头日内平仓");
                }
                If(OpenPeriod == 1)
                {
                        If (Lowest(Low, BarsSinceEntry) <= EntryPrice - PBCritical && Close >= Lowest(Low, BarsSinceEntry) + Drawdown)
                                {
                                        BuyToCover(0, Close);
                                        Commentary("空头回撤止盈");
                                }
                }
                If(Lowest(BIAS, BarsSinceEntry) <= -20 && BIAS > -9.5)
                {
                        BuyToCover(0, Close);
                        Commentary("BIAS平空");
                        IsFirSShort = False;
                }
        }
       
        If (GetGlobalVar(0) != 888)
                SetGlobalVar(1, 0);//延迟TICK数量
        Else
                SetGlobalVar(1, GetGlobalVar(1) + 1);

作者: stone00010002    时间: 2015-9-7 10:59:16

Else If (Highest(High, BarsSinceEntry) >= EntryPrice + MinPBCritical && Close[1] < EntryPrice + MinProfitTarget)
                {
                        Sell(0, open);
                        Commentary("多头最低止盈");
                }
下面程序也都这样修改
作者: liangls1982    时间: 2015-11-14 15:28:29

把close 改成 close[1]之后,模型立刻变得没有太多盈利




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