Discussion of article "Cross-Platform Expert Advisor: Money Management"

 

New article Cross-Platform Expert Advisor: Money Management has been published:

This article discusses the implementation of money management method for a cross-platform expert advisor. The money management classes are responsible for the calculation of the lot size to be used for the next trade to be entered by the expert advisor.

In MetaTrader 5, we can see the following results (hedging mode, first 10 trades):

Orders
Open Time Order Symbol Type Volume Price S / L T / P Time State Comment
2017.01.02 00:00:00 2 EURUSD sell 1.00 / 1.00 1.05100 2017.01.02 00:00:00 filled
2017.01.03 03:00:00 3 EURUSD buy 1.00 / 1.00 1.04669 2017.01.03 03:00:00 filled
2017.01.03 03:00:00 4 EURUSD buy 0.05 / 0.05 1.04669 2017.01.03 03:00:00 filled
2017.01.03 10:00:00 5 EURUSD sell 0.05 / 0.05 1.04597 2017.01.03 10:00:00 filled
2017.01.03 10:00:00 6 EURUSD sell 1.00 / 1.00 1.04597 2017.01.03 10:00:00 filled
2017.01.03 20:00:00 7 EURUSD buy 1.00 / 1.00 1.04273 2017.01.03 20:00:00 filled
2017.01.03 20:00:00 8 EURUSD buy 0.05 / 0.05 1.04273 2017.01.03 20:00:00 filled
2017.01.03 22:00:00 9 EURUSD sell 0.05 / 0.05 1.04102 2017.01.03 22:00:00 filled
2017.01.03 22:00:00 10 EURUSD sell 1.00 / 1.00 1.04102 2017.01.03 22:00:00 filled
2017.01.04 02:00:00 11 EURUSD buy 1.00 / 1.00 1.04180 2017.01.04 02:00:00 filled
2017.01.04 02:00:00 12 EURUSD buy 0.05 / 0.05 1.04180 2017.01.04 02:00:00 filled
2017.01.04 03:00:00 13 EURUSD sell 0.05 / 0.05 1.03942 2017.01.04 03:00:00 filled
2017.01.04 03:00:00 14 EURUSD sell 1.00 / 1.00 1.03942 2017.01.04 03:00:00 filled
2017.01.04 06:00:00 15 EURUSD buy 1.00 / 1.00 1.04058 2017.01.04 06:00:00 filled
2017.01.04 06:00:00 16 EURUSD buy 0.05 / 0.05 1.04058 2017.01.04 06:00:00 filled
2017.01.05 11:00:00 17 EURUSD sell 0.05 / 0.05 1.05149 2017.01.05 11:00:00 filled
2017.01.05 11:00:00 18 EURUSD sell 1.00 / 1.00 1.05149 2017.01.05 11:00:00 filled
2017.01.05 16:00:00 19 EURUSD buy 1.00 / 1.00 1.05307 2017.01.05 16:00:00 filled
2017.01.05 16:00:00 20 EURUSD buy 0.05 / 0.05 1.05307 2017.01.05 16:00:00 filled
2017.01.06 05:00:00 21 EURUSD sell 0.05 / 0.05 1.05869 2017.01.06 05:00:00 filled




Author: Enrico Lambino

 

Thanks for this great article, and excellent explanation and code.

 

Hi Enrico. I agree with Roberto, it is excellent work. Thanks a million.

 

Hi,

No simple MM method which calculates lot in % from balance or equity irregarding of SL size?

As for this MM type

Volume = base_volume + (balance / balance_increase) * volume_increment

Does it decrease the lot size when balance becomes less?

Also, would be great to have some MM types depending on previous trades results (losses or profits). Anyway, it can be easily coded basing on existing classes. Thanks.

 

Hello Enrico,

How to implement MM based on number of losing/profitable trades? Martingale and so on? How to calculate previous trade (COrder instance) profit?

 
 
MetaQuotes Software Corp.:

New article Cross-Platform Expert Advisor: Money Management has been published:

Author: Enrico Lambino

great article and explanation of the money management classes. i had stop out issues due to incorrect money management settings. article greatly improved my trading results.