Download MetaTrader 5

How does TICKVALUE work? - page 2

To add comments, please log in or register
Download MetaTrader 5 mobile version and trade from anywhere in the world!
brettosm8
241
brettosm8 2014.03.23 09:21  

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!!

brettosm8
241
brettosm8 2014.03.23 09:38  

The code:

void CalculatePositionSize()
   {
    double pips2dbl = 0.00;
    if (Digits % 2 == 1) pips2dbl = Point*10; //DE30=1/JPY=3/EURUSD=5 forum.mql4.com/43064#515262
    else 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
12
To add comments, please log in or register