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)
Based on my analysis it seems to be that EasyLanguage's MaxBarsBack was for the purpose of saving memory, because it was created in the 1980's for the original version of EasyLanguage (TradeStation and SuperCharts), and computers didn't have nearly as much memory or speed as they do nowadays. But now that we have plenty of memory it's not needed anymore. Although we could still use this, but we surely don't need to limit our bars back to anything less than 256 or so -- that's the number that Ninja Trader uses for their software (although it's optional to use it -- you don't have to use it if you don't want to). And, it seems like it's also being used as an initial bars buffer, so that your code doesn't reference bars back farther than when the data starts. But that's lame because your code should simply check to make sure you have enough initial bars, IOW check that "CurrentBar" is at least the amount of bars you need to reference back in time. But the original EasyLanguage programmers decided to do this for you so you don't have to write that one extra line in your code. If you set the option to automatically detect what MaxBarsBack number your code needs, that works fine, but it has to run your code TWICE -- the first time to find the MaxBarsBack number that your code needs, and then the second time to actually run your code. So, that makes it load a little bit slower, although modern computers are so blazingly fast you probably won't notice. But even so, you may decide to set it to a high number like 256 or more, but you can't, because it's also being used for the initial bars buffer, so if you set it to a large number then you need that many more bars (data) before the code even starts running. So this is a bit of a PITA LOL and IMO shouldn't be used anymore.
So, it's basically useless now. In the case of MultiCharts, whoever programmed it didn't realize this. Ninja Trader does everything the correct way -- you write your code to handle your own initial bars buffer, and they allow you to use a maximum bars lookback setting if you want to in order to save memory, but you don't have to if you don't think you need it. That's the perfect way to do things. Unfortunately, it seems that the MultiCharts programmers just copied all of the old EasyLanguage code without modifying this for modern computers and to get rid of the MaxBarsBack thing. But at least it's still functional even if it's a useless annoyance. But, unfortunately, the MultiCharts.NET version ALSO STILL uses MaxBarsBack, which is obviously lame. We can easily guess why -- because they converted the EasyLanguage code to C# to make their .NET version, but they didn't modify this part of the code, which they ideally should have.
What I do with it is this: I set it to auto detect, then see what it came up with for a number by looking at the beginning of the data stream, then I add some more to that number just in case my code ever needs more, and I set it to that specific number (not auto detect), so that it loads slightly faster from then on.
This is super helpful info, thanks! I'm guessing the MC developers may have left MaxBarsBack just for compatibility, for purposes of copying EasyLanguage code. I am just getting into PowerLanguage as we plan to migrate to MultiCharts, hopefully by the end of the year, and at least one of my strategies uses this function.
Do you have a reference regarding this? I would like to dig deeper into this.