First thing to do is to have your loop in the order exit logic decrement downwards. Then get back to us if your code still doesn't work.
If you have a series of indexed orders that you are looping through (0,1,2,3), then deleting order 0 first will mean that the rest slot down into (0,1,2). Then you increment your counter and delete order 1, leaving order 0 behind.
See the problem?
CB
First thing to do is to have your loop in the order exit logic decrement downwards. Then get back to us if your code still doesn't work.
If you have a series of indexed orders that you are looping through (0,1,2,3), then deleting order 0 first will mean that the rest slot down into (0,1,2). Then you increment your counter and delete order 1, leaving order 0 behind.
See the problem?
CB
Thx,
I will try .
That really is your pet peeve isn't it CB? lol
Yep. This month it is.
Its just avoidably poor logic.
Yet on it goes...
CB
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello,
This is my first post here and as you will see, I'm not really a programer. So please bear with me..... :-)
I have altered another EA I found here and wrote the following EA (Attached 37Temp.mq4).
However, when backtesting, even though I can open an order "on time".... sometime the EA ignores my Close order and exits on StopLoss.
For example:
1. I got into Short order - Ok
2. Where I wanted to exit - Not OK - ignored by EA
// Exit Short?
if (Macd_0>Macd_1&&Macd_1<Macd_2)
{
OrderClose(OrderTicket(),OrderLots(),Ask,3,Violet); // close position
return(0); // exit
3. Where the actual Close order executed (Stop loss...)
Example of the problem
Can anyone assist and explain this behaviour?
Thanks in advace to responders...
Rafi.