[SOLVED] Indicators are not properly instantiated when called/created from an Indicator of different working time-frame. - page 2
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
You are repeating "failing to instantiate", but that's not exact. The indicator is instantiated in all cases.
The problem is the data are not available synchronously, you have to deal with it. It's NOT an MT5 bug, it's a FEATURE.
I propose to stop the discussion and wait SD answer.
Perhaps I didn't properly articulate that no matter how many loops and waiting, you will not be able to access the indicator data (of different TF) until after the first pass of (*edit) OnCalculate();
I'm perfectly willing to accept that I may be wrong, which is why I have a $10 bounty if you can demonstrate otherwise. Please... prove me wrong. I need a workaround for this stupid bug, sorry, I mean "feature".
Perhaps I didn't properly articulate that no matter how many loops and waiting, you will not be able to access the indicator data (of different TF) until after the first pass of (*edit) OnCalculate();
I'm perfectly willing to accept that I may be wrong, which is why I have a $10 bounty if you can demonstrate otherwise. Please... prove me wrong. I need a workaround for this stupid bug, sorry, I mean "feature".
Why do you need it on the first "pass" ? If needed data are not available, wait until they are, that's all.
Because I am developing an indicator that requires the access of data from the same indicator (same symbol) on a different time-frame. Since it will not process until after the second tick, this means the indicator will not work offline, and only works when the second tick comes in.
Why should we have to compromise because of this bug? What's in it for you to so furiously defend it?
Because I am developing an indicator that requires the access of data from the same indicator (same symbol) on a different time-frame. Since it will not process until after the second tick, this means the indicator will not work offline, and only works when the second tick comes in.
Why should we have to compromise because of this bug? What's in it for you to so furiously defend it?
???
I don't defend anything, and certainly not "furiously". Please stay cool.
???
I don't defend anything, and certainly not "furiously". Please stay cool.
Forum on trading, automated trading systems and testing trading strategies
[MQL5 BUG] Indicators are not properly instantiated when called/created from an Indicator of different working time-frame.
Alain Verleyen, 2017.01.31 12:46
Ok you don't believe me, that's your right, but you are wrong
I can only suggest you to write to ServiceDesk, and please report their answer here.
OK.
I posted this job in case anyone is interested in taking a crack at it.
https://www.mql5.com/en/job/57516
This means that if the data is immediately available to a script or EA then it would be equally available to Indicator (as in this is not a data availability issue). The indicator is simply failing to instantiate before the second pass of OnCalculate() (aka the first tick)
You understand the word "availability" too literally. While some data can exist in the terminal memory, the terminal itself may contain some synchronization logic which block updates for any timeframes while underlying data is checked for one (probably another) timeframe. Or they can block data requests from an indicator until it finishes its own creation (please, remember that indicators are managed by so called handles, whereas experts and scripts do not) and this is logical to me. These are just guesses, which I made from the point of view of MQ developers. You can ask them directly via th service desk.
Your job is impossible to accomplish due to the point 3:
3. Must access buffer on Initialization
This is just against the terminal architecture and documentation:
You can't refer to the indicator data right after it has been created, because calculation of indicator values requires some time
Also please read about CopyBuffer function:
Note
When requesting data from the indicator, if requested timeseries are not yet built or they need to be downloaded from the server, the function will immediately return -1, but the process of downloading/building will be initiated.
When requesting data from an Expert Advisor or script, downloading from the server will be initiated, if the terminal does not have these data locally, or building of a required timeseries will start, if data can be built from the local history but they are not ready yet. The function will return the amount of data that will be ready by the moment of timeout expiration.
So, experts and scripts are processed synchronously until a predefined timeout, but indicators - asynchronously.
As for your specific task, it can be easily done in other way. You're not the first who builds an indicator on indicator and wants it to work offline. Use a timer.
Tried it. Didn't work.
Post more specific question with a sample code. It may be buggy. The approach works for me.