How To Get The Previous Days Pivot Lines Indicator Value From An EA ?

 
Hi Guys 

I want to Get The previous Days values of a Pivot points indicator .

I Use The iCustom() To Do That

   int DayBarNumber=iBarShift( NULL, PERIOD_H1, TimeDay( Time[1] ));

// Day 1
   double D1R3=iCustom( NULL, PERIOD_H1, "FXI Weekly Pivots" , maxWeeks,weeklyNotDaily,showPivotLines,showPivotLabels,showPivotIcons,pivotThickness,pivotFontSize,pivotFont,R3Color,R2Color,R1Color,PColor,S1Color,S2Color,S3Color, 0, DayBarNumber );
   double D1R2=iCustom( NULL, PERIOD_H1, "FXI Weekly Pivots" , maxWeeks,weeklyNotDaily,showPivotLines,showPivotLabels,showPivotIcons,pivotThickness,pivotFontSize,pivotFont,R3Color,R2Color,R1Color,PColor,S1Color,S2Color,S3Color, 1, DayBarNumber );
   double D1R1=iCustom( NULL, PERIOD_H1, "FXI Weekly Pivots" , maxWeeks,weeklyNotDaily,showPivotLines,showPivotLabels,showPivotIcons,pivotThickness,pivotFontSize,pivotFont,R3Color,R2Color,R1Color,PColor,S1Color,S2Color,S3Color, 2, DayBarNumber );
   double D1P =iCustom( NULL, PERIOD_H1, "FXI Weekly Pivots" , maxWeeks,weeklyNotDaily,showPivotLines,showPivotLabels,showPivotIcons,pivotThickness,pivotFontSize,pivotFont,R3Color,R2Color,R1Color,PColor,S1Color,S2Color,S3Color, 3, DayBarNumber );
   double D1S1=iCustom( NULL, PERIOD_H1, "FXI Weekly Pivots" , maxWeeks,weeklyNotDaily,showPivotLines,showPivotLabels,showPivotIcons,pivotThickness,pivotFontSize,pivotFont,R3Color,R2Color,R1Color,PColor,S1Color,S2Color,S3Color, 4, DayBarNumber );
   double D1S2=iCustom( NULL, PERIOD_H1, "FXI Weekly Pivots" , maxWeeks,weeklyNotDaily,showPivotLines,showPivotLabels,showPivotIcons,pivotThickness,pivotFontSize,pivotFont,R3Color,R2Color,R1Color,PColor,S1Color,S2Color,S3Color, 5, DayBarNumber );
   double D1S3=iCustom( NULL, PERIOD_H1, "FXI Weekly Pivots" , maxWeeks,weeklyNotDaily,showPivotLines,showPivotLabels,showPivotIcons,pivotThickness,pivotFontSize,pivotFont,R3Color,R2Color,R1Color,PColor,S1Color,S2Color,S3Color, 6, DayBarNumber );
   // Day 2
   double D2R3=iCustom( NULL, PERIOD_H1, "FXI Weekly Pivots" , maxWeeks,weeklyNotDaily,showPivotLines,showPivotLabels,showPivotIcons,pivotThickness,pivotFontSize,pivotFont,R3Color,R2Color,R1Color,PColor,S1Color,S2Color,S3Color, 0, DayBarNumber-23 );
   double D2R2=iCustom( NULL, PERIOD_H1, "FXI Weekly Pivots" , maxWeeks,weeklyNotDaily,showPivotLines,showPivotLabels,showPivotIcons,pivotThickness,pivotFontSize,pivotFont,R3Color,R2Color,R1Color,PColor,S1Color,S2Color,S3Color, 1, DayBarNumber-23 );
   double D2R1=iCustom( NULL, PERIOD_H1, "FXI Weekly Pivots" , maxWeeks,weeklyNotDaily,showPivotLines,showPivotLabels,showPivotIcons,pivotThickness,pivotFontSize,pivotFont,R3Color,R2Color,R1Color,PColor,S1Color,S2Color,S3Color, 2, DayBarNumber-23 );
   double D2P =iCustom( NULL, PERIOD_H1, "FXI Weekly Pivots" , maxWeeks,weeklyNotDaily,showPivotLines,showPivotLabels,showPivotIcons,pivotThickness,pivotFontSize,pivotFont,R3Color,R2Color,R1Color,PColor,S1Color,S2Color,S3Color, 3, DayBarNumber-23 );
   double D2S1=iCustom( NULL, PERIOD_H1, "FXI Weekly Pivots" , maxWeeks,weeklyNotDaily,showPivotLines,showPivotLabels,showPivotIcons,pivotThickness,pivotFontSize,pivotFont,R3Color,R2Color,R1Color,PColor,S1Color,S2Color,S3Color, 4, DayBarNumber-23 );
   double D2S2=iCustom( NULL, PERIOD_H1, "FXI Weekly Pivots" , maxWeeks,weeklyNotDaily,showPivotLines,showPivotLabels,showPivotIcons,pivotThickness,pivotFontSize,pivotFont,R3Color,R2Color,R1Color,PColor,S1Color,S2Color,S3Color, 5, DayBarNumber-23 );
   double D2S3=iCustom( NULL, PERIOD_H1, "FXI Weekly Pivots" , maxWeeks,weeklyNotDaily,showPivotLines,showPivotLabels,showPivotIcons,pivotThickness,pivotFontSize,pivotFont,R3Color,R2Color,R1Color,PColor,S1Color,S2Color,S3Color, 6, DayBarNumber-23 );
   // Day 3
   double D3R3=iCustom( NULL, PERIOD_H1, "FXI Weekly Pivots" , maxWeeks,weeklyNotDaily,showPivotLines,showPivotLabels,showPivotIcons,pivotThickness,pivotFontSize,pivotFont,R3Color,R2Color,R1Color,PColor,S1Color,S2Color,S3Color, 0, DayBarNumber-46 );
   double D3R2=iCustom( NULL, PERIOD_H1, "FXI Weekly Pivots" , maxWeeks,weeklyNotDaily,showPivotLines,showPivotLabels,showPivotIcons,pivotThickness,pivotFontSize,pivotFont,R3Color,R2Color,R1Color,PColor,S1Color,S2Color,S3Color, 1, DayBarNumber-46 );
   double D3R1=iCustom( NULL, PERIOD_H1, "FXI Weekly Pivots" , maxWeeks,weeklyNotDaily,showPivotLines,showPivotLabels,showPivotIcons,pivotThickness,pivotFontSize,pivotFont,R3Color,R2Color,R1Color,PColor,S1Color,S2Color,S3Color, 2, DayBarNumber-46 );
   double D3P =iCustom( NULL, PERIOD_H1, "FXI Weekly Pivots" , maxWeeks,weeklyNotDaily,showPivotLines,showPivotLabels,showPivotIcons,pivotThickness,pivotFontSize,pivotFont,R3Color,R2Color,R1Color,PColor,S1Color,S2Color,S3Color, 3, DayBarNumber-46 );
   double D3S1=iCustom( NULL, PERIOD_H1, "FXI Weekly Pivots" , maxWeeks,weeklyNotDaily,showPivotLines,showPivotLabels,showPivotIcons,pivotThickness,pivotFontSize,pivotFont,R3Color,R2Color,R1Color,PColor,S1Color,S2Color,S3Color, 4, DayBarNumber-46 );
   double D3S2=iCustom( NULL, PERIOD_H1, "FXI Weekly Pivots" , maxWeeks,weeklyNotDaily,showPivotLines,showPivotLabels,showPivotIcons,pivotThickness,pivotFontSize,pivotFont,R3Color,R2Color,R1Color,PColor,S1Color,S2Color,S3Color, 5, DayBarNumber-46 );
   double D3S3=iCustom( NULL, PERIOD_H1, "FXI Weekly Pivots" , maxWeeks,weeklyNotDaily,showPivotLines,showPivotLabels,showPivotIcons,pivotThickness,pivotFontSize,pivotFont,R3Color,R2Color,R1Color,PColor,S1Color,S2Color,S3Color, 6, DayBarNumber-46 );
