No apply a slippage to you OrderSend, and change it:
Same for sell part.It's not a Slippage issue . . . this is being tested in the Strategy Tester, there is no slippage . . . . and the issue was . . "OrderClose() error 138 during backtest"
The problem is your variable type . . . you never set it so it's always 0 . . . even for a OP_SELL
Although if I define it as a static variable there is no error code at all, but the order will still not close.
Read the documentation for the functions you are trying to use, how do you expect this to work ?
int GetTicket(int ticket) // Provide most recent ticket { RefreshRates(); ticket = OrderSelect(0,SELECT_BY_POS,MODE_TRADES); // <--------- NO, read the Documentation for OrderSelect. return(ticket); }
Read the documentation for the functions you are trying to use, how do you expect this to work ?
You're completely right. This is my first EA so I imagine I've made a lot of mistakes similar to this, I'm going to go back and audit.
Thanks for the help!
Thanks for the help!

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I am getting error 138 when backtesting this robot. I am not sure what the problem is.
Am I supposed to apply RefreshRates() somewhere?
Please take a look at my code, any help would be appreciated.