iHighest Question

 
With this code I can find, that, the highest high, is on the 21st candle / daily period, ago. I can also find the, lowest low, on the 63rd candle, f
         int CntBarsz;   
         double Maximum, Minimum;                                   
         string text, UpSymbol="ñ", DnSymbol="ò", NtSymbol="«", ArrowUpD, ArrowUpE, ArrowUpF, ArrowUpG, ArrowUpH, ArrowUpI, ArrowUpJ, ArrowUpK, ArrowUpL;   



 
        CntBarsz = 70;
   
        int lowshiftz=iLowest(NULL,0,MODE_OPEN,CntBarsz,0);
        double Minimumz=Open[lowshiftz]; 
        datetime lowtimez=Time[lowshiftz];
   
   
        double AVGLBuffer=iMA(NULL,0,14,0,MODE_SMA,PRICE_MEDIAN,lowshiftz); 
 
                   
        int maxshiftz=iHighest(NULL,0,MODE_OPEN,CntBarsz,0);
        double Maximumz=Open[maxshiftz]; 
        datetime maxtimez=Time[maxshiftz];
   
   
        double AVGHBuffer=iMA(NULL,0,14,0,MODE_SMA,PRICE_MEDIAN,maxshiftz); 
        


        for(i=0;i<CntBarsz-1;i++) 
                     
        {                     
                     
        if (Low[i]< Minimumz)                       
         {Minimumz=Low[i]; nz = (lowshiftz+1);

        ObjectCreate("UpSymbolAz", OBJ_ARROW, 0, lowtimez,Minimumz);         
        ObjectSet("UpSymbolAz", OBJPROP_ARROWCODE, SYMBOL_ARROWUP);
        ObjectSet("UpSymbolAz", OBJPROP_COLOR,White);

        ObjectCreate("ArrowUpI",OBJ_HLINE,0,Time[0], Minimumz);  
        ObjectSet("ArrowUpI", OBJPROP_COLOR, Magenta);
        ObjectCreate("ArrowUpI",OBJ_HLINE,0,Time[0], Minimumz);  
        ObjectSet("ArrowUpI", OBJPROP_COLOR, Magenta);

        }
      
      

        {    


              
        if (High[i]> Maximumz)    
                 
       {

        Maximumz=High[i]; mz = (maxshiftz+1);


        ObjectCreate("DnSymbolAz", OBJ_ARROW, 0, maxtimez,Maximumz);                  
        ObjectSet("DnSymbolAz", OBJPROP_ARROWCODE, SYMBOL_ARROWDOWN);
        ObjectSet("DnSymbolAz", OBJPROP_COLOR,Yellow); 

        ObjectCreate("ArrowUpJ",OBJ_HLINE,0,Time[0], Maximumz);  
        ObjectSet("ArrowUpJ", OBJPROP_COLOR, Magenta);

        }


//----
   return(0);
  }
//+------------------------------------------------------------------+


//+------------------------------------------------------------------+


 // Write Procedure
    void Write(string LBL, double side, int pos_x, int pos_y, string text, int fontsize, string fontname, color Tcolor=CLR_NONE)
       {
       ObjectCreate(LBL, OBJ_LABEL, 0, 0, 0);
       ObjectSetText(LBL,text, fontsize, fontname, Tcolor);
       ObjectSet(LBL, OBJPROP_CORNER, side);
       ObjectSet(LBL, OBJPROP_XDISTANCE, pos_x);
       ObjectSet(LBL, OBJPROP_YDISTANCE, pos_y);
       }




rom the current. I'm trying to find the open and close of these candles. Have tried i(MA), but find it returns an average value that's not relative to anything I'm looking for. Perhaps I'm not using i(MA) correctly or it's being used at the wrong point / time in the code. Any help would be greatly appreciated. Or at least point me in the right direction. Thanks!
 
Yellowbeard:
With this code I can find, that, the highest high, is on the 21st candle / daily period, ago. I can also find the, lowest low, on the 63rd candle, f rom the current. I'm trying to find the open and close of these candles. Have tried i(MA), but find it returns an average value that's not relative to anything I'm looking for. Perhaps I'm not using i(MA) correctly or it's being used at the wrong point / time in the code. Any help would be greatly appreciated. Or at least point me in the right direction. Thanks!

 

These, with exception of iHighest and iLowest seem to be for the current candle's values. How would I find the Open and Close values of the Highest High, which is 23 periods ( Daily ) back, from the current period?


Thanks!

 
Yellowbeard:

These, with exception of iHighest and iLowest seem to be for the current candle's values. How would I find the Open and Close values of the Highest High, which is 23 periods ( Daily ) back, from the current period?

You use iHighest() to get the bar number of the highest high and then use iOpen and iClose with that bar number.
Reason: