I have an EA that trades against the trend in M1 timeframe, looking for a reversal. It can get big drawdowns when the 20 pip stop loss is hit and it re-opens a position again.
I have added code to try to stop this from happening by using at the start of the trade entry condition:
Closed P/L in Pips > -19
or Bars since Order Closed > 500 (in M1 this is 500 minutes)
The problem that I have is that it wont start the first trade in backtest as it won’t meet either of these conditions, so it doesn’t trade.
To try to resolve this I added:
or Market Positions Count = 0
which I would have assumed would get the first trade started, but it still isn’t back testing. Any suggestions to get it to work?
you can add this into your condition to make the strategy open the first trade even if there was no trade previously open
if (Bars since Order Closed == -1) OR (… your existing condition …)
If the function cannot find a previous order (it will be the first trade) it return value = -1
Let me know if that helped
You must be logged in to reply to this topic.