Thirteen, thanks for your input.
I varied my calculation due to http://www.babypips.com/school/undergraduate/senior-year/position-sizing/calculating-position-sizes.html which suggests different calculations based on different scenarios. I've been hacking around with mql4 for a few months now, but it sounds from your post that there is a way to get round these differences. Surely having different ways of calculating lot size mentioned on the above URL, I need to represent this in code?
Good point about rounding down - I should be doing that. Also good point about maxlot, which I need to change. I also see in your code about the SL calc as an amount rather than a number of pips. Cheers
What do you think about WHRoeder's modification of your code in his most recent post? That's quite a significant difference.
strontiumDog, how did your code work out? I'm struggling with similar code and have been surprised how little discussion there is on the correct coding of this. The position size calculator code out there don't take into account the base currency and also how spread affects R/R and lot size (in low time frames).
Can you share your finished code? My code has got too knotted, so I'm going to start with yours again!
I just worked out that...
double UnitCost = MarketInfo(Symbol(), MODE_TICKVALUE);
is the tick value in the deposit currency. So that's how we don't need to do the extra base currency conversion. I simply do all the calculations in the deposit currency!
To add comments, please log in or register