High & Low specific period

 

Hi every one

what's problem on following cod for finding pervious day high?!! 

double High = NormalizeDouble(iHigh(_Symbol,PERIOD_D1,1)+(percent*Bid),Digits);         //prev Day High

its work properly on tester but in live chart it tack 2 day before high !!

note : on opening stocks market. 

please help me if any one know that solution.

tanks  

 
Is it MT4 or MT5?

If MT4 there will be very frequently these kind of problems if history not synchronized.

It's always suggested to work on MT5 when trying accessing multiple timeframes and use CopyRates for copying rates prices.
 
Fabio Cavalloni #:
Is it MT4 or MT5?

If MT4 there will be very frequently these kind of problems if history not synchronized.

It's always suggested to work on MT5 when trying accessing multiple timeframes and use CopyRates for copying rates prices.

Its MT4.

ill try it on live chart

thanks for reply

 
mohamad rahchemandi: what's problem on following cod for finding pervious day high?!! 

double High = NormalizeDouble(iHigh(_Symbol,PERIOD_D1,1)+(percent*Bid),Digits);         //prev Day High

On MT4: Unless the current chart is that specific symbol(s)/TF(s) referenced, you must handle 4066/4073 errors before accessing candle/indicator values.
          Download history in MQL4 EA - Forex Calendar - MQL4 programming forum - Page 3 #26.4 (2019)

On MT5: Unless the current chart is that specific pair/TF, you must synchronize the terminal Data from the Server before accessing candle/indicator values.
          Error 4806 while using CopyBuffer() - Expert Advisors and Automated Trading - MQL5 programming forum #10 (2020)
          Is it mystical?! It is! - Withdraw - Technical Indicators - MQL5 programming forum (2019)
          Timeseries and Indicators Access / Data Access - Reference on algorithmic/automated trading language for MetaTrader 5
          Synchronize Server Data with Terminal Data - Symbols - General - MQL5 programming forum #2 (2018)
          SymbolInfoInteger doesn't work - Symbols - General - MQL5 programming forum (2019)

 
William Roeder #:

On MT4: Unless the current chart is that specific symbol(s)/TF(s) referenced, you must handle 4066/4073 errors before accessing candle/indicator values.
          Download history in MQL4 EA - Forex Calendar - MQL4 programming forum - Page 3 #26.4 (2019)

On MT5: Unless the current chart is that specific pair/TF, you must synchronize the terminal Data from the Server before accessing candle/indicator values.
          Error 4806 while using CopyBuffer() - Expert Advisors and Automated Trading - MQL5 programming forum #10 (2020)
          Is it mystical?! It is! - Withdraw - Technical Indicators - MQL5 programming forum (2019)
          Timeseries and Indicators Access / Data Access - Reference on algorithmic/automated trading language for MetaTrader 5
          Synchronize Server Data with Terminal Data - Symbols - General - MQL5 programming forum #2 (2018)
          SymbolInfoInteger doesn't work - Symbols - General - MQL5 programming forum (2019)

its fine on tester but i use it on Apple on opening market it will return 2  pervious days high !

note : i use it just on first tick of opening market

 
Fabio Cavalloni #:
Is it MT4 or MT5?

If MT4 there will be very frequently these kind of problems if history not synchronized.

It's always suggested to work on MT5 when trying accessing multiple timeframes and use CopyRates for copying rates prices.

Hi 

CopyRates its work properly and problem solved 

thanks  Fabio Cavalloni and others for helping

Good Luks.

Reason: