Using a monthly indicator on a daily chart
Author: Tobey
Creation Date: 10/13/2014 9:31 AM
profile picture

Tobey

#1
Hi Cone & Eugene,

One of the monthly mutual fund strategies used the six month rate of change dropping below zero on the S&P as a signal to go to cash.

I'd like to see if adding that bear trap to some daily strategies would work.

I tried to set it up in the code below by setting the scale to monthly to create a six month rate of change indicator. And then synchronizing and restoring the daily scale. However something's not right because when I graph the results you can see daily changes in what's supposed to be a monthly rate of change.

In the last position active side of the strategy I've included two lines that I think should sell any open positions if the S&P monthly rate of change goes below zero.

On the buy side I've included a line of code that should require the S&P monthly rate of change to be above zero when new buys are made.

Since I'm not getting the monthly rate of change indicator to work correctly I'm not sure if this code is working correctly either.

Is there a better way to do this or am I just missing something in my code?


As always thanks for all your help and patience
Tobey


CODE:
Please log in to see this code.
profile picture

Eugene

#2
Tobey,

Change this:
CODE:
Please log in to see this code.

To this:
CODE:
Please log in to see this code.

You need to obtain the Bars on the Monthly scale.
profile picture

Tobey

#3
Hi Eugene,

Thanks! The graph is now showing us monthly data.

It's gets us a current monthly rate of change for the .SPX of -0.49. However on these ticker I'm getting positive numbers. (FFIV GPN KSU NKE). So something is not just right.

I think the sell code is working
CODE:
Please log in to see this code.


But It doesn't look like the requirement that the .SPX rate of change has to be > 0 is working beacuse even with the current ROC of -0.49 the alerts are showing new buys.
CODE:
Please log in to see this code.


Thanks for taking another look at it.

Many thanks
Tobey

profile picture

Eugene

#4
Not sure what do you mean. I'm not getting any positive numbers on any tickers.
profile picture

Tobey

#5
Hi Eugene,

I when back and checked my results and I am getting different numbers on the SPX6moRoc Indicator. BIIB is showing the SPX6moRoc to be -0.49 and most of the other tickers are showing the same. But FFIV GPN KSU NKE are showing different positive numbers.

I've printed out a PDF of all the charts so you can see what I am getting. If your getting -0.49 across the board then there is something funny going on in my system.

Thanks for your help!
Tobey

profile picture

Tobey

#6
Hi Eugene,

I did a little more checking. Looking at the S&P 100 there are 16 symbols returnind different numbers for the SPX6moRoc indicator.

Also the indicator value changed from yesterday (-0.49) to today (-0.33). So it must not be locking in on end of month data.

Here are the tickers from the S&P100 that didn't have -0.33 for the SPX6moRoc indicator.

DELL DIS HD HNZ HON HPQ IBM INTC JPM KO LMT LOW NKE NYX SLB UNH

Thanks again for taking a look at this problem

Thanks
Tobey
profile picture

Eugene

#7
Tobey,

QUOTE:
Looking at the S&P 100 there are 16 symbols returnind different numbers for the SPX6moRoc indicator.

This can happen when a symbol's data is not up-to-date, has omissions etc. Try updating the data and even refreshing it (right-click on the chart > "Reload chart data") if update didn't work.

QUOTE:
So it must not be locking in on end of month data.

It indeed is locking in on end of month data. But the end of month now, since you have updated the data, is yesterday. You can shift the synched DataSeries forward one bar (as exemplified in the QuickRef > DataSeries Object) if you're not interested in "partial" monthly bar.

CODE:
Please log in to see this code.
profile picture

Tobey

#8
Hi Eugene,

Ok I can sync it to get rid of partial data.

But I'm still a little lost on different tickers giving different results for the .SPX. Even though we are dealing with different tickers, When it comes to SPX6moRoc we are importing the same data and only making calculations with that same external data. So I wouldn't think the base data of any individual ticker would affect the SPX6moRoc results.

I must be missing something here.

Thanks again for the help!
Tobey
profile picture

Eugene

#9
Here's how it works:

WealthScript Programming Guide > DataSeries > Accessing Secondary Symbols > Secondary Series Synchronization
profile picture

Tobey

#10
Hi Eugene,

Thanks for the link.

Thanks to your help, the code works.

But in back tests it doesn't add anything to the strategy. It might decrease the volatility but it also decreases the annualized return by 2.5%

Thanks again for all your help!
Tobey
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).