TradeStation - Weekly Universal Seasonality Indicator V1.
futures io


Categories Help    

TradeStation
TradeStation Downloads / TradeStation Indicators

Share TradeStation indicators, EasyLanguage indicators.


Entries
Weekly Universal Seasonality Indicator V1. 5 *
I have worked with long terms seasonals for a while as part of developing a futures portfolio system - hopefully for institutional clients at some point.

Although never used for the system, it was an attempt to almost eliminate optimization by applying a universal seasonal indicator to every instrument. It actually works, and well, the results were not good enough for me and so although I use it as a visual indicator, it is not part of any entry rule algorithm.

Ideally, this would be coded in arrays but I lack the skills to work with them in a context that combines text and numbers. Over my pay grade coding-wise!

In any case, it tracks the percentage move each week (this only works on weekly charts) and then puts them together in such a way that when an RSI of those values is plotted it instantly reveals whether or not there are regular or particular seasonal patterns.

In the picture attached you will see signals generated from a different seasonal system (part of my portfolio system) that has 59% successful trades going back over more then 20 years with 7% max drawdown. Not bad. But on the picture you can see the signals and compare how the indicator reads at the same time. As you can see, they are often in agreement. And this indicator will plot automatically on any weekly chart instantly revealing whether or not there are significant seasonal tendencies.

I suspect the same type of approach could be used for daily and intraday charts, albeit with the latter you might be looking for days-of-the-week, and/or hours of the day type behavior. Again, ability to code in arrays is key.

For those not using Tradestation, I paste in the code below.

Note on the picture: there is also an Equity indicator that shows current account balance from starting balance input, current trade P/L, current drawdown from maximum account high, and during DD's the histogram bars get progressively darker. It can also assume compounding in terms of the percentage drawdowns (i.e. of starting balance or the current balance after many years).

The ATR indicator shows either $$ or percentage of instrument ATR and also includes a money-management formula recommending nr. of contracts to trade.

If anyone wants either of these, let me know and I will gladly post them here.

PS. I am hoping some enterprising coder will want to translate this into Ninja script and/or use this as an kick starter to look into day-of-week or time-of-day type analysis. It's not rocket science, but you need to be good at coding arrays which I am not.

+++++++++++++++++++++

Pasted in Code

Indicator:
+++++++++++++++++++++


{***************************************
Written by: ccl-trading-systems.com
Description: Seasonal Indicator without Loop but using new Function
****************************************}
inputs: Rsilen(9),RunorNew(false),highline(70),lowline(30);
vars: runline(0),av(0),slow(0),count(0),slower(0),newrun(0),rsiline(0);

If currentbar >=43 then Begin

runline = VSeasRun2;
if (runline > 0 and runline[1] > 0) or (runline < 0 and runline[1] < 0) then newrun = runline + newrun[1] else newrun = runline;

If RunorNew then slow = averagefc(runline,3) else slow = averagefc(newrun,3);
rsiline = rsi(slow,rsilen);


vars: color(0);
Color = month(d); if color = 1 then color = darkgray;

Plot1 (highline,"hiline",lightgray);
Plot2(lowline,"lowline",lightgray);
Plot3 (50,"0line",color);
Plot4 (rsiline,"rsi-seas",color,color,1);


End; {current bar}

+++++++++++++++++++++++++++

Function:

+++++++++++++++++++++++++++

{***************************************
Written by: ccl-trading-systems.com
Description: Seasonal Indicator without Arrays, last 10 times attempt
****************************************}



