MQL5. Need help with 2nd position and candle entry. - page 2

 
Dogooder:

Ran your code.

What's strange, if I set the backtest for H4, the candles wouldn't use timeLapsed, but when I set it to M1, it would work.

I saw you entered  EventSetTimer(60); but when I deleted it, the effect wouldn't change.

Check again - when you run on H4, your SL and TP gets triggered within the candle itself, that's why new position is opened in the immediate next candle. Things will be different if you enlarge your SL and TP accordingly.


PS. Oops... EventSetTimer(60) can be removed... it was automatically generated when I create the EA template... 

 

Hello everyone, how are you? I hope I was testing your codes well, but when I click to collect, I get many errors, but everything is fine, can you please help me?

Machine translated to English from Spanish, by moderator

Reason: