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 folks,
For the life of me, I can NOT get the following strategy to place a trade. The code will verify, but when I open the strategy I get the error -tried to reference too many bars back- I then go to format strategy and change max bars back to 500... the strategy then runs but places no trades... please help.
if {Value2>Value3} {and} Value12 crosses over Value13 then
{ CB > 1 check used to avoid spurious cross confirmation at CB = 1 }
Buy ( "BBandLE" ) next bar at market ;
{if Value1 crosses under Value2 and Value11 crosses under Value12 then
Sell ( "CustomLX" ) next bar at market ;
}
Can you help answer these questions from other members on NexusFi?
it works fine for me. As you have blocked the short entries the strategy will only enter long, so you will only find one entry somewhere close to the beginning of the chart (max bars back setting plus a couple of bars).
Thank you so much! For some reason I am not understanding the max bars back deal or something because I can't get this thing to place a long trade at all... further assistance will be greatly appreciated.
The issue with max bars back is in fact quite simple once you got the hang out of it. You set how many bars you want be on the chart before the strategy can compute properly. It's a pain that you have to do it manually, but that's the way it is.
So when you have an average within your strategy that has a length of 80, you will have to set a Max Bars back value of at least 80. As an average with the length of 80 needs 80 bars to be calculated properly. Otherwise the strategy will trigger an error.
I suppose you didn't see any trades on your charts, because the Max Bars Back setting was very high and your amount of bars on the chart was very little (maybe even less than the Max Bars Back input). What interval and symbol did you use?
Everything you describe makes it sound like the function should actually be called minimum bars back. Would you agree that the practical use of "max bars back" is to ensure the minimum, not maximum, number of bars required?
the practical use is to ensure that all calculations within your code have enough bars to be computed correctly. If it helps your understanding you can consider this as the absolute minimum number of bars required to achieve that. It might also help to understand the term "Maximum number of bars study will reference" as the "Maximum number of bars a calculation within your study will look back at previous bar's values". However, there is another point to keep in mind here and I have addressed this in my last webinar I did with nexusfi.com: For calculations with starting point dependencies like an exponential average for example this setting allows you to control how many bars you give the code to "swing in" in order for you to be able to reproduce and compare results and not to have the results change simply due to a different starting point.