我这个策略很难成交是不是委托价格有问题

我这个策略很难成交,请老师帮我看看是什么问题,是不是委托价格有问题,我是小白,请多指教。 Params Numeric FastLength(1);// 短期指数平均线参数 Numeric SlowLength(6);// 长期指数平均线参数 Vars Series<Numeric> AvgValue1; Series<Numeric> AvgValue2; Series<Numeric> my_EntryPrice; Events OnInit() { SetConsecEntries(1); } OnBar(ArrayRef<Integer> indexs) { if(BarStatus==0) { SetGlobalVar(1,0); SetGlobalVar(2,0); } AvgValue1 = AverageFC(Close,FastLength); AvgValue2 = AverageFC(Close,SlowLength); PlotNumeric("MA1",AvgValue1); PlotNumeric("MA2",AvgValue2); ////止损代码 if(A_BuyPosition<>0 and low<my_EntryPrice-6) { A_SendOrder(enum_sell,enum_exit,0,min(o,my_EntryPrice-6)); } else if(A_BuyPosition<>0 and high>my_EntryPrice+25) { A_SendOrder(enum_sell,enum_exit,0,max(o,my_EntryPrice+25)); } ////开仓代码 If(A_BuyPosition ==0 && AvgValue1[0] > AvgValue2[0] && AvgValue1[1] < AvgValue2[1] && GetGlobalVar(1)<>1 && A_GetOpenOrderCount==0) { A_SendOrder(Enum_buy,enum_entry,1,Q_AskPrice); SetGlobalVar(1,1); SetGlobalVar(2,0); my_EntryPrice=Q_AskPrice; } If(A_BuyPosition<>0 && AvgValue1[0] < AvgValue2[0] && AvgValue1[1] > AvgValue2[1] && GetGlobalVar(2)<>1 && A_GetOpenOrderCount==0 ) { A_SendOrder(enum_sell,enum_exit,1,Q_AskPrice); SetGlobalVar(2,1); SetGlobalVar(1,0); } }

你的策略不要用了!!!

第一 止损没有用状态变量没有查询可平仓,你就这么运行肯定会报可平仓不足 第二 止损条件 low<my_EntryPrice-6 ,意味着最新价肯定比my_EntryPrice-6小,然后你报单用my_EntryPrice-6报?最新价都比my_EntryPrice-6小了,还用更高的价格卖,卖得掉吗? 第三 你的my_entryprice为什么是序列变量?你确定这个在运行中能记录正确的开仓价格吗? 问题很多,感觉对语法机制的了解一知半解,完全在东拼西凑

回复:谢谢你说的这么清楚,我真的是拼的。如果能帮我改一下,就万分感谢了

回复: