Download MetaTrader 5

iHighest / iLowest Question

To add comments, please log in or register
Do you know C++? MQL5 has much in common with it. Just try it yourself!
Paul
526
Paul 2014.01.16 13:36 
        double Hxval=High[iHighest(NULL,0,MODE_HIGH,14,0)];
        double Lxval=Low[iLowest(NULL,0,MODE_LOW,14,0)];
       
       
        double AVGX=(Hxval+Lxval)/2; 



  {
   ObjectDelete("UpSymbolAz"); ObjectDelete("DnSymbolAz"); WindowRedraw();
   

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

   for(i=0;i<CntBarsz-1;i++)                       
     {                                           
      if (Low[i]< Minimumz)                       
         {Minimumz=Low[i]; nz = i;  Alert("Low[i]= ",Low[i]);       
     
ObjectCreate("UpSymbolAz", OBJ_ARROW, 0, lowtimez,Minimumz);         
ObjectSet("UpSymbolAz", OBJPROP_ARROWCODE, SYMBOL_ARROWUP);
ObjectSet("UpSymbolAz", OBJPROP_COLOR,White);
                 
      }
      
      
        {                  
         if (High[i]> Maximumz)                     
         {Maximumz=High[i]; mz = i;   Alert("High[i]= ",High[i]);          
         
      
ObjectCreate("DnSymbolAz", OBJ_ARROW, 0, maxtimez,Maximumz);                  
ObjectSet("DnSymbolAz", OBJPROP_ARROWCODE, SYMBOL_ARROWDOWN);
ObjectSet("DnSymbolAz", OBJPROP_COLOR,Yellow);        
         
     } } }

If I can count bars backwards to find the period which has the Highest or Lowest Open value. How can I find the value of a Moving Average at that point (period)? Do I need to create an array? The values of a MA are the current candle (period).

whroeder1
14470
whroeder1 2014.01.16 14:27  
Yellowbeard: If I can count bars backwards to find the period which has the Highest or Lowest Open value. How can I find the value of a Moving Average at that point (period)?
  1. Can you count backwards ..?
  2. Once you find the bar shift pass it to iMA()
Paul
526
Paul 2014.01.16 18:20  
WHRoeder:
  1. Can you count backwards ..?
  2. Once you find the bar shift pass it to iMA()



Can't predict future. Can only go backwards.
whroeder1
14470
whroeder1 2014.01.16 18:32  
You said "If I can count bars backwards." That left some doubt.
To add comments, please log in or register