你好,请问一下,我平仓条件写法,例开仓后上涨百分之二十,回撤百分之五,并且MA<MA2可以这样写可以吗?还是用MA[1]<MA2[1]这样的写法呢?我认为均线就是回撤百分五当时起到一个比较的作用
If(MarketPosition==1 && BarsSinceLastEntry>0 && HighestAfterEntry[1]>=LastEntryPrice*(1+0.01*StartPer1) && Low<=HighestAfterEntry[1]-(HighestAfterEntry[1]-LastEntryPrice)*0.01*StopPer1 and MA5<MA20[1])
{
Sell(0,Min(Open,HighestAfterEntry[1]-(HighestAfterEntry[1]-LastEntryPrice)*0.01*StopPer1));
Commentary("最大盈利达到"+Text(StartPer1)+"%之后盈利回撤"+Text(StopPer1)+"%平多");
}
2023-02-14 22:58
Low<=HighestAfterEntry[1]-(HighestAfterEntry[1]-LastEntryPrice)*0.01*StopPer1 and MA5<MA20[1]
有偷价和信号闪烁可能
因为你不知道Low<=HighestAfterEntry[1]-(HighestAfterEntry[1]-LastEntryPrice)*0.01*StopPer1和MA5<MA20[1]这两个条件是先后发生的还是同时发生的。如果MA5<MA20[1]后发生,那么你就偷价了。
谢谢老师