Showing customized daily Indicators in smaller timeframes?

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

    Hello,

    I would like to show the Pivot Point Support 3, Resistance 3 and the Average True Range on a daily basis in smaller timeframes in a chart for the actual day only.

    Somehow there is a strange behaviour with different timeframes.

    Timeframe = daily -> shows nothing

    Timeframe = 4hrs -> shows PP and ATR lines, but for today and the day before

    Timeframe = 1hrs – 15min -> shows PP and ATR lines for today (as expected)

    Timeframe = 10min – 1min -> shows only PP (ATR lines are missing)

    Does somebody know, where the problem is?

    Thanks in advance!

    Here is the code:

    IF Date = Today THEN
    DH=DHIGH(1)
    DL=DLOW(1)
    DC=DCLOSE(1)
    PP=(DH+DL+DC)/3
    //Res1=PP+(PP-DL)
    //Res2=PP+(DH-DL)
    Res3=DH+2*(PP-DL)
    //Sup1=PP-(DH-PP)
    //Sup2=PP-(DH-DL)
    Sup3=DL-2*(DH-PP)
    
    n=14
    f=1
    SumTR=0
    for i=1 to n do
    TH=max(DHigh(i),DClose(i+1))
    TL=min(DLow(i),DClose(i+1))
    TrueR=TH-TL
    SumTR=SumTR+TrueR
    next
    ATR=SumTR/n
    ATRo=PP+ATR*f
    ATRu=PP-ATR*f
    else
    //Sup1 = undefined
    //Sup2 = undefined
    Sup3 = undefined
    //Res1 = undefined
    //Res2 = undefined
    Res3 = undefined
    ATRo = undefined
    ATRu = undefined
    endif
    return Sup3 COLOURED(0,0,255),Res3 COLOURED(255,0,0),ATRo COLOURED(255,0,0),ATRu COLOURED(0,0,255)
    #7541 quote
    Adolfo
    Participant
    Senior

    Hi Xerxes, I checked it and didn’t get any error, results are the same in 5m, 15m, 1h or 4h for me, see attached image below.

    Regards.

    Nicolas thanked this post
    #7568 quote
    Xerxes
    Participant
    New

    Hello Adolfo Onrubia,

    thank you for your reply. If you have used the same code then the result is a little bit strange.

    For me the code works perfect between 15mins and 1 hour only. The rest of the time the result is not as it used to be as described before (see pictures attached):

    Timeframe = daily -> shows nothing

    Timeframe = 4hrs -> shows PP and ATR lines, but for today and the day before

    Timeframe = 1hrs – 15min -> shows PP and ATR lines for today (as expected)

    Timeframe = 10min – 1min -> shows only PP (ATR lines are missing)

    If you have got an idea what the mistake could be, you are highly welcome!

    Thank you

    #7574 quote
    Xerxes
    Participant
    New

    For the daily setup the correct values are shown on the vertical axis. So there are not small lines but only points that can not be seen.

    But I do not know why for the 4hrs setup there are no straight lines. Instead there are polylines which should not be.

    The 5min setup does not show the values for the average true range at all.

    #7575 quote
    Adolfo
    Participant
    Senior

    Yes Xerxes, I got a Master in Copy/Paste a few years ago!! hehehe! I used your shared code here.

    I realize on one thing, since you’re using daily bars with the code:

    IF Date = Today THEN

    I think it will not work because intradaybars are not checked. (Hope someone put me on the right way if I’m wrong at this point)

    For other issues with 4h, 1m or 5m… I tryed it on DAX and worked fine. No others tested.

    Where are you testing it?

    #7614 quote
    Xerxes
    Participant
    New

    Thank you Master of copy and paste 😉

    I think the problem is related to the data structure of the candles itself and the configuration of the trading timeframe for each instrument.

    I tested the code on the german DAX but with other instruments it is the same problem. Some timeframes work and some not.

    Attached there is a picture of the Dow Jones on a daily basis. There the indicator works perfect. But on smaller timeframes there is a different behaviour, too.

    Mmm…I have got no idea!

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

Showing customized daily Indicators in smaller timeframes?


Platform Support: Charts, Data & Broker Setup

New Reply
Author
author-avatar
Xerxes @xerxes Participant
Summary

This topic contains 5 replies,
has 2 voices, and was last updated by Xerxes
9 years, 8 months ago.

Topic Details
Forum: Platform Support: Charts, Data & Broker Setup
Language: English
Started: 05/20/2016
Status: Active
Attachments: No files
Logo Logo
Loading...