1) The code you show doesn't help to find the address the problem: why does OrderSelect() fails?
2) If there is no valid ticket either the order has never been sent or has been closed already (by ST/TP?).
Snapshot of the backtest with the error:
The error starts appearing at ticket 3. The error began to loop infinitely throughout the backtest. What is strange is that ticket 3 sell order and market order is not reflected at all in the log. It did appear in my result tab though.
Check the log FILE, if there is too much output not all the log is available in the Journal window.
What is this isolated lien at the end ?
} // endif ticket > 0
Please show all the relevant code (and log).
gooly:
1) The code you show doesn't help to find the address the problem: why does OrderSelect() fails? 2) If there is no valid ticket either the order has never been sent or has been closed already (by ST/TP?). |
|

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi all,
This is my first attempt at programming an EA. I am running into a error everytime i tried to do backtesting for my EA. Error is OrderClose error 4108, and unknown ticket for OrderClose function. I can't seem to find any bug in my code + the error seems to happen at random, i.e. the code works for some trades and failed at one particular condition which I cannot figure out. Can someone kindly help me spot my mistakes?
Below is the block of code that is likely to have problems. The below code is supposed to help monitor my trade.
1.) delete pending order if price hit my intended stoploss.
2.) bring stoploss to breakeven once price has reached a certain level in favour of my trade
3.) close trade once certain MA conditions are fulfilled.
Snapshot of the backtest with the error:
The error starts appearing at ticket 3. The error began to loop infinitely throughout the backtest. What is strange is that ticket 3 sell order and market order is not reflected at all in the log. It did appear in my result tab though.