New article Functions for Money Management in an Expert Advisor is published:
The development of trading strategies primarily focuses on searching for patterns for entering and exiting the market, as well as maintaining positions. If we are able to formalize some patterns into rules for automated trading, then the trader faces the question of calculating the volume of positions, the size of the margins, as well as maintaining a safe level of mortgage funds for assuring open positions in an automated mode. In this article we will use the MQL5 language to construct simple examples of conducting these calculations.
Thanks greatly for your article, and all of your other articles - advice and guidance for us MQL/C++ n00bs is hugely appreciated. Spasiba.
I am currently working on my own Money Management code, to enforce trading discipline and remove emotionally damaging fear and greed.
My philosophy is a little different in terms of selecting lot size - everything begins and ends with Money Management (MM).
If I have an account balance of (e.g.) 10,000, and a 'maximum at risk per trade philosophy' of 5% then the most I can risk on one position is 500.
If I determine that my stop is 20 pips (because of Bollinger Lower or ATR, or whatever [adjusted for 'its gone bad, get out']) , then my lot size is 500/20, giving a 25 pip investment.
If Target (Limit/TKP) and 'Crash out' (Stop Loss/STP) are always in pips, it makes the calculation easier.
If the signal (buy/sell) is not strong, then adjust the risk downwards. If stronger (ADX 50+, or rising maybe), then increase the money at risk.
Allowing for leverage gives a formula of:
Lots=(Account*0.05)/Leverage/STP)*(RISKADJ); // Where RISKADJ is 1.00 normally, 0.50 for a 'poorer, riskier' trade, and maybe 2.0 for a 'green light' trade.
In short, this philosophy asks 'how many lots is this trade worth?' rather than 'have I the margin for a 2.0 lot trade?'.
Mathmatically, it is not too different from your code, but the philosophy begins and ends with managing risk and exposure, and protecting the money in the account.
Buy/sell signals have tens of thousands of combinations, which provide an endless study for all of us.
Money management has very few parameters, and just one key parameter - 'how much of my account will I risk in this trade?'
Hope this makes sense, and thanks again for everything.
This is not Money Management .
only how to get information about the most important characteristics of the trading account and about the properties of financial instruments.
these information can be used to Money Management.
Of course it isn't. As you can see, even the author of the article named it "Functions for Money Management (...)". So I don't see a point in you remark.