Yeah I followed the link but didn't feel confident I understood it.
Have actually getting the same results now! Well actually, the 3rd decimal is sometimes rounded off differently but that's ok I think, it's close enough.
void CalculatePositionSize()
{
double pips2dbl = 0.00;
if (Digits % 2 == 1) pips2dbl = Point*10; //DE30=1/JPY=3/EURUSD=5 forum.mql4.com/43064#515262else pips2dbl = Point;
UnitCost=MarketInfo(Symbol(),MODE_TICKVALUE);
TickSize=MarketInfo(Symbol(),MODE_TICKSIZE);
PositionSize = RiskMoney / (RiskPips * pips2dbl * UnitCost / TickSize);
//where RiskMoney = The amount of money being risked on the trade.//StopLoss = RiskPips i.e. The number of pips between the EntryLevel and stop-loss level.//UnitCost = The tick value in the deposit currenty//TickSize = The tick size in points.
}//End CalculatePositionSize
Yeah I followed the link but didn't feel confident I understood it.
Have actually getting the same results now! Well actually, the 3rd decimal is sometimes rounded off differently but that's ok I think, it's close enough.
THANKS!!
The code: