I couldn't seem to locate a reference manual for the script commands, so I have a basic question:
How is the value determined for setting the 'GetTradingLoopStartBar' command? Should it be the number of bars of data loaded for the selected timeframe?
Size:
Color:
Welcome to the forum.
QUOTE:
I couldn't seem to locate a reference manual for the script command
Strike F11 key and in the QuickRef window start typing in the first few characters of GetTradingLoopStartBar. There you'll find it explained.
Size:
Color:
F11 was just the resource I needed, but couldn't find. Thanks for pointing me in the right direction.
Size:
Color:
Glad to help.
Size:
Color:
One issue I have with B&H comparisons is that one of my daily strategies has a long "startup" period before it has enough historical data to generate signals. This is instantiated in code by the GetTradingLoopStartBar function at the start of the trading code. B&H buys immediately based on earliest date of the data range, while the strategy is still collecting data. This results in wildly different long-term performance of the strategy vs. B&H depending on what the market was doing while GetTradingLoopStartBar was delaying until it had enough days of data. This effect is easily seen on the Equity Curve tab.
I've never figured out a way to synchronize the strategy with B&H to get an apples-to-apples comparison. Ideally B&H would not kick in (and buy) until GetTradingLoopStartBar has the required number of days of data. Do you know if there is a way to do this?
Size:
Color:
Size:
Color:
At least I'm consistent ;)
I went through the background and think the GetAllDataForSymbol approach may be the best for me. I am trying to understand what is happening programmatically. In the following code sample:
CODE:
Please log in to see this code.
Is it creating a new object ("b") which contains all data rather than only data starting on selected data range? and does "b.Close" indicate to use this new dataset instead of the default which would be referenced by "Close"?
I have multiple references to "Close" in the beginning of my Execute code. so for example, would I change
CODE:
Please log in to see this code.
TO
CODE:
Please log in to see this code.
Also, would I change
CODE:
Please log in to see this code.
TO
CODE:
Please log in to see this code.
Please let me know if I understand this correctly.
Size:
Color:
Happy New Year.
QUOTE:
Is it creating a new object ("b") which contains all data rather than only data starting on selected data range?
and does "b.Close" indicate to use this new dataset instead of the default which would be referenced by "Close"?
Your understanding is correct on both points.
QUOTE:
I have multiple references to "Close" in the beginning of my Execute code. so for example, would I change
Yes, that should work. With a little change to get rid of duplicate code:
CODE:
Please log in to see this code.
It's easy to get out of sync having duplicate definitions and tweaking the code later.
QUOTE:
Also, would I change
As long as the indicators your code does
not rely on the "Bars" object (plus any other external Bars objects) vs. the new "b" object, the change should be fine.
Size:
Color:
Hi Eugene,
I finally got back to this and implemented today. Look like it's working perfectly! Thank you!
Good catch on the redundant code....
Robert
Size:
Color:
Hi Robert,
Good to hear that! You're most welcome.
Size:
Color: