Download MetaTrader 5
To add comments, please log in or register
Articles can help you to solidify your knowledge. Come and read them!
Paul
529
Paul 2014.02.12 17:51 

If I can utilize iHighest to find the highest high within 100 periods, and then find the Open of that period / candle. Would I use the following code to find the Open of a specific period. For example, if the highest high was on the 70 the period, and I want to find the Open of the 73rd period.


Thanks


   CntBarsz = 100;


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



   double MXOp = iOpen(NULL,PERIOD_D1,maxshiftz);



   
   int XMXOp = (maxshiftz-3);  //  Third Candle from Highest


  

  // Would I use the following loop to count forwards and / or backwards to find the Open of the above Candle


 
      

  for(int i=1; i<=Bars; i++)

      {
    while(i == XMXOp)    
      {
        Alert("Open of ",XMXOp," Candle =  ",Open);
      }
      }
Simon Gniadkowski
Moderator
17962
Simon Gniadkowski 2014.02.12 18:03  
Yellowbeard:

If I can utilize iHighest to find the highest high within 100 periods, and then find the Open of that period / candle. Would I use the following code to find the Open of a specific period. For example, if the highest high was on the 70 the period, and I want to find the Open of the 73rd period.

Not quite . . .

int maxshiftz = iHighest(NULL, 0, MODE_OPEN, CntBarsz, 0);

. . . will find the highest open price because you used MODE_OPEN

If you want to find the Open of the 3 bar along from the highest . . .

int maxshiftz = iHighest(NULL, 0, MODE_HIGH, CntBarsz, 0);

int XMXOp = (maxshiftz-3);  //  Third Candle from Highest

Alert("Open of ",XMXOp," Candle =  ",Open[XMXOp]);
Paul
529
Paul 2014.02.12 18:34  
Thanks! I knew I had to be close. And yet, so far. Now, if I want to identify the period / candle, on a chart, with an arrow. Would I do so as such. This places an arrow on the same period as iHighest but at a different value. Not on the third candle from the highest.
  
        ObjectCreate("UpSymbolZz", OBJ_ARROW, 0, maxtimez,Open[XMXOp]);         
        ObjectSet("UpSymbolZz", OBJPROP_ARROWCODE, SYMBOL_ARROWUP);
        ObjectSet("UpSymbolZz", OBJPROP_COLOR,Aqua); 
Simon Gniadkowski
Moderator
17962
Simon Gniadkowski 2014.02.12 18:38  
Yellowbeard:
Thanks! I knew I had to be close. And yet, so far. Now, if I want to identify the period / candle, on a chart, with an arrow. Would I do so as such. This places an arrow on the same period as iHighest but at a different value. Not on the third candle from the highest.

You could do this . . .

        ObjectCreate("UpSymbolZz", OBJ_ARROW, 0,   Time[XMXOp],   Open[XMXOp]);         
        ObjectSet("UpSymbolZz", OBJPROP_ARROWCODE, SYMBOL_ARROWUP);
        ObjectSet("UpSymbolZz", OBJPROP_COLOR,Aqua);
Paul
529
Paul 2014.02.12 18:52  
RaptorUK:

You could do this . . .



Thanks again, RaptorUK, for all your help. That worked.


Yellowbeard

/
To add comments, please log in or register