Hi All,
I’m here to share a simple indicator that i use to calculate the average monthly price (Open – Close) and probability of previous years. No. of years can be configured in parameter, default value is 8 years. I use DAX monthly chart as example, you can use it on stocks, indices and etc. It can be useful indicator / filter on your trading strategy to control the quantity on high probability month. You also can modify the code to measure to average monthly price + shadow (high – low), and in “weeks” if you prefer.
Your suggestions are welcome.
br,
CKW
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
m = 0 AverageMon = 0 Positive = 0 Negative = 0 Pb = 0 If Year > 2014 then For loop = 1 to Years do AverageMon = (Close[m] - Open[m]) + AverageMon If (Close[m] - Open[m]) > 0 then Positive = Positive + 1 else Negative = Negative + 1 endif m = m + 12 next If AverageMon > 0 then Pb = Positive else Pb = Negative endif endif Return AverageMon/(Years) as "Avg Price", ABS(Pb/Years)*100 as "Probability" |
Share this
No information on this site is investment advice or a solicitation to buy or sell any financial instrument. Past performance is not indicative of future results. Trading may expose you to risk of loss greater than your deposits and is only suitable for experienced investors who have sufficient financial means to bear such risk.
ProRealTime ITF files and other attachments :PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials
Hey! Thank so much for sharing this wonderful indicator! I have always tried to code a similar indicator, but unfortunately I haven’t had the knowledge to do so.
PRT tells me that “Years” are not defined. Has somebody had a similar problem? What to do about it? Could someone please help me?
Best regards, Philip
Hi Philip,
What do you mean “Years” are not defined ? candle? If to code yearly candle size, something can be like this…. (not tested)
IF YEAR[0] <> YEAR[1] THEN
YCLOSE= CLOSE[0]
YEARCANDLE = PREYCLOSE -YOPEN
PREYCLOSE = CLOSE[0]
ENDIF
Br,
CKW
Years not defined was probably b/c Phillip copied and pasted the code into PRT instead of importing the .itf file. In his case, he just needs to add the variable years as an integer, default value 8.
On the monthly chart as instructed, I found this highly correlates with other reading I’ve found about the seasonality of the USDJPY, though I found better accuracy when I set the years to a period that excluded the excessive swings post-financial crisis.On a constructive note, I tried a crude modification setting the look-forward to +24, and tried it on the hourly chart. I was not previously aware of a time-of-day cycle to hourly up/down probabilities. I found some highly regular patterns for time of day. So that was surprisingly useful.What was even more confusing/surprising is that the original +12 showed an even higher correlation for the exact same 24-hour cycle than my +24 edit. I’m still a bit new to trading, so I cannot explain this very visible pattern in terms of fundamental market drivers for the USDJPY.