老师麻烦看一下,这个止损功能哪里出了问题?(图3)
以开仓价画的止损线,为什么不是水平的?(图4)
另外,策略交易功能里最新价,在用到多图层,或者单图层公式里增加了初始设置(滑点、保证金等),商品价格就显示异常。(图2)
ConLong1 = CrossOver(MACDDiff[1],AvgMACD[1]) ;
ConExitLong1 = CrossUnder(MACDDiff[1],AvgMACD[1]) ; //平多方式一:60分macd死叉
ConExitLong2 = BarsSinceEntry > 3 And Low < StopLossLine ; //平多方式二:开多3小时后,收盘价低于建仓价格
//做多:macd金叉
If (MarketPosition <> 1 And ConLong1 == True )
{
Buy(1,Open);
StopLossLine = EntryPrice;
}
If(StopLossLine <> 0 And MarketPosition <> 0)
PlotNumeric("StopLossLine",StopLossLine);
//平多方式一:60分macd死叉
//平多方式二:开多3小时后,收盘价低于建仓价格
If (MarketPosition == 1 And ConExitLong1 == True)
{
sell(1,Open);
StopLossLine = 0;
}
If (MarketPosition == 1 And ConExitLong2 == True)
{
sell(1,min(Low,StopLossLine)); //止损线没生效!
StopLossLine = 0;
}
交流交流VX:JZYMQQ