First Steps - EA does not run as it should - page 3

 
do say if I use e.g. while loop the order will close itself if the condition is not given anymore?
 
alright. I have found another way. I'm using OrdersTotalHistory()+1
 
TheOneWhoKnocks:  I have found another way. I'm using OrdersTotalHistory()+1
  1. What does the number of orders in history have to do with closing open orders?
  2. History positions are [0 .. OrdersTotalHistory() - 1] for a count of OrdersTotalHistory(). +1 is bogus.
 

logic:

ticketnumber of open trade = number of all orders in trading history +1

 

But you are absolutely right. using loop makes way more sense.

 

Just use condition and loop. No need to use While.



ticketnumber of open trade = number of all orders in trading history +1

 

No offense here but the logic fails miserably. You need to think again why.

 
TheOneWhoKnocks: logic: ticketnumber of open trade = number of all orders in trading history +1
Only in the tester
 

I have used this sample in MQl4 Book:            https://book.mql4.com/samples/expert

It is in pre: MT4 Build 600 code however the structure/process/Logic is still useful.

Not sure if it helps you or not ,

 
Thanks guys for your help! The hint using the for loop was very helpful. I looked at some other experts and found it a lot. But the mql4 book look very helpful too. Thanks WHRoeder for your advice!
Reason: