回测都可以,有信号,结果也很好。为什么实盘就不提示,不交易呢
大神们看看这个代码,回测都可以,有信号。为什么实盘就不提示,不交易呢,品种挂单时都变成小绿脸,说明账号没问题,这个代码是前面部分。Params Numeric length(5); Numeric hands(1); Numeric Stop_win(2000); Numeric Stop_loss(1000); Numeric n(-2);Vars Numeric myhigh; Numeric mylow; Numeric MyEntryPrice; Numeric MyExitPrice;Events onBar(ArrayRef<Integer> indexs) { if(time>=0.1455) { if(MarketPosition==1) sell(0,open); if(MarketPosition==-1) { buytocover(0,open); } } myhigh = Highest(High[1],length); mylow = Lowest(Low[1],length); PlotNumeric(\"myhigh\",myhigh); PlotNumeric(\"mylow\",mylow); if (High>myhigh and MarketPosition<>1 and open<=myhigh and time>=0.0901 && time <0.1455) { Buy(hands,myhigh+n*MinMove*pricescale); } if ( MarketPosition<>1 and open>myhigh and time>=0.0901 && time <0.1455) { Buy(hands,open); } if (Low<mylow and MarketPosition<>-1 and open>=mylow and time>=0.0901 && time <0.1455) { SellShort(hands,mylow-n*MinMove*pricescale); } if ( MarketPosition<>-1 and open<mylow and time>=0.0901 && time <0.1455) { SellShort(hands,open); } MyEntryPrice = AvgEntryPrice; If(MarketPosition==1) // 有多仓的情况 { If(High >= MyEntryPrice + Stop_win) // 止赢条件表达式 { MyExitPrice = MyEntryPrice + Stop_win; If(Open > MyExitPrice) MyExitPrice = Open; // 如果该Bar开盘价有跳空触发,则用开盘价代替 Sell(0,MyExitPrice);