How to apply an indicator on day session only?
- This topic has 7 replies, 3 voices, and was last updated 5 years ago by .
Viewing 8 posts - 1 through 8 (of 8 total)
Viewing 8 posts - 1 through 8 (of 8 total)
Similar topics:
Forums › ProRealTime English forum › ProBuilder support › How to apply an indicator on day session only?
Try this. Not tested as demo platform down via IG at the moment.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
p = 50 starttime = 093000 endtime = 163000 if barindex >= p then total = 0 count = 0 for j = 0 to barindex if count < p then if opentime[j] >= starttime and time[j] <= endtime then total = total + close[j] count = count + 1 endif else break endif next ave = total/p endif return ave as "Session Average" |
It is not a huge amount of work. but perhaps you should post a suggestion that PRT add a built in platform indicator that does what you are requesting.
Here is an adapted version of my code. Simply change myIndicator to whatever indicator or price value you want a session average of. You can just CALL this indicator from your strategy or add it to any separate indicator.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
p = 50 starttime = 093000 endtime = 163000 myindicator = rsi[14] if barindex >= p then total = 0 count = 0 for j = 0 to barindex if count < p then if opentime[j] >= starttime and time[j] <= endtime then total = total + myindicator[j] count = count + 1 endif else break endif next ave = total/p endif return ave as "Session Average" |
Find exclusive trading pro-tools on