How can dhigh(0) be re-calibrated to start at 08:00?

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #40454 quote
    neilla
    Participant
    New

    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.

    #40499 quote
    AVT
    Participant
    Senior

    If your day is just from 8-5 you should define something like MyDayOpen to let the program know your days are shorter. Just an idea.

    #40501 quote
    AVT
    Participant
    Senior

    I 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)

    //window high/low calculatiom
    startime1=080001
    endtime1= 163001
     
    //Calculate high/low
    if time>= startime1 and time<=endtime1 then
    
    Condition1 = (dhigh(0)- dlow(0))
    Condition2= ATR
    ATRfill =(Condition1/Condition2)*100
    
    elsif time< startime1 or time>endtime1 then
    ATRfill =0
    endif
    
    Return ATRfill as "%ATRfill"
    #40565 quote
    random45689
    Member
    New

    Hi 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

    #40574 quote
    neilla
    Participant
    New

    Thank 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.

    #40967 quote
    Nicolas
    Keymaster
    Master

    I think the AVT’s idea is to set external variables for:

    startime1=080001
    endtime1= 163001
    Instead of having them in the code, set them as external variables in the indicator settings window.
Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.

How can dhigh(0) be re-calibrated to start at 08:00?


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
neilla @neilla Participant
Summary

This topic contains 5 replies,
has 4 voices, and was last updated by Nicolas
8 years, 6 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 07/12/2017
Status: Active
Attachments: 2 files
Logo Logo
Loading...