Pip Value Script

 

Can someone tell me if this script is 100% correct?

I am having some doubts because, for example, I was not taking into account that in the indices 1 pips is not the minimum unit of change, that is, it is not a decimal, but rather the change of 1 integer. And that has confused me

// Define the trading lot size
double lotSize = 1;

// Get the value of one pip in the current chart
double GetPipValue()
{
    double tickSize = SymbolInfoDouble(Symbol(), SYMBOL_TRADE_TICK_SIZE);
    double tickValue = SymbolInfoDouble(Symbol(), SYMBOL_TRADE_TICK_VALUE);
    double pipValue = tickValue / tickSize;
    return pipValue;
}

// Calculate pip value based on lot size
double CalculatePipValue(double lotSize)
{
    double pipValue = GetPipValue();
    double pipValueInVolume = pipValue * lotSize;
    return pipValueInVolume;
}

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void OnStart()
{
    double pipValueInVolume = CalculatePipValue(lotSize);
    double pipValue = GetPipValue(); // Get the value of one pip
    Print("The value of one pip for a lot size of ", lotSize, " in the current chart is: ", pipValueInVolume);
}
//+------------------------------------------------------------------+
 

Correct

try this 

If the enumeration texts are literal and they don't mean something else and not a mis-translation then this is proper :

//A.forget pips , pip is for python
double GetPointValue(double for_lot)
{
    //size of tick
    double tickSize = SymbolInfoDouble(_Symbol, SYMBOL_TRADE_TICK_SIZE);
    //value of tick
    double tickValue = SymbolInfoDouble(_Symbol, SYMBOL_TRADE_TICK_VALUE);
    //how many points in tick 
    double points_in_tick=tickSize/_Point;
    
    double pointValueForOneLot =tickValue/points_in_tick;
    return(pointValueForOneLot*for_lot);
}

So if the text matches what it is , then you measure how many points are inside a tick . In eurusd 0.00001/0.00001 is 1.00 so the tick value will match the point value

I've been neglecting this for long and recently in one of your fellow moderators postings i realized that the tick size is a step.

 
Lorentzos Roussos #:

Correct

try this 

If the enumeration texts are literal and they don't mean something else and not a mis-translation then this is proper :

So if the text matches what it is , then you measure how many points are inside a tick . In eurusd 0.00001/0.00001 is 1.00 so the tick value will match the point value

I've been neglecting this for long and recently in one of your fellow moderators postings i realized that the tick size is a step.

Thanks a lot!  Very well seen!
Reason: