I've been trying to create buy order only when MACD crosses above 0 (zeroline). I'm seeing order is taken when MACD crosses below zeroline also.
In the attachment, red line trade crossed below 0 so it shouldn't have taken. Green line trade is correct as it crosses above 0 line.
Can anyone suggest me to fix this?
if (CrossAbove(MACD(12, 26, 9).Diff, 0, 1)) { EnterLong(1, "Buy"); } if ((CrossBelow(MACD(Close, 12, 26, 9).Diff, 0, 1)) && (Position.MarketPosition == MarketPosition.Long)) { ExitLong(1); }
Comment