//+------------------------------------------------------------------+
//|                                                    Pip Value.mq4 |
//+------------------------------------------------------------------+


#property copyright    "forex-station.com"
#property link         "forex-station.com"


#property indicator_chart_window
#property strict



input double     LotSize              = 1;             // Lot Size
input ENUM_BASE_CORNER corner         = 2;             // Base Corner
input string     labelFont            = "Consolas";    // Font Type
input color      labelColor           = clrTurquoise;  // Font Color
input int        labelSize            = 10;            // Font Size
input int        shiftY               = 0;             // Adjusts Display Up & Down
input int        shiftX               = 10;            // Adjusts Display Side to Side



string disText1,disText2,disText3;
double point;



//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int OnInit()
  {
// Broker digits
   point=Point;
   if((Digits==3) || (Digits==5))
     {
      point*=10;
     }

//---
   return(INIT_SUCCEEDED);
  }


//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
   
   ObjectDelete ("PV1");
   ObjectDelete ("PV2");
   ObjectDelete ("PV3"); 
     
   return;
  }



//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
  {


   string DepositCurrency=AccountInfoString(ACCOUNT_CURRENCY);
   double PipValue=(((MarketInfo(Symbol(),MODE_TICKVALUE)*point)/MarketInfo(Symbol(),MODE_TICKSIZE))*LotSize);
   double PointValue=PipValue/10;


   disText1="Lot size: " + DoubleToStr(LotSize,2);
   disText2="One point $" + DoubleToStr(PointValue,3);
   disText3="One pip $" + DoubleToStr(PipValue,3);



//Lot value
   createLabel("PV1",17+shiftY,10+shiftX);
   ObjectSetText("PV1",disText1,labelSize,labelFont,labelColor);

//Point value
   createLabel("PV2",37+shiftY,10+shiftX);
   ObjectSetText("PV2",disText2,labelSize,labelFont,labelColor);

//Pip value
   createLabel("PV3",57+shiftY,10+shiftX);
   ObjectSetText("PV3",disText3,labelSize,labelFont,labelColor);



//--- return value of prev_calculated for next call
   return(rates_total);
  }





//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int createLabel(string n,int Shift_Y,int Shift_X)
  {
   ObjectCreate(n,OBJ_LABEL,0,0,0);
   ObjectSet(n,OBJPROP_CORNER,corner);
   ObjectSet(n,OBJPROP_XDISTANCE,Shift_X);
   ObjectSet(n,OBJPROP_YDISTANCE,Shift_Y);
   ObjectSet(n,OBJPROP_BACK,false);

   return(0);
  }

//+------------------------------------------------------------------+
