Trade Selection: Position Not Found

 

Hey everyone, been running into some problems and i'm a good 4 hours into spinning my wheels and i'm about to go down the rabbit hole in the forums/books so i figured it might be worth a shot to ask.

I've been testing my EA on the strategy tester and for some reason when there's definitely a trade open and i try to close part of it or move a stop, once and a while it will say position not found (mostly on the sell side).... but there's definitely a trade open..


i've tried for loops going through PositionsTotal-1, selecting by ticket, selecting by index. still shows the ticket as 0 no matter which way i go about it...


anyone come across this before?

 

Show us the code you are using (or an example) so we can reproduce the error. Also, show us your strategy tester settings.

 
Emanuel Amorim #:

Show us the code you are using (or an example) so we can reproduce the error. Also, show us your strategy tester settings.

Turned out to be a static variable i was using wasn't updating quick enough for some reason in my new EA so i just forced an additional update and it solved the problem, selects trades no problem now using the conventions above.