iHigh and iLow returns 0.0 [Solved] - page 3

 
It needs to be understood, the behavior is different from EAs to indicators.

While the function call in EAs may wait for new data to be made available by the terminal, the indicator is executed within the global thread allocated to the chart.

Any indicator blocking execution, will also prevent the terminal from being able to update. Although this should concern only the symbol of the chart, I haven't proofed, but can imagine, any updates your code is requesting from the terminal will be processed after your code has returned from execution back to the terminal.

To make sure the terminal allocates a thread for a symbol, you can load a very simple indicator, like MA or ATR with a period of 1. This will enable all relevant functions inside the terminal to make it load and update the symbols data.

This is how I do it inside my indicators, for EAs the story isn't too different, but since the EA may wait inside its execution, another approach can be composed.

 
Dominik Egert #:
To make sure the terminal allocates a thread for a symbol, you can load a very simple indicator, like MA or ATR with a period of 1. This will enable all relevant functions inside the terminal to make it load and update the symbols data.

This is how I do it inside my indicators, for EAs the story isn't too different, but since the EA may wait inside its execution, another approach can be composed.

I get how that would force the terminal to create a thread, but does that force or ensure that the timeseries data is valid?

EDIT: As mentioned by @Ferhut Mutlu mentioned the data isnt always valid even when a thread has been proved to be running.

Maybe both things need to be coded? ie the code in previous page, plus a simple atr with period 1 needs to be loaded to ensure both a thread is created, AND that OHLC prices are valid.

EDIT2: And as per the ops's scenario with multiple symbols, would he need to load a new indicator for each of the symbols he is using? or does loading 1, then force the terminal to refresh the available symbols, AND create threads for those symbols that dont have any?
 
Ferhat Mutlu #:
It does happen for ask and bid. Allso there is allso mind scratching thing. If you want to get the bid value of another symbol, you will not get that because you will be able to call data based on the current symbols tick. The way is prevent that to call data every X ms possible. That way atleast you will get different ticks based on the symbols. Not all symbols creating the tick at the same time. That is another issue of MT5 :) OnTick gets updated only based on the symbol you are in. OnTimer is the best for such cross pair tick data. Then you will get the most realistic data but again. Still reason is unknown for 0.0. Not an exact explanation

thanks.

 

I simply solved it temporaily  by NOT using iHigh or iLow

I am using

double Bidx = NormalizeDouble(SymbolInfoDouble(symbolsList[i],SYMBOL_BID),_Digits); // Get the Bid Price
and all is working fine.
 
Dark Ryd3r #:

I simply solved it temporaily  by NOT using iHigh or iLow

I am using

and all is working fine.

so you did the reporting like you did in the first page, and not getting those 0.0 values anymore?

 
Revo Trades #:

so you did the reporting like you did in the first page, and not getting those 0.0 values anymore?

Yes as I said temporarily fix using Bid price
But on IHigh I'm still getting 0.0
If that bug of Mt5 gets fixes I'll be very helpful
 
Arpit Tailang #:
Yes as I said temporarily fix using Bid price
But on IHigh I'm still getting 0.0
If that bug of Mt5 gets fixes I'll be very helpful

maybe the bug that has that affects the Ask/Bid, as @Ferhat Mutlu said, is a different bug that gives the 0.0 on the OCHL. But is good to know that Bid/Ask may not be affected as commonly as the other.

But i doubt that they will fix it any time soon, if ever, as it has been discussed over several years now.
 
Dark Ryd3r #:

I simply solved it temporaily  by NOT using iHigh or iLow

I am using

and all is working fine.

The reason you are not having 0.0 because you are calling that function on every tick that you attached on current chart.
Example if you want to get bid price of GBPUSD from the EURUSD Chart. You are executing the function once EURUSD Generates the tick. Then you don't know if there was a GBPUSD Tick missed. Try to use OnTimer function and see if 0.0's aren't there as well.


IF with bid it works properly and no 0.0's generated. Then try to use the same OnTimer miliseconds for the high and lows you are calling...

 
Dark Ryd3r:


Arpit Tailang #:



i have been searching for method to cover this bug for some time, but none of the gurus have given proof that their methods work, so I have always been uncertain who to believe but I have found this in the docs. I have been watching the print out data for almost 5 mins non stop, and see not even 1 line that has 0.0. I hope the doc page help you too. 

Vladimir Karputov #:



I do coding for both mt4 and mt5, and both indicators and eas. Please confirm that the example in the docs page below, at the bottom of the page will re-populate the OHCL data for current and past candles, for both ea's (in OnTick func) and indicator (in start() or OnTick()); coding AND for both MT4/5.



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

Documentation on MQL5: Timeseries and Indicators Access / CopyRates
Documentation on MQL5: Timeseries and Indicators Access / CopyRates
  • www.mql5.com
CopyRates - Timeseries and Indicators Access - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 
Revo Trades #:
Does this issue occur with Ask and Bid, also? Or only close, open, high, low? or just the ones with i prefix?

There is no Bid/Ask with MT5.

If you talk about SymbolInfoTick() which allow to get all data about the current tick for a symbol, I never noticed it, but I can't exclude it.

It mainly happens with "foreign" symbols (the ones which are not the chart one) when you request OHLCV data. It's NORMAL behaviour of MT5.

Revo Trades #:

please give search terms to use to find readings on 1) what prices this bug affects, and 2) proven methods that avoid or fix the bug.

I have idea for error correction, but at this stage is just a hypothesis. If i can see proofs of working fixes, then, I would not have to spend so much time testing my own code and hyposthese.
There is no bug at all. You are using a function (like CopyHigh() or iHigh(), etc...) and you need to check for errors, according to the documentation. If there is an mql error, deal with it. There is no general answer how to deal with it as it depends of the context.
Reason: