Closing of positions. On indicator signal. - page 9

 
rid писал(а) >>

Afternoon.

EA puts limit bylimit orders following price movement at distance =Distance.

I need to delete excessive (farthest) orders as the price moves upwards.

I have done it. But for some reason, it works very incorrectly! The first order is deleted normally. Then, on the contrary, the ones closest to the price are deleted! Then they stop or are deleted "out of the blue", and the log generates error 4108 (unknown ticket). Then for some time they are deleted normally.

I believe it was said somewhere around here that it is important to properly reorder.

However. Regardless of whether we organize the oversight from the "end" or from the beginning. The result is incorrect.

The code seems to be the simplest one!

What may be wrong here? Please advise!

(OrderSelect(z,SELECT_BY_TICKET, MODE_TRADES)

SELECT_BY_POS

 
JavaDev >> :

(OrderSelect(z,SELECT_BY_TICKET, MODE_TRADES))

SELECT_BY_POS

Go through the index instead of the ticket ? I'm going to try it now...

 
rid писал(а) >>

...to cycle through the index instead of the ticket? I'll try that...

you have an index loop... what does this have to do with the ticks. and bring back the line with the reverse loop...

 

Thank you, JavaDev ! I did as I was told. And it's working!

I can't even believe it. I've been struggling for three days now....

 
rid писал(а) >>

Thank you, JavaDev ! I did as I was told. And it's working!

I can't even believe it. Three days of trouble already....

welcome