A code about highs of last ten days

Viewing 15 posts - 1 through 15 (of 18 total)
  • Author
    Posts
  • #160925 quote
    gb967
    Participant
    Master

    Hello, I would like an answer about this code. It is a code that considers the high of the day of the last ten days. It’ s vey simple but I do not understand why it doesn’t function
    thanks a lot guys

    a=DHigh(1)
    b=DHigh(2)
    c=DHigh(3)
    d=DHigh(4)
    e=DHigh(5)
    f=DHigh(6)
    g=DHigh(7)
    i=DHigh(8)
    l=DHigh(9)
    m=DHigh(10)
    
    return a,b,c,d,e,f,g,i,l,m
    #160931 quote
    Vonasi
    Moderator
    Master

    gb967 – Welcome to the forums. Please re-read the forum rules before posting again. Your post has been moved to the correct forum and your code inserted correctly.

    Post your topic in the correct forum:
    _ ProRealTime Platform Support: only platform related issues.
    _ ProOrder: only strategy topics.
    _ ProBuilder: only indicator topics.
    _ ProScreener: only screener topics
    _ General Discussion: any other topics.
    _ Welcome New Members: for new forum members to introduce themselves.

    • Always use the ‘Insert PRT Code’ button when putting code in your posts to make it easier for others to read.
    Insert-PRT-Code-Button.png Insert-PRT-Code-Button.png
    #160955 quote
    robertogozzi
    Moderator
    Master

    Why do you think it’s not working?

    x-1.jpg x-1.jpg
    #160971 quote
    willi
    Participant
    Master

    Hello, I think the indicator was called separately and not in the price window.
    Willi

    #160974 quote
    Vonasi
    Moderator
    Master

    Right click on the price chart and then ‘Add Indicator’ from there.

    #160976 quote
    gb967
    Participant
    Master

    I use a 4 minute time frame and I would like the highs lines to be visible on the current daily chart. Look at the attached chart and you will understand. thanks

    20210210_190547.jpg 20210210_190547.jpg
    #160981 quote
    robertogozzi
    Moderator
    Master
    Do not  use the ‘Insert PRT Code‘ when writing text. Thank you 🙂 No, I don’t understand what you want. There’s no difference between 1-hour and 4-minute hour TF’s.
    #160990 quote
    Vonasi
    Moderator
    Master
    Are their enough units on your 4 minute chart to give ten days worth of data?
    #160991 quote
    Vonasi
    Moderator
    Master
    I just did a quick test and I think I see what you are asking. The ten DHIGH values are not correct.
    Screenshot_1-1.png Screenshot_1-1.png
    #160994 quote
    Vonasi
    Moderator
    Master
    Your code should work but does not. Try this slightly more complicated workaround:
    if intradaybarindex < intradaybarindex[1] then
    a = a + 1
    $dayhigh[a]=maxhigh
    maxhigh = low
    if a >=10 then
    for b = 1 to 10
    $day[b] = $dayhigh[lastset($dayhigh)-b+1]
    next
    endif
    endif
    
    maxhigh = max(maxhigh,high)
    
    return $day[1] as "day1",$day[2] as "day2",$day[3] as "day3",$day[4] as "day4",$day[5] as "day5",$day[6] as "day6",$day[7] as "day7",$day[8] as "day8",$day[9] as "day9",$day[10] as "day10"
    Screenshot_2.png Screenshot_2.png
    #160998 quote
    Vonasi
    Moderator
    Master
    Just for fun here is a version that draws the last ten days highs and lows.
    once $hday[1] = undefined
    once $hday[2] = undefined
    once $hday[3] = undefined
    once $hday[4] = undefined
    once $hday[5] = undefined
    once $hday[6] = undefined
    once $hday[7] = undefined
    once $hday[8] = undefined
    once $hday[9] = undefined
    once $hday[10] = undefined
    
    once $lday[1] = undefined
    once $lday[2] = undefined
    once $lday[3] = undefined
    once $lday[4] = undefined
    once $lday[5] = undefined
    once $lday[6] = undefined
    once $lday[7] = undefined
    once $lday[8] = undefined
    once $lday[9] = undefined
    once $lday[10] = undefined
    
    if intradaybarindex < intradaybarindex[1] then
    a = a + 1
    $dayhigh[a]=maxhigh
    maxhigh = low
    if a > 10 then
    for b = 1 to 10
    $hday[b] = $dayhigh[lastset($dayhigh)-b+1]
    next
    endif
    
    c = c + 1
    $daylow[c]=maxlow
    maxlow = high
    if c > 10 then
    for b = 1 to 10
    $lday[b] = $daylow[lastset($daylow)-b+1]
    next
    endif
    endif
    
    maxhigh = max(maxhigh,high)
    maxlow = min(maxlow,low)
    
    return $hday[1] coloured(0,128,0) as "day1",$hday[2] coloured(0,128,0) as "day2",$hday[3] coloured(0,128,0) as "day3",$hday[4] coloured(0,128,0) as "day4",$hday[5] coloured(0,128,0) as "day5",$hday[6] coloured(0,128,0) as "day6",$hday[7] coloured(0,128,0) as "day7",$hday[8] coloured(0,128,0) as "day8",$hday[9] coloured(0,128,0) as "day9",$hday[10] coloured(0,128,0) as "day10", $lday[1] coloured(128,0,0) as "day1",$lday[2] coloured(128,0,0) as "day2",$lday[3] coloured(128,0,0) as "day3",$lday[4] coloured(128,0,0) as "day4",$lday[5] coloured(128,0,0) as "day5",$lday[6] coloured(128,0,0) as "day6",$lday[7] coloured(128,0,0) as "day7",$lday[8] coloured(128,0,0) as "day8",$lday[9] coloured(128,0,0) as "day9",$lday[10] coloured(128,0,0) as "day10"
    Screenshot_3.png Screenshot_3.png
    #161001 quote
    robertogozzi
    Moderator
    Master
    I still can’t understand why all that extra coding when the first code posted works like a charm on whatever TF.
    #161025 quote
    Vonasi
    Moderator
    Master
    Because it doesn’t work like a charm. Did you see my image in this post?
    A code about highs of last ten days
    The simple code is definitely not drawing lines on the daily highs.
    #161027 quote
    gb967
    Participant
    Master
    This is what I would like to see the extension of the highs lines such as supports and resistances in the 4-minute tf of the current day. Instead the lines are not reported to me on the current day. I do not see them but i see only those of the past days.
    DXMXXXX-4-minuti.png DXMXXXX-4-minuti.png
    #161034 quote
    robertogozzi
    Moderator
    Master
    In my pic it does work as intended! Unless you want to plot them into the future, but it’s not what this post was all about!
    x-2.jpg x-2.jpg
Viewing 15 posts - 1 through 15 (of 18 total)
  • You must be logged in to reply to this topic.

A code about highs of last ten days


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
gb967 @gb967 Participant
Summary

This topic contains 17 replies,
has 4 voices, and was last updated by Vonasi
5 years ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 02/10/2021
Status: Active
Attachments: 8 files
Logo Logo
Loading...