Error in iHighest and Lowest Function Output

 

hi dear Friends

I wrote a function to find Fibo Ratio for Price in Range of previous Candles 120 and use these functions for some Share in UK , US Market

but it show false result.

please help me to solve my errors 


int fibHigh = iHighest(NULL,0,MODE_HIGH,120,2);

   int fibLow  = iLowest(NULL,0,MODE_LOW,120,2);

////     

    datetime highTime = Time[fibHigh];

    datetime lowTime  = Time[fibLow];

    double kp=MathAbs(vAsk/(fibHigh-fibLow+0.0001));

    Print(symbolName," ","  Highest :",DoubleToString( fibHigh,5)," Lowest ",DoubleToString( fibLow,5)," Price : ",DoubleToStr(vAsk ,2), "   Kp  = ",DoubleToStr(kp,2));

   

output windows Result

2020.11.30 ........ UK100   Highest :2.00000 Lowest 92.00000 Price : 6392.10   Kp  = 71.02


but UK100 lowest and highest value should be more than 6000 .


thank you for help .


Documentation on MQL5: Constants, Enumerations and Structures / Named Constants / Predefined Macro Substitutions
Documentation on MQL5: Constants, Enumerations and Structures / Named Constants / Predefined Macro Substitutions
  • www.mql5.com
//| Expert initialization function                                   | //| Expert deinitialization function                                 | //| Expert tick function                                             | //| test1                                                            |...
 
Trader98:

hi dear Friends

I wrote a function to find Fibo Ratio for Price in Range of previous Candles 120 and use these functions for some Share in UK , US Market

but it show false result.

please help me to solve my errors 



iHighest and iLowest return the index of the bar not the high or low price, hence the int declaration

https://www.mql5.com/en/docs/series

Documentation on MQL5: Timeseries and Indicators Access
Documentation on MQL5: Timeseries and Indicators Access
  • www.mql5.com
These are functions for working with timeseries and indicators. A timeseries differs from the usual data array by its reverse ordering - elements of timeseries are indexed from the end of an array to its begin (from the most recent data to the oldest ones). To copy the time-series values and indicator data, it's recommended to use dynamic...
 
Paul Anscombe:

iHighest and iLowest return the index of the bar not the high or low price, hence the int declaration

https://www.mql5.com/en/docs/series

oh my god.

alright. you are right.

thank you dear Paul

god bless you 

 
Paul Anscombe:

iHighest and iLowest return the index of the bar not the high or low price, hence the int declaration

https://www.mql5.com/en/docs/series

how can get highest and lowest using ilowest and highest ?

 
  1. Why did you post your MT4 question in the MT5 General section instead of the MQL4 section, (bottom of the Root page)?
              General rules and best pratices of the Forum. - General - MQL5 programming forum?
    Next time post in the correct place. The moderators will likely move this thread there soon.

  2. Please edit your (original) post and use the CODE button (Alt-S)! (For large amounts of code, attach it.)
              General rules and best pratices of the Forum. - General - MQL5 programming forum 2019.05.06
              Messages Editor

  3. Trader98: how can get highest and lowest using ilowest and highest ?

    How did you get the time? Perhaps you should read the manual. Predefined Variables - MQL4 Reference
       How To Ask Questions The Smart Way. 2004
          How To Interpret Answers.
             RTFM and STFW: How To Tell You've Seriously Screwed Up.

 
Trader98:

how can get highest and lowest using ilowest and highest ?

with iHighest and iLowest u will get the IndexNumber take this IndexNumber and implement it iHigh and iLow they will return the value to you hope this helps