I developed a strategy with signals "LONG" and "SHORT".
I want to take profit if the system is long and it's making money but the last two bars closed lower.
I wrote the following code, which is not working:
// Condition set Long Take Profit
if (Close[0] > (Position.AvgPrice)
&& Position.MarketPosition == MarketPosition.Long
&& Close[0] < Close[1]
&& Close[1] < Close[2])
{
ExitLong("TAKEPROFIT", " LONG");
}
Why it doesn't work?
Thank you

Comment