trying to find date/time of a specific bar

 
    double LowestEMA = iMA(Symbol(), 0, 10, 0, MODE_EMA, PRICE_CLOSE,0);
            
       for (int i = 1; i < 30; i++)
        {
        double MovingAverage = iMA(Symbol(), 0, 10, 0, MODE_EMA, PRICE_CLOSE,i);
         {
         if(MovingAverage < LowestEMA)
          {
           LowestEMA = MovingAverage;  
          }
         } 
        }
        
       
        
      
      int        EMAlast30Period = 35; 
      int        EMA4HPeriod     = 10;   
      double     EMA4H[35];   
      double     LowestPrice;     
      int        LowestBar;
      datetime   LowestTime;
      
   
      for(int i = 0; i < EMAlast30Period; i++)  
       {   
        EMA4H[i] = iMA(NULL,PERIOD_H4, EMA4HPeriod, 0, MODE_EMA,PRICE_CLOSE, i);               
       }
       
        LowestPrice = iLow(NULL, PERIOD_H4,(ArrayMinimum(EMA4H,34, 1))); 
        
        LowestBar   = iBarShift(NULL, PERIOD_H4, (ArrayMinimum(EMA4H,34, 1)), 0);
                    
        LowestTime  = iTime(NULL, PERIOD_H4, LowestBar);
 

Hi All,

With help of this forum, slowly i m learning to code.

Now trying to find the time/date of LowestEMA or LowestPrice.

LowestEma is the lowest value of EMA and LowestPrice is the low price of the bar where LowestEMA happened.

But i have difficulties finding that bar to retrieve date/time through iBarShift and iTime and i think i m not using them correctly.

Thx for the help.

 
Amirio #: Now trying to find the time/date of LowestEMA or LowestPrice.

You don't need to “try.” When you find a lower value, save the value and the bar index.

 
         double LowestEMA = iMA(Symbol(), 0, 10, 0, MODE_EMA, PRICE_CLOSE,0);
         
         int LowestBar;
         
         datetime LowestTime;
         
            
       for (int i = 1; i < 30; i++)
        {
        double MovingAverage = iMA(Symbol(), 0, 10, 0, MODE_EMA, PRICE_CLOSE,i);
         {
         if(MovingAverage < LowestEMA)
          {
           LowestEMA = MovingAverage;  
           
           LowestBar = i;
           
           LowestTime = iTime(NULL, PERIOD_H4, LowestBar);
          }
         } 
        }
 

Thx William.

Got it!