Seasonality curve not working

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #172677 quote
    snucke
    Participant
    Veteran

    The seasonality curve built by Vonasi is not working anymore  https://www.prorealcode.com/prorealtime-indicators/seasonality-curve/

    on some instruments it only plots one or two months and on most of them notihing..

    it worked fine a couple of months ago and all of a sudden it stoped working.

    my only guess is that a command or something used in the code has changed from prorealtime in a update?

     

    is anyone able to spot the error?

     

    //Seasonality Curve
    //By Vonasi
    //Date: 20200326
     
    defparam drawonlastbaronly = true
     
    //StartDate = 19950101 //Set to zero to analyse all of history
    //EndDate = 20200101 //Set to zero to analyse all of history
    //HighAndLow = 1 //switch on and off drawing of high and low points
    //Percentage = 1 //switch on or off calcualtion based on percentage of price
     
    if enddate <= 0 or enddate < startdate then
    enddate = 99999999
    endif
     
    if barindex > 0 and opendate >= startdate and opendate <= enddate then
     
    if percentage then
    diff = (((close - close[1])/close[1])*100)
    else
    diff = close - close[1]
    endif
     
    mydate = date - (floor(date/10000)*10000)
    $total[mydate] = $total[mydate] + diff
    endif
     
    if islastbarupdate then
     
    if barindex > 365 then
    mymonth = 100
    myday = 1
    thisdate = mymonth + myday
    lastsegment = 0
    drawtext("Jan",barindex - 365,0,SansSerif,Bold,12)coloured(0,0,255)
     
    a = 365
    for b =  1 to 365
    mybar = barindex - a
    if isset($total[thisdate]) then
    drawsegment(mybar,lastsegment,mybar+1,lastsegment + $total[thisdate])
    lastsegment = lastsegment + $total[thisdate]
    a = a - 1
    endif
     
    if myday = 31 then
    mymonth = mymonth + 100
    myday = 0
     
    if mymonth = 200 then
    drawtext("Feb",mybar,lastsegment - $total[thisdate],SansSerif,Bold,12)coloured(0,0,255)
    endif
    if mymonth = 300 then
    drawtext("Mar",mybar,lastsegment - $total[thisdate],SansSerif,Bold,12)coloured(0,0,255)
    endif
    if mymonth = 400 then
    drawtext("Apr",mybar,lastsegment - $total[thisdate],SansSerif,Bold,12)coloured(0,0,255)
    endif
    if mymonth = 500 then
    drawtext("May",mybar,lastsegment - $total[thisdate],SansSerif,Bold,12)coloured(0,0,255)
    endif
    if mymonth = 600 then
    drawtext("Jun",mybar,lastsegment - $total[thisdate],SansSerif,Bold,12)coloured(0,0,255)
    endif
    if mymonth = 700 then
    drawtext("Jul",mybar,lastsegment - $total[thisdate],SansSerif,Bold,12)coloured(0,0,255)
    endif
    if mymonth = 800 then
    drawtext("Aug",mybar,lastsegment - $total[thisdate],SansSerif,Bold,12)coloured(0,0,255)
    endif
    if mymonth = 900 then
    drawtext("Sep",mybar,lastsegment - $total[thisdate],SansSerif,Bold,12)coloured(0,0,255)
    endif
    if mymonth = 1000 then
    drawtext("Oct",mybar,lastsegment - $total[thisdate],SansSerif,Bold,12)coloured(0,0,255)
    endif
    if mymonth = 1100 then
    drawtext("Nov",mybar,lastsegment - $total[thisdate],SansSerif,Bold,12)coloured(0,0,255)
    endif
    if mymonth = 1200 then
    drawtext("Dec",mybar,lastsegment - $total[thisdate],SansSerif,Bold,12)coloured(0,0,255)
    endif
    endif
     
    myday = myday + 1
    thisdate = mymonth + myday
     
    mymax = max(lastsegment,mymax)
    once mymin = lastsegment
    once mymax = lastsegment
    mymin = min(lastsegment,mymin)
    if mymax = lastsegment then
    maxval = lastsegment
    maxbar = mybar
    endif
    if mymin = lastsegment then
    minval = lastsegment
    minbar = mybar
    endif
    next
    if HighAndLow then
    drawpoint(maxbar+1,maxval,3)coloured(128,0,0)
    drawpoint(minbar+1,minval,3)coloured(0,128,0)
    endif
    endif
    endif
     
    return mymax coloured(0,0,0,0), mymin coloured(0,0,0,0)
    Seasonality-Curve-1.itf
    #175229 quote
    snucke
    Participant
    Veteran

    robertogozzi or Nicolas have any idea how to solve this?

    since Vonasi did not have the time to take a look at this maybe you guys have an idea? 🙂

    #175298 quote
    robertogozzi
    Moderator
    Master

    I added the indicator to my chart and it actually works differently and does not plot data for NOV and DEC.
    It’s more difficult for me to modify an exixting code, so I will try to make a new one as soon as I have some time.

    #175332 quote
    snucke
    Participant
    Veteran

    Thank you! this indicator has given me alot, and im very sad it stopped working, so if you could fix it i would be very happy 🙂

    yes it is very weird indeed, on some instruments it only plots the text JAN and nothing else.

    #175337 quote
    JC_Bywan
    Moderator
    Master

    To prevent undefined values messing up calculations, you can replace line 25:

    $total[mydate] = $total[mydate] + diff

    with:

    if mydate>LastSet($total) then
      $total[mydate] = diff
    else
      $total[mydate] = $total[mydate] + diff
    endif
    #175390 quote
    snucke
    Participant
    Veteran

    ok, unfortunately it did not solve the problem JC_bywan

    #175392 quote
    JC_Bywan
    Moderator
    Master

    Hi, ok, it did when I tried it, so I guess there’s more there’s another problem too not always appearing. Could you please give the details of the case still not working for you (asset, timeframe daily? dates used, values for each of the 4 settings, screen capture) so that we try to replicate the same case and find the next issue from there? Thanks

    #175493 quote
    snucke
    Participant
    Veteran

    okay, it seems to work now JC_bywan

    i had it set to 0 and 0 to show max time on the instrument as it worked before.

    but now when i set exact dates it seems to work!

    thank you!

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

Seasonality curve not working


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
snucke @snucke Participant
Summary

This topic contains 7 replies,
has 3 voices, and was last updated by snucke
4 years, 5 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 06/28/2021
Status: Active
Attachments: 1 files
Logo Logo
Loading...