iHighest ..and iHigh have problem?

To add comments, please log in or register
abd-
46
abd-  

hi ..am traying to find the highest high among number of candles using the function  iHighest and iHigh

first i used a loope

for(int i=shif2;i<=(shif);i++)

and want to find the Highest High within  or between  shif and shif2 

using the code 

double Highesthigh  = iHigh(NULL,0,iHighest(NULL, 0,MODE_HIGH,shif2, shif)); 

but i got  the highest high for a candle outside the loop 

as in this pic


IHIGHT PROBLEM


any help please ? 

Icham Aidibe
11675
Icham Aidibe  
abd-:

hi ..am traying to find the highest high among number of candles using the function  iHighest and iHigh

first i used a loope

and want to find the Highest High within  or between  shif and shif2 

using the code 

but i got  the highest high for a candle outside the loop 

as in this pic



any help please ? 

double HighestHigh = iHigh(_Symbol,PERIOD_CURRENT,iHighest(_Symbol,PERIOD_CURRENT,MODE_HIGH,shif,shift2));

  • numberofcandle = look back for "shif" candle 
  • start "shift2" candle away
  • iHighest returns the index
  • iHigh reads the index
abd-
46
abd-  
Icham Aidibe:

  • numberofcandle = look back for "shif" candle 
  • start "shift2" candle away
  • iHighest returns the index
  • iHigh reads the index
Icham Aidibe ....Thanks for you .....i will tray that ..appropriate your help  
Icham Aidibe
11675
Icham Aidibe  
abd-:
Icham Aidibe ....Thanks for you .....will tray that ..appropriate your help  

You're welcome. Let me know if ain't the right code.

abd-
46
abd-  
Icham Aidibe:

You're welcome. Let me know if ain't the right code.

hi my friend

it's the same problem 

you can tray it  :draw a trendline on EURUSD CHART  H4 and name it  Line1  and put the first spot of the trend line on the date 

2018.07.12  00:00 ...and the second spot on the date 2018.07.12  20:00 

then use this code ...for me the code give the high price of the date  2018.07.11 16:00    (1.17573)  which is outside the loop...

//+------------------------------------------------------------------+
//|                              test.mq4 |
//|                      Copyright © 2011, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright ""
#property link      ""

#property indicator_chart_window

extern datetime StartTime=D'2011.01.1 00:00';
extern datetime EndTime=D'2011.01.2 00:00';
extern bool UseAutoDateTime=true;
extern string LineName="Line1";


double point;
int init() {
if(Digits<4){point=0.01;}
 else{point=0.0001;}
 return(0);
   }
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+

//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
  
    return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+

int start()

  {
  if(UseAutoDateTime){
  double a=ObjectGet(LineName,OBJPROP_TIME1);
  double b=ObjectGet(LineName,OBJPROP_TIME2);
  StartTime=MathMin(a,b);
  EndTime=MathMax(a,b);
  }
  
 {

     int shif=iBarShift(Symbol(),0,StartTime,false);
     int shif2=iBarShift(Symbol(),0,EndTime,false);
    }

for(int i=shif2;i<=(shif);i++)

 double HighestHigh = iHigh(_Symbol,PERIOD_CURRENT,iHighest(_Symbol,PERIOD_CURRENT,MODE_HIGH,shif,(shif2)));
 
      ObjectCreate("HighestHigh", OBJ_LABEL, 0, 0, 0);
      ObjectSetText("HighestHigh",DoubleToStr(HighestHigh  ,6) ,14, "Arial", Magenta);
      ObjectSet("HighestHigh", OBJPROP_XDISTANCE, 20);
      ObjectSet("HighestHigh", OBJPROP_YDISTANCE, 270);
      ObjectSet("HighestHigh", OBJPROP_CORNER, 1);

   return(0);
  }


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


Keith Watford
Moderator
20339
Keith Watford  
for(int i=shif2;i<=(shif);i++)

What is this supposed to do?


for your calculation

double HighestHigh = iHigh(_Symbol,PERIOD_CURRENT,iHighest(_Symbol,PERIOD_CURRENT,MODE_HIGH,shif-shif2+1,shif2));
abd-
46
abd-  
Keith Watford:

What is this supposed to do?


for your calculation

keith watford ...

thanks for you, your code works for me ....am not a programmer but  want to learn some simple codes that help me in my indicators

thank for you again  keith watford and for Icham Aidibe 

To add comments, please log in or register