Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
Hey there :-)
I have a question about using Multi-Timeframes in NT8. I've tried to use in my indicator three different Timeframes, 1. my actual Chart-Timeframe, 2. Range-10 and 3. Range-30. The first line after OnBarUpdate() is
Error calling 'OnBarUpdate' method at Bar 20: You are accessing an index with an invalid value that is outside the expected range. E.g. Access a row with [BarsAgo] with a value of 5 if there are only 4 candles in the chart.
I know, what this error means and I have tried some options to fix it, for example I have changed RequiredBarsToPlotfrom 20 to 256 and changes the OR-Operator between CurrentBars to AND. That fixed the problem, if the Bar-Value on my Chart is between the two additional timeframes. But if I want to change my Chart-Timeframe to lower Values, for example to Range 4, Tick or anything else, I got this error immediatly. I have marked the whole Indicator-Logic as a comment, to rule out other sources of error.
I think that the spread between the lowest and the highest Timeframe could be too big, because for an 30-Range-Bar you need hundreds of Ticks or 4-Range-Bars and this could be the problem, when data is loading. Am I right with this assumption?
Is there a way to work around the problem? The same problem should arise, if someone calculates Res/Sup-Lines on Daily-Timeframe, but trades it in 10min or Tick.
Ani suggestions?
Can you help answer these questions from other members on NexusFi?
With indicators and strategies that utilize multiple data series you typically need to take advantage of the BarsInProgress property. In this case you might be able to solve the problem by only worrying about when your time series bar is updated.
BarsInProgress unfortunately doesn’t fix the problem, I’ve already tried this... Before I have written down my post here, I’ve searched for solutions in the internet and of course also in the NT-Helpfiles, because I don’t like ask other people and waste their time, because I’m too lazy to search for myself at first :-) Unfortunately I have searched without getting results. The problem often occurs, if people try to access f.e. Close[30] and getting the same error, because BarsRequiredToPlot is 20 by default.
You can correct me if I’m wrong, but BarsInProgress is an EventMarker, which returns the index value from that timeframe, which was actually updated, to split timeframe-based operations in separate blocks and avoid polling the whole indicator logic.
The likely problem here is that you are not taking into account which of the bar series is currently being processed. Depending on what bars are processed you need to adapt the code.
It is likely that there is a simple logical error in your code. If you wish to have it fixed, you need to disclose the code allowing us to look for the bug. In case you do not wish to disclose it in public, you may also contact me via direct message, and I will have a look.
Hi Fat Tails, of course it will be a simple error, because a big error would be easy to find :-D
I will post the code-fragment tomorrow, so you can have a look at it.