Download MetaTrader 5

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

To add comments, please log in or register
Use MQL5 Cloud Network. It is secure!
vla
53
vla 2014.11.28 13:43  
do say if I use e.g. while loop the order will close itself if the condition is not given anymore?
vla
53
vla 2014.11.28 16:58  
alright. I have found another way. I'm using OrdersTotalHistory()+1
whroeder1
14532
whroeder1 2014.11.29 17:44  
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 2014.11.30 11:04  

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
1401
SYED NAUFAL GADDAFI 2014.11.30 11:25  

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
14532
whroeder1 2014.12.01 18:53  
TheOneWhoKnocks: logic: ticketnumber of open trade = number of all orders in trading history +1
Only in the tester
barnacle7
379
barnacle7 2014.12.02 07:24  

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 2014.12.02 19:45  
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