How to apply an indicator on day session only?
Forums › ProRealTime English forum › ProBuilder support › How to apply an indicator on day session only?
- This topic has 7 replies, 3 voices, and was last updated 5 years ago by Vonasi.
Viewing 8 posts - 1 through 8 (of 8 total)
-
-
10/22/2019 at 6:53 AM #11077510/22/2019 at 7:28 AM #110776
Try this. Not tested as demo platform down via IG at the moment.
12345678910111213141516171819202122p = 50starttime = 093000endtime = 163000if barindex >= p thentotal = 0count = 0for j = 0 to barindexif count < p thenif opentime[j] >= starttime and time[j] <= endtime thentotal = total + close[j]count = count + 1endifelsebreakendifnextave = total/pendifreturn ave as "Session Average"10/22/2019 at 8:05 AM #11078310/22/2019 at 8:35 AM #11078710/22/2019 at 12:18 PM #11081710/22/2019 at 12:45 PM #110820It 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.
1234567891011121314151617181920212223p = 50starttime = 093000endtime = 163000myindicator = rsi[14]if barindex >= p thentotal = 0count = 0for j = 0 to barindexif count < p thenif opentime[j] >= starttime and time[j] <= endtime thentotal = total + myindicator[j]count = count + 1endifelsebreakendifnextave = total/pendifreturn ave as "Session Average"10/22/2019 at 3:02 PM #11084210/22/2019 at 3:05 PM #110843 -
AuthorPosts
Viewing 8 posts - 1 through 8 (of 8 total)
Find exclusive trading pro-tools on
Similar topics: