Download MetaTrader 5

money management - how to use an order counter?

To add comments, please log in or register
Have you found an interesting application? Publish it in Code Base - millions of traders will appreciate that!
bobzacaria
45
bobzacaria 2010.10.16 07:53 

Hello everyone,

 

Need your help with the code for the following rule 

The EA choose the minimum of 2 lot sizes: the first lot size calculated using a risk factor of 2.5% (Lot size = (Free Margin * Risk Factor = 2.5%) / (SL * Point Value), the second lot size use the current count of executed orders-- example:

- EA Trading Start Date = 01/01/2009

- # of orders since 01/01/2009 = 6 orders (please note # of orders is based on group order not individual order): when the EA place the first order it will open a new order group (order group can be single order or many orders) until it close the order group.

- Current estimated lot size = 6 + 1 = 7 Lots 

 

Order Group Currency Name # of Lots Enter Date Exit Date # of Days
1 CADJPY                     1.00 7/7/2009 7/15/2009 8
1 CADJPY                     1.00 7/8/2009 7/15/2009 7
1 CADJPY                     1.00 7/13/2009 7/15/2009 2
2 CADJPY                     2.00 7/23/2009 8/12/2009 20
2 CADJPY                     2.00 7/28/2009 8/12/2009 15
2 CADJPY                     2.00 7/29/2009 8/12/2009 14
2 CADJPY                     2.00 7/30/2009 8/12/2009 13
2 CADJPY                     2.00 7/31/2009 8/12/2009 12
2 CADJPY                     2.00 7/31/2009 8/12/2009 12
2 CADJPY                     2.00 8/3/2009 8/12/2009 9
2 CADJPY                     2.00 8/3/2009 8/12/2009 9
2 CADJPY                     2.00 8/4/2009 8/12/2009 8
2 CADJPY                     2.00 8/5/2009 8/12/2009 7
2 CADJPY                     2.00 8/6/2009 8/12/2009 6
2 CADJPY                     2.00 8/7/2009 8/12/2009 5
2 CADJPY                     2.00 8/10/2009 8/12/2009 2
orders 

Documentation on MQL5: Standard Constants, Enumerations and Structures / Environment State / Symbol Properties
  • www.mql5.com
Standard Constants, Enumerations and Structures / Environment State / Symbol Properties - Documentation on MQL5
To add comments, please log in or register