I've created an EA for position sizing which I would like to share with everyone. Since I am a new member, I could not create a thread for it , so I figured here would be a good place to add it.
The EA takes 2 inputs for calculation:
- Percent risk based on account balance
- Desired stop loss in pips
It also has various other inputs for aesthetic purposes.
The EA outputs a text object on your chart which reports the inputs, symbol it applies to, and the lot size appropriate for the specified sl pips and account risk.
I have based the calculation on the lesson in complex position sizing from babypips (http://www.babypips.com/school/under...on-sizing.html).
The concept here is to calculate the risk you are taking in terms of your base currency,
The EA has been tested using Oanda with account currency in CAD, so if you are using a different account currency or broker, verify the results with the calculator on babypips (http://www.babypips.com/tools/forex-...sitionsize.php). It has not been tested in live trading either.
The EA updates on a tick basis, while this provides up-to-date calculation, it also may be computationally demanding.
How to Calculate Lot Sizes
Additionally, in order to convert risk into the account currency, it uses the last 1 minute close as the exchange rate from a pair containing the account currency.
A few ideas I have for further development are:
- Use keypress events to update the EA since there may not be need for tick based updates
- Convert the EA into an Indicator
- Figure out if account currency conversion can be done with tick data
If there are any advancements on these fronts, I will post an up-to-date version.