Download MetaTrader 5

candle highest time value

To add comments, please log in or register
hadher ramadhan
284
hadher ramadhan  
Please tell me how to get the time of the highest 5 minute TF candle during the last day only?? thank you for assist .. 
Alain Verleyen
Moderator
32809
Alain Verleyen  
hadher ramadhan:
Please tell me how to get the time of the highest 5 minute TF candle during the last day only?? thank you for assist .. 
What have you tried ?
hadher ramadhan
284
hadher ramadhan  
Alain Verleyen:
What have you tried ?

//--------------------------top1--------------------------------------------
int per=5;
  double top1=0.0;  
   int top1_index=iHighest(NULL,per,MODE_HIGH,50,2); 
   if(top1_index!=-1) top1=NormalizeDouble(iHigh(NULL,1440,1),Digits);
    else PrintFormat("Error in call iHighest. Error code=%d",GetLastError());
   datetime T1=iTime(NULL,per,top1_index);  
  
//---------------------------bot1--------------------------------------------
double bot1=0.0;  
   int bot1_index=iLowest(NULL,per,MODE_HIGH,50,2); 
   if(bot1_index!=-1) bot1=NormalizeDouble(iLow(NULL,1440,1),Digits);
    else PrintFormat("Error in call iHighest. Error code=%d",GetLastError());
   datetime T2=iTime(NULL,per,bot1_index);
//--------------------------fib point-----------------------------------------
i found the top and  button of the last day but i cant find them times!!how to search the i Highest  from the end of the last day to the start ?? 
Carl Schreiber
7224
Carl Schreiber  
What do you get, and what do you expect to get? Any Error?
hadher ramadhan
284
hadher ramadhan  
Carl Schreiber:
What do you get, and what do you expect to get? Any Error?

i found top and bottun see the attached imag
Files:
Untitled.png 190 kb
Carl Schreiber
7224
Carl Schreiber  
//--------------------------top1--------------------------------------------
int per=5;
  double top1=0.0;  
   int top1_index=iHighest(NULL,per,MODE_HIGH,50,2); 
   if(top1_index!=-1) top1=NormalizeDouble(iHigh(NULL,1440,1),Digits);
    else PrintFormat("Error in call iHighest. Error code=%d",GetLastError());
   datetime T1=iTime(NULL,per,top1_index);  
  
//---------------------------bot1--------------------------------------------
double bot1=0.0;  
   int bot1_index=iLowest(NULL,per,MODE_HIGH,50,2); 
   if(bot1_index!=-1) bot1=NormalizeDouble(iLow(NULL,1440,1),Digits);
    else PrintFormat("Error in call iHighest. Error code=%d",GetLastError());
   datetime T2=iTime(NULL,per,bot1_index);
//--------------------------fib point-----------------------------------------
  1. your png shows high and low of te previous day (..,1440,1)
  2. what is the value of T1 and T2?
hadher ramadhan
284
hadher ramadhan  
Carl Schreiber:
  1. your png shows high and low of te previous day (..,1440,1)
  2. what is the value of T1 and T2?

that is my question how to get the time of the 5 minuit candles which is the highest or lowest on the last day only iwant to draw some triangls on it thank for replay
Carl Schreiber
7224
Carl Schreiber  
hadher ramadhan:

that is my question how to get the time of the 5 minuit candles which is the highest or lowest on the last day only iwant to draw some triangls on it thank for replay
int iM5prvDayBegin =  iBarShift( NULL,PERIOD_M5,iTime(Null,PERIOD_D1,1)),     // first Bar m5
    iM5prvDayEnd   =  iBarShift( NULL,PERIOD_M5,iTime(Null,PERIOD_D1,0)) -1;  // last Bar m5

Now use iHighest and iLowest between those to indices.

whroeder1
15706
whroeder1  
hadher ramadhan: how to get the time of the 5 minuit candles which is the highest or lowest on the last day only
  1. Last day or current day? I assume last.
  2.    int top1_index=iHighest(NULL,per,MODE_HIGH,50,2); 
    
    This has nothing to do with your question.
  3. top1=NormalizeDouble(iHigh(NULL,1440,1),Digits);
    Do NOT use NormalizeDouble, EVER. For ANY Reason. It's a kludge, don't use it. It's use is always wrong
    Totally unnecessary. Prices read are always normalized.
  4. Since you are not running on the D1 chart, you must make sure the D1 is up to date. See Download history in MQL4 EA - MQL4 and MetaTrader 4 - MQL4 programming forum Then you can get the prices from the D1 chart (iHigh)
  5. But again this has nothing to do with your question.
  6. But you don't want that, you want the Time of the M5 candle (or its shift.) If the chart isn't the M5 #4 applies and use iHigh/iTime instead.
  7. Just use the time functions I posted yesterday.
    #define COUNT uint
    INDEX iLOD  = iBarShift(_Symbol, PERIOD_CURRENT, date() ) - 1; // Last bar yesterday
    INDEX iBOD  = iYesterday();                                    // First bar yesterday
    COUNT nBars = iBOD - iLOD + 1;
    INDEX iHOD = iHighest(_Symbol, PERIOD_CURRENT, MODE_HIGH, nBars, iLOD);
    
    #define PRICE double
    string price_to_string(PRICE p){ return DoubleToString(p, _Digits); }
    PrintFormat("Yesterday's high of the day was %s at %s", price_to_string(High[iHOD]), (string)Time[iHOD]);
Draw rectangle around range of bars by hours
Draw rectangle around range of bars by hours
  • 2017.05.15
  • www.mql5.com
Hello This ought to be easy but I'm finding it fiendish. I want to draw a rectangle around my non-trading hours...
hadher ramadhan
284
hadher ramadhan  
whroeder1:
  1. Last day or current day? I assume last.
  2. This has nothing to do with your question.
  3. Totally unnecessary. Prices read are always normalized.
  4. Since you are not running on the D1 chart, you must make sure the D1 is up to date. See Download history in MQL4 EA - MQL4 and MetaTrader 4 - MQL4 programming forum Then you can get the prices from the D1 chart (iHigh)
  5. But again this has nothing to do with your question.
  6. But you don't want that, you want the Time of the M5 candle (or its shift.) If the chart isn't the M5 #4 applies and use iHigh/iTime instead.
  7. Just use the time functions I posted yesterday.

wawo  whroeder1    many many thanks it is really a great advise and a new knowledge for me  i will read all the links you post above
hadher ramadhan
284
hadher ramadhan  
Carl Schreiber:

Now use iHighest and iLowest between those to indices.


thank you very very match sir that is exactly what i m looking for  !!!


I hop if there are a main topic for questions and answers which did not deserve to be a separate topic or stupid questions like mine 

To add comments, please log in or register