Seasonal Indicator
Forums › ProRealTime English forum › ProBuilder support › Seasonal Indicator
- This topic has 8 replies, 3 voices, and was last updated 7 years ago by Ivan Donatiello.
-
-
11/16/2016 at 12:09 PM #16637
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?
11/16/2016 at 12:32 PM #1664311/16/2016 at 1:37 PM #1665011/16/2016 at 2:05 PM #16651Ok, 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:
- 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)
- 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
11/19/2016 at 2:51 PM #16804Thanks for the reply,
I can not run the code, I do not validation. audience below so if possible ask for help 🙂
123456789101112131415161718192021222324252627// Variablen (ganze Zahl / >0)// sJahr = einzelnesJahr = 2000display = Currentyear - 1If sJahr <= display ThenOnce a = 0If Year >= sJahr Thena = a + 1EndifIf Year = display Thena = a - 1c = Close[a]Elsec = undefinedEndifdiff = (c - c[1]) / c[1]If Year = display And Year[1] <> display Thenp = 1linie = 100Elsep = diff + 1linie=linie[1] * pEndifElselinie = undefinedEndifReturn linie Coloured(0,0,255) As "einzelnesJahr"And this the second part:
12345678910111213141516// Variablen (ganze Zahl / >0)// v = "von..." = 2000// b = "bis..." = 2010t = b - vz = 0For i = 1 to t DOy1 = CALL "mySeasonal_einzeln"[(v+i)-1]z = z + y1Nextxx = z / tIf Year >= CurrentYear -1 Thenstart = 100Elsestart = undefinedEndifReturn xx Coloured(0,0,260) As "Seasonal", start Coloured(255,0,0) As "100"11/21/2016 at 9:33 AM #1688211/25/2016 at 8:02 PM #17199I 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 🙂
11/25/2016 at 8:25 PM #17200The first indicator with the changes made in the code below works, what one year:
123456789101112131415161718192021222324252627// variables (integer / >0)// year = single year = 2000display = Currentyear - 0If year <= display ThenOnce a = 0If Year >= year Thena = a + 1EndifIf Year = display Thena = a - 1c = Close[a]Elsec = undefinedEndifdiff = (c - c[1]) / c[1]If Year = display And Year[1] <> display Thenp = 1linie = 100Elsep = diff + 1linie=linie[1] * pEndifElselinie = undefinedEndifReturn linie Coloured(0,0,255) As "single year"11/25/2016 at 8:29 PM #17201The second still not, it gives me the error picture attached:
12345678910111213141516// Variables (integer / >0)// v = "from..." = 2000// b = "to..." = 2016t = b - vz = 0For i = 1 to t DOy1 = CALL "Seasonal 1 Year"[(v+i)-1]z = z + y1Nextxx = z / tIf Year >= CurrentYear -1 Thenstart = 100Elsestart = undefinedEndifReturn 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 :/
-
AuthorPosts
Find exclusive trading pro-tools on