Indicators on multiple time frames: monthly/minute
Author: WW
Creation Date: 12/7/2016 9:58 PM
profile picture

WW

#1
Hi,

I use intra-day-data and I want monthly signals to be executed. The if-order as placed here works only when I leave out the secon part after "&&". Do someone know why?

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

KGo

#2
Monthly bars converted to intraday will cause every intraday bar in a month to have the same value so at 15 min scale bar, bar-1 and bar-2 will never be 3 different values. Create the signal at monthly scale and synchronize it to intraday. Note it will work when RestoreScale is removed.

The monthly ADX is not stable for maybe 4-5 years! So you will need a lot on 15 min data before the first trade. See Programming Guide > Indicators > Stability of Indicators
profile picture

Cone

#3
Please use the technique illustrated in this Wiki article for GetIntradayBar / GetWeeklyBar. Of course in your case, you'd just name the series GetMonthlyBar ;)

Given that this can be confusing, I knocked it out for you here. Note that you need 16 months of data to get started with this strategy because you need a 14-month ADX and the strategy condition looks back 2 months, so 14 + 2.

Feel free to ask questions.

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

KGo

#4
Cone, Very Nice!!

The direction of ADX(14) bar to bar can differ easily for 20 monthly bars and I have seen different directional readings at 4 years when more seed data is added. Just a caution.
profile picture

Cone

#5
For sure. ADX, like RSI and a host of other Infinite Impulse Response (IIR) indicators are sensitive to seed data, and values can change depending on the starting date of the series! For the whole discussion, see the WealthScript Programming Guide > Indicators > Stability of Indicators
profile picture

WW

#6
Thank you all for the quick and helpfull answers. Cone thank you for the code. That was what I needed.