GetTradingLoopStartBar startBar values?
Author: BAJER
Creation Date: 1/2/2018 4:51 PM
profile picture

BAJER

#1
I'm a new member and trying to climb the learning curve for WealthLab Pro.
I have been using the Rules Wizard to build strategies, and to view the generated code for these strategies.

I noticed the GetTradingLoopStartBar startBar parameter value changes for different strategies, but I don't understand why this value is generated. I have tested a few different values of 1, 50, and 100 for the statBar value. The only change I see, is the date of when the strategy begins the first buy and the resulting increase or decrease in the final Performance values. I've read the GetTradingLoopStartBar description in the QuickRef guide, but I am struggling to understand the meaning since I'm also trying to learn the terminology.

Is there a good example or description that would help me understand the effect of the statBar value?

Thanks for any assistance,

Joel
profile picture

Eugene

#2
Welcome to the forums Joel.

The purpose of the startBar parameter is to start the main (trading) loop at the first valid value based on the largest lookback of the indicator used. Simply put, if using a 20-day SMA and 50-day Highest High '50' would be the proper value of the startBar. The good news is that GetTradingLoopStartBar does the job itself. Even if you put '1' it should figure out the largest lookback period and use '50' internally.

That was the easy part but things can get more complicated if you use a group of certain "unstable" indicators in your rules or code. To avoid a common pitfall like this make sure you've read this chapter in the WealthScript Programming Guide: Indicators > Stability of Indicators.
profile picture

BAJER

#3
Thanks for adding me to the forum.

Great explanation! The light clicked on after I read it.
Thanks Eugene.

Joel
profile picture

Eugene

#4
Joel, glad I could be of assistance.