Daily ATR on 1 hour charts

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #165877 quote
    darko
    Participant
    Junior

    Hi,

    I am still on PRT 10.3 and I would like to create an indicator on my 1 hour charts that traces two lines from the close at 11pm (“close”:

    a line that is equal to “close”+Daily ATR 14
    a line that is equal to “close”-Daily ATR 14

    Can someone help me build that please?

    Thanks

    #165881 quote
    robertogozzi
    Moderator
    Master

    This will use the  current Daily value at 110000, if you prefer yesterday’s ATR value at close time, use the line in the comment (UpdateOnClose instead of Default):

    Timeframe(Daily,Default)              //or Timeframe(Daily,UpdateOnClose) to have yesterday's data at close
    MyATR = AverageTrueRange[14](close)
    //
    Timeframe(default)
    IF Time = 110000 THEN
       AtrHI = close + MyATR
       AtrLO = close - MyATR
    ENDIF
    RETURN AtrHI AS "Upper Band",AtrLO AS "Lower Band"

    you may also want to replace TIME with OPENTIME as suits you best.

    You may also colour the lines with the indicator properties.

    #165939 quote
    RubberToe
    Participant
    Average

    Hi there, this was helpful to me for what I’m trying to do, but I have a problem.  I get a calculation error I can’t figure out:

    My objective is to draw ATR lines 45 minutes after market open (USA), so 10:15 EST.  I just have 000000 now for testing.  I want to link the ATR lines to either the current low or high of the day at 10:15 and can float like this for the rest of the day.

    Timeframe(Daily,UpdateOnClose)              //or Timeframe(Daily,UpdateOnClose) to have yesterday's data at closeTimeframe(Daily,UpdateOnClose)
    MyATR = AverageTrueRange[14](close)
    rmg = (((DHigh(0) - DLow(0))/2)) + DLow(0) //median for day
    //
    Timeframe(default)
    IF (Time => 000000) and (CLOSE > rmg)  THEN
    AtrLO = DLow(0)
    AtrHI = DLow(0) + MyATR
    elsif (Time => 000000) and (CLOSE < rmg)  THEN
    AtrHI = DHigh(0)
    AtrLO = DHigh(0) - MyATR
    ENDIF
    
    RETURN AtrHI AS "Upper Band",AtrLO AS "Lower Band"
    #165979 quote
    robertogozzi
    Moderator
    Master

    In CET time (Utc +2), 101500 EST (Utc – 4) is 161500.

    In Canada you will have to adjust it to your TZ:

    Timeframe(Daily,UpdateOnClose)              //or Timeframe(Daily,UpdateOnClose) to have yesterday's data at closeTimeframe(Daily,UpdateOnClose)
    MyATR = AverageTrueRange[14](close)
    rmg   = (((High - Low)/2)) + Low //median for day
    DayHI = high
    DayLO = low
    //
    Timeframe(default)
    IF (Time => 161500) and (CLOSE > rmg)  THEN
       AtrLO = DayLO
       AtrHI = DayLO + MyATR
    elsif (Time => 161500) and (CLOSE < rmg)  THEN
       AtrHI = DayHI
       AtrLO = DayHI - MyATR
    ENDIF
    RETURN AtrHI AS "Upper Band",AtrLO AS "Lower Band"

    I replaced DHIGH e DLOW with DayHI and DayLO because I was reported a calculation error.

    RubberToe thanked this post
    #165992 quote
    RubberToe
    Participant
    Average

    Getting closer thanks. These lines return the median/high/low prices for the day before, but I need them for the live trading day.

    rmg = (((High - Low)/2)) + Low //median for day
    DayHI = high
    DayLO = low
    #165996 quote
    robertogozzi
    Moderator
    Master

    Replace UpdateOnClose with Default in line 1.

    #165997 quote
    robertogozzi
    Moderator
    Master

    Actually using Default in line 1 makes it useless using the Daily TF.

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.

Daily ATR on 1 hour charts


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
darko @darko Participant
Summary

This topic contains 6 replies,
has 3 voices, and was last updated by robertogozzi
4 years, 10 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 03/31/2021
Status: Active
Attachments: No files
Logo Logo
Loading...