Assure enough Data when using External Symbol in Strategy
Author: wmrgrove
Creation Date: 2/21/2018 4:03 PM
profile picture

wmrgrove

#1
Having searched the forum and Wiki I am having trouble finding an answer to the following.

With an external symbol in a strategy how do I assure that both the external and tested symbol have adequate data for my Strategy Data Range? I recall a line of code that does this as a condition to buy but can't find it.

Also is there a simple Strategy that will "Print Debug" a data-set run, and show the symbol and first data date, and or the quantity of data periods by symbol?

Thanks for any help!
profile picture

Eugene

#2
This is accomplished with the Bars.FirstActualBar property.

P.S. Also, to always load the data despite a big lookback your system may have you might want to use GetAllDataForSymbol from Community Components. It shouldn't be an issue to find many examples and discussions on the forum.
profile picture

wmrgrove

#3
Eugene, thanks for the reply. I had looked at that, but was trying to do the following;

Also is there a simple Strategy that will "Print Debug" a data-set run, and show the symbol and first data date, and or the quantity of data periods by symbol?

Looking on the forum I was unable to find an answer?
profile picture

Eugene

#4
Have you seen the QuickRef example code for FirstActualBar ?
profile picture

wmrgrove

#5
Eugene, yes.

I am not able to get from this code to;

Also is there a simple "stand-alone" Strategy that will "Print Debug" a data-set run, and show the symbol and first data date, and or the quantity of data periods by symbol?
profile picture

Eugene

#6
Copy that. I'm not the brightest mind here but 3 iterations of that seem to be enough. ;)

This code shows the symbol and the first actual bar (which changes depends on the number of bars loaded). And it's designed exactly to make sure that the external symbol has adequate data - as states your topic title.

If you wish to output the first date and/or quantity of bars loaded, I'm sure this will be a trivial excercise for you when you review other properties of the Bars object and related entries. This is WealthScript 101 that shouldn't present any difficulty and it's all covered with examples in the QuickRef. Good luck.
profile picture

Cone

#7
QUOTE:
is there a simple "stand-alone" Strategy that will "Print Debug" a data-set run,

Run this on any one symbol in the DataSet. It will sort by first or last date as specified in the parameter.


CODE:
Please log in to see this code.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).