Pivot Help Please

 

Hi guys I hope someone  can help me I have gone code blind I think.

I am trying to set the Pivot from the previous bar not for any reason other than learning.

Now I know I have messed up some where but I can not seem to find where.

void BarData(){
 int BarHigh, BarLow, BarClose, BarOpen;
   
   double High[], Low[], Close[], Open[];
   
   ArraySetAsSeries(High,true);
   ArraySetAsSeries(Low,true);
   ArraySetAsSeries(Open,true);
   ArraySetAsSeries(Close,true);
   
   CopyHigh(_Symbol,_Period,0,2,High);
   CopyLow(_Symbol,_Period,0,2,Low);
   CopyOpen(_Symbol,_Period,0,1,Open);
   CopyClose(_Symbol,_Period,0,2,Close);
   
   BarHigh=ArrayMaximum(High,0,2);
   BarLow=ArrayMinimum(Low,0,2);
   BarClose=ArrayMinimum(Close,0,2);
   BarOpen=ArrayMaximum(Open,0,1);
  
   
   MqlRates PriceInformation[];
   
   ArraySetAsSeries(PriceInformation,true);
   
   int Data2=CopyRates(Symbol(),Period(),0,Bars(Symbol(),Period()),PriceInformation);
   
   double BarHighest= PriceInformation[BarHigh].high;
   double BarLowest= PriceInformation[BarLow].low;
   double BarCloser= PriceInformation[BarClose].close;
   double BarOpener= PriceInformation[BarOpen].open;
   
   double Pivot=NormalizeDouble(((BarHighest+BarLowest+BarCloser)/3),_Digits);
   
  Comment("Bar High : ",BarHighest, "\n","Bar Low : ",BarLowest, "\n","Bar Open : ",BarOpener, "\n","Bar Pivot : ",Pivot, "\n");
}
 
Richard Benson:

Hi guys I hope someone  can help me I have gone code blind I think.

I am trying to set the Pivot from the previous bar not for any reason other than learning.

Now I know I have messed up some where but I can not seem to find where.

you have not said what the problem is..

 
Paul Anscombe #:

you have not said what the problem is..


Very true,the problem is the pivot seems to be based off the current bar so is changing everytick where it should be off the previous bar
H + L + C/3