Seasonal Indicator

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #16637 quote
    Ivan DonatielloIvan Donatiello
    Participant
    Average
    Hello everyone, I introduce myself, my name is Ivan and are currently interested in carrying out research on seasonality. For this I am interested in creating a indicator that the average price calculations me of a time series in n periods, the chart result should be something like this in image. Somebody has what idea or has already implemented this type of indicator?
    seasonal-ng-1.jpg seasonal-ng-1.jpg
    #16643 quote
    JC_BywanJC_Bywan
    Moderator
    Master
    Hi,

    >> Please update your country flag in your profile. Thank you 🙂 <<

    (see attached file if necessary)
    UpdateCountryFlag.jpg UpdateCountryFlag.jpg
    #16650 quote
    NicolasNicolas
    Keymaster
    Legend
    If I remember well, I already came across some kind of seasonal cycle indicator on another website, let me find it and post it here (and please update your profile!).
    #16651 quote
    NicolasNicolas
    Keymaster
    Legend
    Ok, here is what I found so far in a German forum in an old topic. This is very nicely done and well coded, I translated the terms to perfectly understand how it works and the calculation and made some modification for display, the indicator come in 2 parts:
    1. seasonal_oneyear : the purpose of this indicator is to display a previous “startyear” on the chart, overlaid or not on the price. I introduce the “decay” variable to display it over the current year (decay=0) or over the last year period (decay=1). Very useful if you want to know where were the price at the same time, on “startyear” (year 2000 by default set in the parameter)
    2. seasonal_cycle : this indicator make the loop from “first” year to “last” year for the seasonal cycle computation, it needs “seasonal_oneyear” indicator to run. This is the only one needed to display the seasonal cycle if you only want this information on your chart.
    You’ll find both of this files attached, with some screenshots examples. The first picture show the year 2000 price fluctuation under the current year (decay=0) The second one display the seasonal cycle calculated from 2000 to 2015 on DAX. with great respect, the original indicators came from: http://www.aktienboard.com/forum/f29/prorealtime-cmc-script-programmierung-t94783/262#post2540310
    seasonal_cycle.itf seasonal_oneyear.itf year-2000.png year-2000.png seasonal-indicator-prorealtime.png seasonal-indicator-prorealtime.png
    #16804 quote
    Ivan DonatielloIvan Donatiello
    Participant
    Average

    Thanks for the reply,

    I can not run the code, I do not validation. audience below so if possible ask for help 🙂

     

    // Variablen (ganze Zahl / >0)
    // sJahr = einzelnesJahr = 2000
    
    display = Currentyear - 1
    If sJahr <= display Then
    	Once a = 0
    	If Year >= sJahr Then
    		a = a + 1
    	Endif
    	If Year = display  Then
    		a = a - 1
    		c = Close[a]
    	Else
    		c = undefined
    	Endif
    	diff = (c - c[1]) / c[1]
    	If Year = display And Year[1] <> display Then
    		p = 1
    		linie = 100
    	Else
    		p = diff + 1
    		linie=linie[1] * p
    	Endif
    Else
    	linie = undefined
    Endif
    Return linie Coloured(0,0,255) As "einzelnesJahr"

     

    And this the second part:

    // Variablen (ganze Zahl / >0)
    // v = "von..." = 2000
    // b = "bis..." = 2010
    t = b - v
    z = 0
    For i = 1 to t DO
    	y1 =  CALL "mySeasonal_einzeln"[(v+i)-1]
    	z = z + y1
    Next
    xx = z / t
    If Year >= CurrentYear -1 Then
    	start = 100
    Else
    	start = undefined
    Endif
    Return xx Coloured(0,0,260) As "Seasonal", start Coloured(255,0,0) As "100"

     

    #16882 quote
    NicolasNicolas
    Keymaster
    Legend
    That’s why I changed the code, you have to download the files attached to my previous post and use these ones instead of the original topic one.
    #17199 quote
    Ivan DonatielloIvan Donatiello
    Participant
    Average
    I understand, can I ask you please let you load your code here that works for you. I appreciate it, are not very good at programming. If you can thanks 1000 🙂
    #17200 quote
    Ivan DonatielloIvan Donatiello
    Participant
    Average
    The first indicator with the changes made in the code below works, what one year:  
    // variables (integer / >0)
    // year = single year = 2000
    
    display = Currentyear - 0
    If year <= display Then
    Once a = 0
    If Year >= year Then
    a = a + 1
    Endif
    If Year = display  Then
    a = a - 1
    c = Close[a]
    Else
    c = undefined
    Endif
    diff = (c - c[1]) / c[1]
    If Year = display And Year[1] <> display Then
    p = 1
    linie = 100
    Else
    p = diff + 1
    linie=linie[1] * p
    Endif
    Else
    linie = undefined
    Endif
    Return linie Coloured(0,0,255) As "single year"
    #17201 quote
    Ivan DonatielloIvan Donatiello
    Participant
    Average
    The second still not, it gives me the error picture attached:  
    // Variables (integer / >0)
    // v = "from..." = 2000
    // b = "to..." = 2016
    t = b - v
    z = 0
    For i = 1 to t DO
    y1 =  CALL "Seasonal 1 Year"[(v+i)-1]
    z = z + y1
    Next
    xx = z / t
    If Year >= CurrentYear -1 Then
    start = 100
    Else
    start = undefined
    Endif
    Return xx Coloured(0,0,260) As "Seasonal", start Coloured(255,0,0) As "100"
        the wording is: Syntax error: define the variable b define the variable v It seems to me that in the code are defined :/
    img-code-seasonal.jpg img-code-seasonal.jpg
Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

Seasonal Indicator


ProBuilder: Indicators & Custom Tools

New Reply
Author
Summary

This topic contains 8 replies,
has 3 voices, and was last updated by Ivan DonatielloIvan Donatiello
9 years, 10 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 11/16/2016
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...