Print( D1R3," - ",D1R2," - ",D1R1," - ",D1P," - ",D1S1," - ",D1S2," - ",D1S3 );

 
But , These lines give me a wrong Values 
2015.01.11 12:03:18.760 MarketInfo EURUSD,H1: 2147483647.0 - 2147483647.0 - 2147483647.0 - 2147483647.0 - 2147483647.0 - 2147483647.0 - 2147483647.0

I Think This Problem Is in The Shift Value 

What Do you Think The problem is ?

Thanks For Your Help. 

 
yassin.mokni:
Hi Guys 

I want to Get The previous Days values of a Pivot points indicator .

I Use The iCustom() To Do That


 
But , These lines give me a wrong Values 

I Think This Problem Is in The Shift Value 

What Do you Think The problem is ?

Thanks For Your Help. 

There is no problem. This value 2147483647 is EMPTY_VALUE, it means the indicator is not drawing anything for this bar.
Other constants - MQL4 Documentation
  • docs.mql4.com
Other constants - MQL4 Documentation
 
angevoyageur:
There is no problem. This value 2147483647 is EMPTY_VALUE, it means the indicator is not drawing anything for this bar.

Ok , How Can I  get these 3 days values  , like in the picture : 

 

 
yassin.mokni:

Ok , How Can I  get these 3 days values  , like in the picture : 

 

It should be

DayBarNumber+23 
 
angevoyageur:

It should be

Yes you right Mr.Alain , it's a stupid mistake 
I Change The DayBarNumber By this Function 
uint getDayShift(const uint dayNumder)
{
   uint currentDaysShift = 0;
   for(int i = 0; i < Bars(_Symbol, PERIOD_H1) - 1; i++)
   {
      if(TimeDay(Time[i]) != TimeDay(Time[i+1]))
      {
         currentDaysShift++;
         if(currentDaysShift == dayNumder+1)
         {
            return i;
         }   
      }
   }
   return 0;
}