vars: TDN(500),SDay(0);
vars:
TDNTot1(0),Count1(0),TDNAv1(0),
TDNTot2(0),Count2(0),TDNAv2(0),
TDNTot3(0),Count3(0),TDNAv3(0),
TDNTot4(0),Count4(0),TDNAv4(0),
TDNTot5(0),Count5(0),TDNAv5(0),
TDNTot6(0),Count6(0),TDNAv6(0),
TDNTot7(0),Count7(0),TDNAv7(0),
TDNTot8(0),Count8(0),TDNAv8(0),
TDNTot9(0),Count9(0),TDNAv9(0),
TDNTot10(0),Count10(0),TDNAv10(0),
TDNTot11(0),Count11(0),TDNAv11(0),
TDNTot12(0),Count12(0),TDNAv12(0),
TDNTot13(0),Count13(0),TDNAv13(0),
TDNTot14(0),Count14(0),TDNAv14(0),
TDNTot15(0),Count15(0),TDNAv15(0),
TDNTot16(0),Count16(0),TDNAv16(0),
TDNTot17(0),Count17(0),TDNAv17(0),
TDNTot18(0),Count18(0),TDNAv18(0),
TDNTot19(0),Count19(0),TDNAv19(0),
TDNTot20(0),Count20(0),TDNAv20(0),
TDNTot21(0),Count21(0),TDNAv21(0),
TDNTot22(0),Count22(0),TDNAv22(0),
TDNTot23(0),Count23(0),TDNAv23(0),
TDNTot24(0),Count24(0),TDNAv24(0),
TDNTot25(0),Count25(0),TDNAv25(0),
TDNTot26(0),Count26(0),TDNAv26(0),
TDNTot27(0),Count27(0),TDNAv27(0),
TDNTot28(0),Count28(0),TDNAv28(0),
TDNTot29(0),Count29(0),TDNAv29(0),
TDNTot30(0),Count30(0),TDNAv30(0),
TDNTot31(0),Count31(0),TDNAv31(0),
TDNTot32(0),Count32(0),TDNAv32(0),
TDNTot33(0),Count33(0),TDNAv33(0),
TDNTot34(0),Count34(0),TDNAv34(0),
TDNTot35(0),Count35(0),TDNAv35(0),
TDNTot36(0),Count36(0),TDNAv36(0),
TDNTot37(0),Count37(0),TDNAv37(0),
TDNTot38(0),Count38(0),TDNAv38(0),
TDNTot39(0),Count39(0),TDNAv39(0),
TDNTot40(0),Count40(0),TDNAv40(0),
TDNTot41(0),Count41(0),TDNAv41(0),
TDNTot42(0),Count42(0),TDNAv42(0),
TDNTot43(0),Count43(0),TDNAv43(0),
TDNTot44(0),Count44(0),TDNAv44(0),
TDNTot45(0),Count45(0),TDNAv45(0),
TDNTot46(0),Count46(0),TDNAv46(0),
TDNTot47(0),Count47(0),TDNAv47(0),
TDNTot48(0),Count48(0),TDNAv48(0),
TDNTot49(0),Count49(0),TDNAv49(0),
TDNTot50(0),Count50(0),TDNAv50(0),
TDNTot51(0),Count51(0),TDNAv51(0),
TDNTot52(0),Count52(0),TDNAv52(0),
TDNTot53(0),Count53(0),TDNAv53(0),
TDNTot54(0),Count54(0),TDNAv54(0);


If currentbar >=43 then Begin

If year(d)>(year(d))[1] then TDN = 0; TDN = TDN+1;


{SDay = (c-c[1])/c[1]*100 ;}
SDay = ((c-c[1])/c[1]) ;

If TDN = 1 then begin TDNTot1 = TDNTot1 + Sday; Count1 = Count1+1; TDNAv1 = TDNTot1/Count1; end;
If TDN = 2 then begin TDNTot2 = TDNTot2 + Sday; Count2 = Count2+1; TDNAv2 = TDNTot2/Count2; end;
If TDN = 3 then begin TDNTot3 = TDNTot3 + Sday; Count3 = Count3+1; TDNAv3 = TDNTot3/Count3; end;
If TDN = 4 then begin TDNTot4 = TDNTot4 + Sday; Count4 = Count4+1; TDNAv4 = TDNTot4/Count4; end;
If TDN = 5 then begin TDNTot5 = TDNTot5 + Sday; Count5 = Count5+1; TDNAv5 = TDNTot5/Count5; end;
If TDN = 6 then begin TDNTot6 = TDNTot6 + Sday; Count6 = Count6+1; TDNAv6 = TDNTot6/Count6; end;
If TDN = 7 then begin TDNTot7 = TDNTot7 + Sday; Count7 = Count7+1; TDNAv7 = TDNTot7/Count7; end;
If TDN = 8 then begin TDNTot8 = TDNTot8 + Sday; Count8 = Count8+1; TDNAv8 = TDNTot8/Count8; end;
If TDN = 9 then begin TDNTot9 = TDNTot9 + Sday; Count9 = Count9+1; TDNAv9 = TDNTot9/Count9; end;
If TDN = 10 then begin TDNTot10 = TDNTot10 + Sday; Count10 = Count10+1; TDNAv10 = TDNTot10/Count10; end;
If TDN = 11 then begin TDNTot11 = TDNTot11 + Sday; Count11 = Count11+1; TDNAv11 = TDNTot11/Count11; end;
If TDN = 12 then begin TDNTot12 = TDNTot12 + Sday; Count12 = Count12+1; TDNAv12 = TDNTot12/Count12; end;
If TDN = 13 then begin TDNTot13 = TDNTot13 + Sday; Count13 = Count13+1; TDNAv13 = TDNTot13/Count13; end;
If TDN = 14 then begin TDNTot14 = TDNTot14 + Sday; Count14 = Count14+1; TDNAv14 = TDNTot14/Count14; end;
If TDN = 15 then begin TDNTot15 = TDNTot15 + Sday; Count15 = Count15+1; TDNAv15 = TDNTot15/Count15; end;
If TDN = 16 then begin TDNTot16 = TDNTot16 + Sday; Count16 = Count16+1; TDNAv16 = TDNTot16/Count16; end;
If TDN = 17 then begin TDNTot17 = TDNTot17 + Sday; Count17 = Count17+1; TDNAv17 = TDNTot17/Count17; end;
If TDN = 29 then begin TDNTot18 = TDNTot18 + Sday; Count18 = Count18+1; TDNAv18 = TDNTot18/Count18; end;
If TDN = 29 then begin TDNTot19 = TDNTot19 + Sday; Count19 = Count19+1; TDNAv19 = TDNTot19/Count19; end;
If TDN = 20 then begin TDNTot20 = TDNTot20 + Sday; Count20 = Count20+1; TDNAv20 = TDNTot20/Count20; end;
If TDN = 21 then begin TDNTot21 = TDNTot21 + Sday; Count21 = Count21+1; TDNAv21 = TDNTot21/Count21; end;
If TDN = 22 then begin TDNTot22 = TDNTot22 + Sday; Count22 = Count22+1; TDNAv22 = TDNTot22/Count22; end;
If TDN = 23 then begin TDNTot23 = TDNTot23 + Sday; Count23 = Count23+1; TDNAv23 = TDNTot23/Count23; end;
If TDN = 24 then begin TDNTot24 = TDNTot24 + Sday; Count24 = Count24+1; TDNAv24 = TDNTot24/Count24; end;
If TDN = 25 then begin TDNTot25 = TDNTot25 + Sday; Count25 = Count25+1; TDNAv25 = TDNTot25/Count25; end;
If TDN = 26 then begin TDNTot26 = TDNTot26 + Sday; Count26 = Count26+1; TDNAv26 = TDNTot26/Count26; end;
If TDN = 27 then begin TDNTot27 = TDNTot27 + Sday; Count27 = Count27+1; TDNAv27 = TDNTot27/Count27; end;
If TDN = 28 then begin TDNTot28 = TDNTot28 + Sday; Count28 = Count28+1; TDNAv28 = TDNTot28/Count28; end;
If TDN = 29 then begin TDNTot29 = TDNTot29 + Sday; Count29 = Count29+1; TDNAv29 = TDNTot29/Count29; end;
If TDN = 30 then begin TDNTot30 = TDNTot30 + Sday; Count30 = Count30+1; TDNAv30 = TDNTot30/Count30; end;
If TDN = 31 then begin TDNTot31 = TDNTot31 + Sday; Count31 = Count31+1; TDNAv31 = TDNTot31/Count31; end;
If TDN = 32 then begin TDNTot32 = TDNTot32 + Sday; Count32 = Count32+1; TDNAv32 = TDNTot32/Count32; end;
If TDN = 33 then begin TDNTot33 = TDNTot33 + Sday; Count33 = Count33+1; TDNAv33 = TDNTot33/Count33; end;
If TDN = 34 then begin TDNTot34 = TDNTot34 + Sday; Count34 = Count34+1; TDNAv34 = TDNTot34/Count34; end;
If TDN = 35 then begin TDNTot35 = TDNTot35 + Sday; Count35 = Count35+1; TDNAv35 = TDNTot35/Count35; end;
If TDN = 36 then begin TDNTot36 = TDNTot36 + Sday; Count36 = Count36+1; TDNAv36 = TDNTot36/Count36; end;
If TDN = 37 then begin TDNTot37 = TDNTot37 + Sday; Count37 = Count37+1; TDNAv37 = TDNTot37/Count37; end;
If TDN = 38 then begin TDNTot38 = TDNTot38 + Sday; Count38 = Count38+1; TDNAv38 = TDNTot38/Count38; end;
If TDN = 39 then begin TDNTot39 = TDNTot39 + Sday; Count39 = Count39+1; TDNAv39 = TDNTot39/Count39; end;
If TDN = 40 then begin TDNTot40 = TDNTot40 + Sday; Count40 = Count40+1; TDNAv40 = TDNTot40/Count40; end;
If TDN = 41 then begin TDNTot41 = TDNTot41 + Sday; Count41 = Count41+1; TDNAv41 = TDNTot41/Count41; end;
If TDN = 42 then begin TDNTot42 = TDNTot42 + Sday; Count42 = Count42+1; TDNAv42 = TDNTot42/Count42; end;
If TDN = 43 then begin TDNTot43 = TDNTot43 + Sday; Count43 = Count43+1; TDNAv43 = TDNTot43/Count43; end;
If TDN = 44 then begin TDNTot44 = TDNTot44 + Sday; Count44 = Count44+1; TDNAv44 = TDNTot44/Count44; end;
If TDN = 45 then begin TDNTot45 = TDNTot45 + Sday; Count45 = Count45+1; TDNAv45 = TDNTot45/Count45; end;
If TDN = 46 then begin TDNTot46 = TDNTot46 + Sday; Count46 = Count46+1; TDNAv46 = TDNTot46/Count46; end;
If TDN = 47 then begin TDNTot47 = TDNTot47 + Sday; Count47 = Count47+1; TDNAv47 = TDNTot47/Count47; end;
If TDN = 48 then begin TDNTot48 = TDNTot48 + Sday; Count48 = Count48+1; TDNAv48 = TDNTot48/Count48; end;
If TDN = 49 then begin TDNTot49 = TDNTot49 + Sday; Count49 = Count49+1; TDNAv49 = TDNTot49/Count49; end;
If TDN = 50 then begin TDNTot50 = TDNTot50 + Sday; Count50 = Count50+1; TDNAv50 = TDNTot50/Count50; end;
If TDN = 51 then begin TDNTot51 = TDNTot51 + Sday; Count51 = Count51+1; TDNAv51 = TDNTot51/Count51; end;
If TDN = 52 then begin TDNTot52 = TDNTot52 + Sday; Count52 = Count52+1; TDNAv52 = TDNTot52/Count52; end;
If TDN = 53 then begin TDNTot53 = TDNTot53 + Sday; Count53 = Count53+1; TDNAv53 = TDNTot53/Count53; end;
If TDN = 54 then begin TDNTot54 = TDNTot54 + Sday; Count54 = Count54+1; TDNAv54 = TDNTot54/Count54; end;

vars: runline(0),runlineav(0);

If TDN = 1 then begin Runline = TDNAv1; runlineav = averagefc(tdnav1,10); end;
If TDN = 2 then begin Runline = TDNAv2; runlineav = averagefc(tdnav2,10);end;
If TDN = 3 then begin Runline = TDNAv3; runlineav = averagefc(tdnav3,10);end;
If TDN = 4 then begin Runline = TDNAv4; runlineav = averagefc(tdnav4,10);end;
If TDN = 5 then begin Runline = TDNAv5; runlineav = averagefc(tdnav5,10);end;
If TDN = 6 then begin Runline = TDNAv6; runlineav = averagefc(tdnav6,10);end;
If TDN = 7 then begin Runline = TDNAv7; runlineav = averagefc(tdnav7,10);end;
If TDN = 8 then begin Runline = TDNAv8; runlineav = averagefc(tdnav8,10);end;
If TDN = 9 then begin Runline = TDNAv9; runlineav = averagefc(tdnav9,10);end;
If TDN = 10 then begin Runline = TDNAv10; runlineav = averagefc(tdnav10,10); end;
If TDN = 11 then begin Runline = TDNAv11; runlineav = averagefc(tdnav11,10); end;
If TDN = 12 then begin Runline = TDNAv12; runlineav = averagefc(tdnav12,10); end;
If TDN = 13 then begin Runline = TDNAv13; runlineav = averagefc(tdnav13,10); end;
If TDN = 14 then begin Runline = TDNAv14; runlineav = averagefc(tdnav14,10); end;
If TDN = 15 then begin Runline = TDNAv15; runlineav = averagefc(tdnav15,10); end;
If TDN = 16 then begin Runline = TDNAv16; runlineav = averagefc(tdnav16,10); end;
If TDN = 17 then begin Runline = TDNAv17; runlineav = averagefc(tdnav17,10); end;
If TDN = 18 then begin Runline = TDNAv18; runlineav = averagefc(tdnav18,10); end;
If TDN = 19 then begin Runline = TDNAv19; runlineav = averagefc(tdnav19,10); end;
If TDN = 20 then begin Runline = TDNAv20; runlineav = averagefc(tdnav20,10); end;
If TDN = 21 then begin Runline = TDNAv21; runlineav = averagefc(tdnav21,10); end;
If TDN = 22 then begin Runline = TDNAv22; runlineav = averagefc(tdnav22,10); end;
If TDN = 23 then begin Runline = TDNAv23; runlineav = averagefc(tdnav23,10); end;
If TDN = 24 then begin Runline = TDNAv24; runlineav = averagefc(tdnav24,10); end;
If TDN = 25 then begin Runline = TDNAv25; runlineav = averagefc(tdnav25,10); end;
If TDN = 26 then begin Runline = TDNAv26; runlineav = averagefc(tdnav26,10); end;
If TDN = 27 then begin Runline = TDNAv27; runlineav = averagefc(tdnav27,10); end;
If TDN = 28 then begin Runline = TDNAv28; runlineav = averagefc(tdnav28,10); end;
If TDN = 29 then begin Runline = TDNAv29; runlineav = averagefc(tdnav29,10); end;
If TDN = 30 then begin Runline = TDNAv30; runlineav = averagefc(tdnav30,10); end;
If TDN = 31 then begin Runline = TDNAv31; runlineav = averagefc(tdnav31,10); end;
If TDN = 32 then begin Runline = TDNAv32; runlineav = averagefc(tdnav32,10); end;
If TDN = 33 then begin Runline = TDNAv33; runlineav = averagefc(tdnav33,10); end;
If TDN = 34 then begin Runline = TDNAv34; runlineav = averagefc(tdnav34,10); end;
If TDN = 35 then begin Runline = TDNAv35; runlineav = averagefc(tdnav35,10); end;
If TDN = 36 then begin Runline = TDNAv36; runlineav = averagefc(tdnav36,10); end;
If TDN = 37 then begin Runline = TDNAv37; runlineav = averagefc(tdnav37,10); end;
If TDN = 38 then begin Runline = TDNAv38; runlineav = averagefc(tdnav38,10); end;
If TDN = 39 then begin Runline = TDNAv39; runlineav = averagefc(tdnav39,10); end;
If TDN = 40 then begin Runline = TDNAv40; runlineav = averagefc(tdnav40,10); end;
If TDN = 41 then begin Runline = TDNAv41; runlineav = averagefc(tdnav41,10); end;
If TDN = 42 then begin Runline = TDNAv42; runlineav = averagefc(tdnav42,10); end;
If TDN = 43 then begin Runline = TDNAv43; runlineav = averagefc(tdnav43,10); end;
If TDN = 44 then begin Runline = TDNAv44; runlineav = averagefc(tdnav44,10); end;
If TDN = 45 then begin Runline = TDNAv45; runlineav = averagefc(tdnav45,10); end;
If TDN = 46 then begin Runline = TDNAv46; runlineav = averagefc(tdnav46,10); end;
If TDN = 47 then begin Runline = TDNAv47; runlineav = averagefc(tdnav47,10); end;
If TDN = 48 then begin Runline = TDNAv48; runlineav = averagefc(tdnav48,10); end;
If TDN = 49 then begin Runline = TDNAv49; runlineav = averagefc(tdnav49,10); end;
If TDN = 50 then begin Runline = TDNAv50; runlineav = averagefc(tdnav50,10); end;
If TDN = 51 then begin Runline = TDNAv51; runlineav = averagefc(tdnav51,10); end;
If TDN = 52 then begin Runline = TDNAv52; runlineav = averagefc(tdnav52,10); end;
If TDN = 53 then begin Runline = TDNAv53; runlineav = averagefc(tdnav53,10); end;
If TDN = 54 then begin Runline = TDNAv54; runlineav = averagefc(tdnav54,10); end;

End; {current bar}

VSeasRun2 = runline;


Category TradeStation 
 
Suggest other entries I might like
Details: Weekly Universal Seasonality Indicator V1.
Category: TradeStation 


November 22nd, 2009
Size: 18.38 KB
Downloaded: 641 times

Keywords: tradestation
 


 
Category
 



Copyright © 2021 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada), info@futures.io
All information is for educational use only and is not investment advice.
There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.