Download MetaTrader 5

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

To add comments, please log in or register
vla
53
vla  
do say if I use e.g. while loop the order will close itself if the condition is not given anymore?
vla
53
vla  
alright. I have found another way. I'm using OrdersTotalHistory()+1
whroeder1
16296
whroeder1  
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.
vla
53
vla  

logic:

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

 

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

SYED NAUFAL GADDAFI
1399
SYED NAUFAL GADDAFI  

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.

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

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 ,

vla
53
vla  
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!
123
To add comments, please log in or register