Jump to content

How to get OrdersTotal in EA


smurf43

Recommended Posts

Hello MQL4 Programming Experts

 

Could you please let me know the MQL4 Code for calculating Total Number of Orders (Buy + Sell) initiated by each Hedge EA with different Magic Number (e.g. 1234 and 9876).

 

I am running two Hedge EAs with different Magic Numbers on same currency pair in Demo Account. And I want to modify the EA to include "OrdersTotal" initiated by each EA

 

Thank you!

Sam

Link to comment
Share on other sites

You just need to loop through all open orders and check their magic numbers. Then just keep incrementing the count variable for each magic number.

 

If you don't know how to loop through orders just take a look at the source code of virtually any EA and you'll find examples.

 

Regards

 

Lux

Link to comment
Share on other sites

  • 2 weeks later...
You just need to loop through all open orders and check their magic numbers. Then just keep incrementing the count variable for each magic number.

 

If you don't know how to loop through orders just take a look at the source code of virtually any EA and you'll find examples.

 

Regards

 

Lux

When such a thing never worked, it is difficult to understand himself. If it is not difficult, please let us know MQL4 code.

Link to comment
Share on other sites

I don't know what do you want exactly. I send you a little ea as tools for protection of accounts:

 

1/ it close the orders if equity > coeff % of balance

 

2/ it send Stoploss et Takeprofit or modify them for order of magicnumber magic1 and magic2

 

3/ it hedge if equity < HDG % of beginning equity

 

 

https://www.asuswebstorage.com/navigate/share/GY4N5U7GGL

Edited by klod
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...