Defining a time frame
Forums › ProRealTime English forum › ProBuilder support › Defining a time frame
- This topic has 5 replies, 2 voices, and was last updated 5 years ago by fxbravo.
-
-
12/06/2018 at 2:39 PM #86440
Hello gentlemen,
I want to code this need, but I don’t know how to do it!
My need: I take a simple RSI(14) but I want to check X time by day if the condition is OK or NotOK
Here a drawto show you:
9h00: the indicator check if the conditon is OK until 12h00 (it’s ok for this)
14h00: the indicator check again if the condition is ok until 18h00/ It could be OK or NotOK, whatever it happen (OK or NotOK) between 9h/13h59 (like it’s the begining of the day, minus the timeframe 9h00/13h59)
So, my problem is to “reset” à 14h00 the indicator
Thank you for your help
Have a perfect day
12/06/2018 at 3:24 PM #86444It seems easy to reset a variable to 0 or whatever other value, so I don’t think that’s the main reason of your question? Do you still use the value “ok / not ok” of the morning period but in the afternoon? BTW, would be easier and faster to understand and reply with the code.
12/06/2018 at 4:01 PM #86446Hello Nicolas,
You’re right, it’s better with code 😉
here an example of code I posted few days ago (the logic is the same):
12345678nb = intradaybarindexatrmax = highest[nb](AverageTrueRange[14](close))atrmin = lowest[nb](AverageTrueRange[14](close))middle = ABS((atrmax+atrmin)/2)return middleSo, this morning, atrmax was 29 in UT1. So no pb for me, the market’spsychology is OK with that ATR. But, during lunch time, it’s not the same thing. And I wanted to “resest” the indicator with atrmax begining at 12h00, not 00h00.
Hope that I explain this clearly 😉
Thank you for your help Nicolas.
Have a perfect day.
12/06/2018 at 4:19 PM #86449If I could code this I’ll do:
12345678910111213141516171819202122If time is between 00h00 and 12h00 thennb = intradaybarindexatrmax = highest[nb](AverageTrueRange[14](close))atrmin = lowest[nb](AverageTrueRange[14](close))middle = ABS((atrmax+atrmin)/2)enfifif the time is between 12h00 and 23h59 thennb = intradaybarindex (restart at 12h00)atrmax = highest[nb](AverageTrueRange[14](close))atrmin = lowest[nb](AverageTrueRange[14](close))middle = ABS((atrmax+atrmin)/2)enfifreturn middleSo, if the value atrmax is X between 00h00 and 12h00, the code do the formula with X value.
And if the value atrmax is Y between 12h00 and 23h59, the code do the formula with Y value.
12/06/2018 at 4:31 PM #86454This is what you need:
123456789101112if intradaybarindex=0 or time=120000 thenstart=barindexendifnb=max(1,barindex-start)atrmax = highest[nb](AverageTrueRange[14](close))atrmin = lowest[nb](AverageTrueRange[14](close))middle = ABS((atrmax+atrmin)/2)return middleThe period is a subtraction between the current barindex and the one saved when you want the period of calculation to start, at the beginning of the day or at 120000.
12/06/2018 at 5:02 PM #86461 -
AuthorPosts
Find exclusive trading pro-tools on