SetScaleMonthly results in 0 values for first twenty bars
Author: jecjackal
Creation Date: 5/29/2018 11:11 AM
profile picture

jecjackal

#1
Hi All,

I have a long term strategy, where I am interesting in using some monthly data to influence my trading signals. However, when I inspect the close values of the monthly bars, I am seeing 0's for the first twenty [0 - 19] closes. Here is the code I used to get the monthly data:

CODE:
Please log in to see this code.


Here's some additional information. I'm running on the daily time scale testing from 1/1/2008 to 12/31/2012. I have seen this behavior with several symbols: [A, AABA, AAP, ABB]. Each of these symbols has data starting at 1/1/2008. I'm really stuck and I would appreciate any help.

Thanks,

Jec
profile picture

Cone

#2
You can't get values for the end of the month before the end of the month.. that's peeking ;) Consequently, the first month is invalid due to synchronization. More info in the WealthScript Programming Guide: DataSeries > Accessing Secondary Symbols > Secondary Series Synchronization

To visualize the synchronization in your script, add this statement at the end:
CODE:
Please log in to see this code.
You'll see that the monthlyBars Closing price snaps to the last closing price in a calendar month.
profile picture

jecjackal

#3
Ah that makes perfect sense. Thanks Cone!
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).