How can dhigh(0) be re-calibrated to start at 08:00?
Forums › ProRealTime English forum › ProBuilder support › How can dhigh(0) be re-calibrated to start at 08:00?
- This topic has 5 replies, 4 voices, and was last updated 7 years ago by Nicolas.
-
-
07/12/2017 at 3:21 PM #40454
I have developed an indicator that displays the % of the 5 day ATR that has been consumed during an intraday trading session. It works perfectly apart from one aspect, which is the time of day it starts to read data. The intention is for the indicator to only start measuring price movement against the 5 day ATR during cash trading hours (i.e. 08:00 -16:30 UK time for the DAX & FTSE). The flaw in my code is that the indicator starts measuring price movement from the start of the trading day i.e. midnight. I think the issue is that I have needed to use the dhigh(0) and dlow(0) variables, and this causes the indicator to start its calculations too early i.e. midnight instead of 08:00. I need some way of re-calibrating dhigh(0)/dlow(0) to start at 08:00. The only way I have been able to see the indicator perform as intended has been to manually change the trading hours range to 08:00-16:30 in platform settings. Then the indicator works perfectly, but the problem is I cannot see any price action before 08:00, so I want to try and solve the problem through coding. I have attached the code and some screenshots of how the indicator should look compared to how it does look. I will be very grateful if someone can help.
07/12/2017 at 10:35 PM #4049907/12/2017 at 10:54 PM #40501I just insert your code here -> you click onto the <> button and can copy & paste your code, so people don’t have to download it. (Btw. I have a unix system and can’t open the other file)
12345678910111213141516//window high/low calculatiomstartime1=080001endtime1= 163001//Calculate high/lowif time>= startime1 and time<=endtime1 thenCondition1 = (dhigh(0)- dlow(0))Condition2= ATRATRfill =(Condition1/Condition2)*100elsif time< startime1 or time>endtime1 thenATRfill =0endifReturn ATRfill as "%ATRfill"07/13/2017 at 12:48 PM #40565Hi Neilla – I had similar issue a while back and yeh was going to say the same thing – only way I found was to change the trading hours
I no longer use that indicator as it was very limiting for other strategies having the trading hours ‘crippled’ like that but if this is your main strategy perhaps setup your live PRT with the edited trading hours and the demo PRT with the default trading hours and have them open side by side so have one for viewing and one for trading
Not great I know but that’s why I just took a different direction and moved away from further dev on the indicator as it was too limiting unfortunately
07/13/2017 at 6:11 PM #40574Thank you for the replies so far.
The suggestion from AVT to “define something like MyDayOpen to let the program know your days are shorter” sound perfect, but I don’t know how to do it. If anyone knows how to write some lines of code that can achieve this objective, please could you post a response. I have checked all the ProRealtime manuals and I’m unable to find any solutions in there.
I hope some can help because this is a really useful indicator for anyone who likes to trade during opening hours for the real cash markets. if the problem can be solved then the indicator can be shared.
07/18/2017 at 1:31 PM #40967 -
AuthorPosts