Make the handler in Oncalculate, not in OnInit.
Thanks, I have done that but it seems not to be the cause.
Study this Documentation, after that you will know that when requesting data from someone else's timeframe, you should always check the error code (just in case: suddenly the timeseries has not been built yet).
Study this Documentation, after that you will know that when requesting data from someone else's timeframe, you should always check the error code (just in case: suddenly the timeseries has not been built yet).
I do not have telepathic abilities - insert your code correctly and I can help you.
You agree to website policy and terms of use
Hello,
How do you get a value from iBarShift() function for a timeframe other than the current at the start of the terminal (that is the first run)? It is always returning -1(or no bar) no matter what I have tried. I am creating a Multi-time Frame indicator that loops from the start date to the present, analyzing for the said pattern.
if the iBarShift() is called for the current timeframe, you get a value.
meaning, the user would have to change chart, or something that would re-initialize the chart for the indicator buffers to be plotted. Thanks.
Note: I wrote a test program, outputting the values of iBarShift() inside the onCalculate() function for both the current timeframe and a TF different from the current.
***
Test Code: