Close one position open opposite position without hedge error - page 2

 

Resolving algorithm problems can be a complicated process. Have you inserted any temporary code with print statements to figure out what is going on inside the EA? Your Alerts are showing basic progress and that is helpful, in isolating the problem but I recommend inserting temporary print statements to sample what is making the EA act in the fashion that it is.


Are you saying the foregoing log printout is stilling occurring after you fixed the OrderClose statement?


I know it's a pain to use temporary code, but sometimes it is essential in order to diagnose what is really happening. I use that process nearly every day to debug my programs. Sometimes my debugging process is as simple as placing Print("I am still running here") at progressive locations in the EA code (run after run) to see how far the execution gets before it freezes up and makes the log size grow to 250mb.


Are you familiar with that procedure, or am I stating the obvious that you already know?

 
FXtrader2008 wrote >>

Resolving algorithm problems can be a complicated process. Have you inserted any temporary code with print statements to figure out what is going on inside the EA? Your Alerts are showing basic progress and that is helpful, in isolating the problem but I recommend inserting temporary print statements to sample what is making the EA act in the fashion that it is.

Are you saying the foregoing log printout is stilling occurring after you fixed the OrderClose statement?

I know it's a pain to use temporary code, but sometimes it is essential in order to diagnose what is really happening. I use that process nearly every day to debug my programs. Sometimes my debugging process is as simple as placing Print("I am still running here") at progressive locations in the EA code (run after run) to see how far the execution gets before it freezes up and makes the log size grow to 250mb.

Are you familiar with that procedure, or am I stating the obvious that you already know?

Getting closer on tracking down problem. It seems as though the closing trade doesn't complete in time for the opening trade not to be seen, by the server, as a hedging position.

.

According to the log this SELL order ( #8661298 ) closed, but, it didn't. In fact, the BUY order was utilizing the OrderType value ( 1 ) and Ticket # ( 8661298 ).

.

15:21:21 ZEME EURUSD,M1: Alert: POS A - Open order type is: 1 Ticket# 8661298
15:21:21 ZEME EURUSD,M1: Alert: POS D - Open order type is: 1 Ticket# 8661298
15:21:28 ZEME EURUSD,M1: Alert: POS E - Open order type is: 1 Ticket# 8661298
15:21:29 ZEME EURUSD,M1: Alert: POS A - Open order type is: 1 Ticket# 8661298

15:21:29 ZEME EURUSD,M1: Alert: Closed - Sell Order 8661298
15:21:29 ZEME EURUSD,M1: Alert: 0

.

15:21:29 ZEME EURUSD,M1: Alert: POS C - Open order type is: 1 Ticket# 8661298
15:21:38 ZEME EURUSD,M1: Alert: Opened - Buy Order -1
15:21:38 ZEME EURUSD,M1: Alert: 149

.

15:21:38 ZEME EURUSD,M1: Alert: POS D - Open order type is: 1 Ticket# 8661298
15:21:38 ZEME EURUSD,M1: Alert: POS E - Open order type is: 1 Ticket# 8661298

.

.

Reason: