NexusFi: Find Your Edge


Home Menu

 





The purpose of MaxBarsBack is outdated now


Discussion in EasyLanguage Programming

Updated
    1. trending_up 5,242 views
    2. thumb_up 1 thanks given
    3. group 2 followers
    1. forum 1 posts
    2. attach_file 0 attachments




 
Search this Thread

The purpose of MaxBarsBack is outdated now

  #1 (permalink)
thoughtful
Klamath Falls OR
 
Posts: 60 since Apr 2020
Thanks Given: 21
Thanks Received: 80

In case anyone (newbies) was wondering:

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.

Reply With Quote
Thanked by:

Can you help answer these questions
from other members on NexusFi?
Online prop firm The Funded Trader (TFT) going under?
Traders Hideout
Deepmoney LLM
Elite Quantitative GenAI/LLM
NexusFi Journal Challenge - April 2024
Feedback and Announcements
Better Renko Gaps
The Elite Circle
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
 
  #2 (permalink)
 
vmodus's Avatar
 vmodus 
Somewhere, Delaware, USA
 
Experience: Intermediate
Platform: MultiCharts
Broker: Barchart.com
Trading: Everything, it all tastes like chicken
Posts: 1,271 since Feb 2017
Thanks Given: 2,958
Thanks Received: 2,853


thoughtful View Post
In case anyone (newbies) was wondering:

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.

~vmodus

Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote




Last Updated on June 24, 2020


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts