Seasonality Lower Study?

BiggySmall

New member

Here's an image of a TOS 20Y Daily Seasonality chart (price shown as percentage).
Can this chart be coded with thinkscript to look just like this, as a lower study?
I ask so that I can possibly add additional code/studies/ect. The default TOS Seasonality chart doesn't allow any changes.
Thanks.
 
This is my seasonal Analysis script that I use.
It is for the past 5 years and shows label with percentage and is colored.

It does not show lines..

Code:
#Only use on a daily chart.
AddLabel(yes, "5 Year Seasonal Analysis", color.YELLOW);



#January
def jan = getmonth() == 1;
def janopen = if jan and !jan[1] then open else janopen[1];
def janclose = if jan and !jan[-1] then close else janclose[1];
def jandiff = if jan and !jan[-1] then (janclose-janopen)/janopen else 0;
def janup = totalsum( if jan and !jan[-1] and jandiff > 0 then 1 else 0);
def jandown = totalsum ( if jan and !jan[-1] and jandiff <= 0 then 1 else 0);
def jantotalcount = totalsum(jan and !jan[-1]);
def janavgdiff = totalsum(jandiff)/jantotalcount;

Addlabel(yes, "Jan Avg: " + aspercent( janup/jantotalcount) + " | " + aspercent(janavgdiff), if(janup/jantotalcount) > 0.5 and janavgdiff > 0 then color.green else color.red);

#addchartbubble(jan, close jandiff, color.yellow);
#addchartbubble(mar, close jandiff, color.yellow);

#February
def feb = getmonth() == 2;
def febopen = if feb and !feb[1] then open else febopen[1];
def febclose = if feb and feb[-1] then close else febclose[1];
def febdiff = if feb and !feb[-1] then (febclose-febopen)/febopen else 0;
def febup = totalsum( if feb and !feb[-1] and febdiff > 0 then 1 else 0);
def febdown = totalsum ( if feb and !feb[-1] and febdiff <= 0 then 1 else 0);
def febtotalcount = totalsum(feb and !feb[-1]);
def febavgdiff = totalsum(febdiff)/febtotalcount;

Addlabel(yes, "February Avg: " + aspercent( febup/febtotalcount) + " | " + aspercent(febavgdiff), if(febup/febtotalcount) > 0.5 and febavgdiff > 0 then color.green else color.red);

#addchartbubble(feb, close jandiff, color.yellow);

#MARCH
def mar = getmonth() == 3;
def maropen = if mar and !mar[1] then open else maropen[1];
def marclose = if mar and mar[-1] then close else marclose[1];
def mardiff = if mar and !mar[-1] then (marclose-maropen)/maropen else 0;
def marup = totalsum( if mar and !mar[-1] and mardiff > 0 then 1 else 0);
def mardown = totalsum ( if mar and !mar[-1] and mardiff <= 0 then 1 else 0);
def martotalcount = totalsum(mar and !mar[-1]);
def maravgdiff = totalsum(mardiff)/martotalcount;

Addlabel(yes, "March Avg: " + aspercent( marup/martotalcount) + " | " + aspercent(maravgdiff), if(marup/martotalcount) > 0.5 and maravgdiff > 0 then color.green else color.red);
#addchartbubble(mar, close jandiff, color.yellow);

#APRIL
def apr = getmonth() == 4;
def apropen = if apr and !apr[1] then open else apropen[1];
def aprclose = if apr and !apr[-1] then close else aprclose[1];
def aprdiff = if apr and !apr[-1] then (aprclose-apropen)/apropen else 0;
def aprup = totalsum( if apr and !apr[-1] and aprdiff > 0 then 1 else 0);
def aprdown = totalsum ( if apr and !apr[-1] and aprdiff <= 0 then 1 else 0);
def aprtotalcount = totalsum(apr and !apr[-1]);
def apravgdiff = totalsum(aprdiff)/aprtotalcount;

Addlabel(yes, "April Avg: " + aspercent( aprup/aprtotalcount) + " | " + aspercent(apravgdiff), if(aprup/aprtotalcount) > 0.5 and apravgdiff > 0 then color.green else color.red);
#addchartbubble(apr, close jandiff, color.yellow);


#MAY
def may = getmonth() == 5;
def  mayopen = if  may and ! may[1] then open else  mayopen[1];
def  mayclose = if  may and ! may[-1] then close else mayclose[1];
def  maydiff = if  may and ! may[-1] then ( mayclose- mayopen)/ mayopen else 0;
def  mayup = totalsum( if  may and ! may[-1] and  maydiff > 0 then 1 else 0);
def  maydown = totalsum ( if  may and ! may[-1] and  maydiff <= 0 then 1 else 0);
def  maytotalcount = totalsum( may and ! may[-1]);
def  mayavgdiff = totalsum( maydiff)/ maytotalcount;

Addlabel(yes, "May Avg: " + aspercent(  mayup/ maytotalcount) + " | " + aspercent( mayavgdiff), if( mayup/ maytotalcount) > 0.5 and  mayavgdiff > 0 then color.green else color.red);
#addchartbubble(may, close jandiff, color.yellow);


#June
def Jun = getmonth() == 6;
def Junopen = if Jun and !Jun[1] then open else Junopen[1];
def Junclose = if Jun and Jun[-1] then close else Junclose[1];
def Jundiff = if Jun and !Jun[-1] then (Junclose-Junopen)/Junopen else 0;
def Junup = totalsum( if Jun and !Jun[-1] and Jundiff > 0 then 1 else 0);
def Jundown = totalsum ( if Jun and !Jun[-1] and Jundiff <= 0 then 1 else 0);
def Juntotalcount = totalsum(Jun and !Jun[-1]);
def Junavgdiff = totalsum(Jundiff)/Juntotalcount;

Addlabel(yes, "June Avg: " + aspercent( Junup/Juntotalcount) + " | " + aspercent(Junavgdiff), if(Junup/Juntotalcount) > 0.5 and Junavgdiff > 0 then color.green else color.red);
#addchartbubble(jun, close jandiff, color.yellow);


#July
def jul = getmonth() == 7;
def  julopen = if  jul and ! jul[1] then open else  julopen[1];
def  julclose = if  jul and  jul[-1] then close else  julclose[1];
def  juldiff = if  jul and ! jul[-1] then ( julclose- julopen)/ julopen else 0;
def  julup = totalsum( if  jul and ! jul[-1] and  juldiff > 0 then 1 else 0);
def  juldown = totalsum ( if  jul and ! jul[-1] and  juldiff <= 0 then 1 else 0);
def  jultotalcount = totalsum( jul and ! jul[-1]);
def  julavgdiff = totalsum( juldiff)/ jultotalcount;

Addlabel(yes, "July Avg: " + aspercent(  julup/ jultotalcount) + " | " + aspercent( julavgdiff), if( julup/ jultotalcount) > 0.5 and  julavgdiff > 0 then color.green else color.red);
#addchartbubble(jul, close jandiff, color.yellow);


#August
def aug = getmonth() == 8;
def  augopen = if  aug and ! aug[1] then open else  augopen[1];
def  augclose = if  aug and ! aug[-1] then close else  augclose[1];
def  augdiff = if  aug and ! aug[-1] then ( augclose- augopen)/ augopen else 0;
def  augup = totalsum( if  aug and ! aug[-1] and  augdiff > 0 then 1 else 0);
def  augdown = totalsum ( if  aug and ! aug[-1] and  augdiff <= 0 then 1 else 0);
def  augtotalcount = totalsum( aug and ! aug[-1]);
def  augavgdiff = totalsum( augdiff)/ augtotalcount;

Addlabel(yes, "August Avg: " + aspercent(  augup/ augtotalcount) + " | " + aspercent( augavgdiff), if( augup/ augtotalcount) > 0.5 and  augavgdiff > 0 then color.green else color.red);
#addchartbubble(aug, close jandiff, color.yellow);

#September
def sep = getmonth() == 9;
def sepopen = if sep and !sep[1] then open else sepopen[1];
def sepclose = if sep and !sep[-1] then close else sepclose[1];
def sepdiff = if sep and !sep[-1] then (sepclose-sepopen)/sepopen else 0;
def sepup = totalsum( if sep and !sep[-1] and sepdiff > 0 then 1 else 0);
def sepdown = totalsum ( if sep and !sep[-1] and sepdiff <= 0 then 1 else 0);
def septotalcount = totalsum(sep and !sep[-1]);
def sepavgdiff = totalsum(sepdiff)/septotalcount;

Addlabel(yes, "September Avg: " + aspercent( sepup/septotalcount) + " | " + aspercent(sepavgdiff), if(sepup/septotalcount) > 0.5 and sepavgdiff > 0 then color.green else color.red);
#addchartbubble(sep, close jandiff, color.yellow);
#addchartbubble(mar, close jandiff, color.yellow);

#October
def oct = getmonth() == 10;
def octopen = if oct and !oct[1] then open else octopen[1];
def octclose = if oct and oct[-1] then close else octclose[1];
def octdiff = if oct and !oct[-1] then (octclose-octopen)/octopen else 0;
def octup = totalsum( if oct and !oct[-1] and octdiff > 0 then 1 else 0);
def octdown = totalsum ( if oct and !oct[-1] and octdiff <= 0 then 1 else 0);
def octtotalcount = totalsum(oct and !oct[-1]);
def octavgdiff = totalsum(octdiff)/octtotalcount;

Addlabel(yes, "October Avg: " + aspercent( octup/octtotalcount) + " | " + aspercent(octavgdiff), if(octup/octtotalcount) > 0.5 and octavgdiff > 0 then color.green else color.red);
#addchartbubble(oct, close jandiff, color.yellow);


#November
def nov = getmonth() == 11;
def novopen = if nov and !nov[1] then open else novopen[1];
def novclose = if nov and !nov[-1] then close else novclose[1];
def novdiff = if nov and !nov[-1] then (novclose-novopen)/novopen else 0;
def novup = totalsum( if nov and !nov[-1] and novdiff > 0 then 1 else 0);
def novdown = totalsum ( if nov and !nov[-1] and novdiff <= 0 then 1 else 0);
def novtotalcount = totalsum(nov and !nov[-1]);
def novavgdiff = totalsum(novdiff)/novtotalcount;

Addlabel(yes, "Nov Avg: " + aspercent( novup/novtotalcount) + " | " + aspercent(novavgdiff), if(novup/novtotalcount) > 0.5 and novavgdiff > 0 then color.green else color.red);
#addchartbubble(nov, close jandiff, color.yellow);

#December
def dec = getmonth() == 12;
def decopen = if dec and !dec[1] then open else decopen[1];
def decclose = if dec and dec[-1] then close else decclose[1];
def decdiff = if dec and !dec[-1] then (decclose-decopen)/decopen else 0;
def decup = totalsum( if dec and !dec[-1] and decdiff > 0 then 1 else 0);
def decdown = totalsum ( if dec and !dec[-1] and decdiff <= 0 then 1 else 0);
def dectotalcount = totalsum(dec and !dec[-1]);
def decavgdiff = totalsum(decdiff)/dectotalcount;

Addlabel(yes, "Dec Avg: " + aspercent( decup/dectotalcount) + " | " + aspercent(decavgdiff), if(decup/dectotalcount) > 0.5 and decavgdiff > 0 then color.green else color.red);
#addchartbubble(dec, close jandiff, color.yellow);
 
Last edited by a moderator:
This is my seasonal Analysis script that I use.
It is for the past 5 years and shows label with percentage and is colored.

It does not show lines..

Code:
#Only use on a daily chart.
AddLabel(yes, "5 Year Seasonal Analysis", color.YELLOW);



#January
def jan = getmonth() == 1;
def janopen = if jan and !jan[1] then open else janopen[1];
def janclose = if jan and !jan[-1] then close else janclose[1];
def jandiff = if jan and !jan[-1] then (janclose-janopen)/janopen else 0;
def janup = totalsum( if jan and !jan[-1] and jandiff > 0 then 1 else 0);
def jandown = totalsum ( if jan and !jan[-1] and jandiff <= 0 then 1 else 0);
def jantotalcount = totalsum(jan and !jan[-1]);
def janavgdiff = totalsum(jandiff)/jantotalcount;

Addlabel(yes, "Jan Avg: " + aspercent( janup/jantotalcount) + " | " + aspercent(janavgdiff), if(janup/jantotalcount) > 0.5 and janavgdiff > 0 then color.green else color.red);

#addchartbubble(jan, close jandiff, color.yellow);
#addchartbubble(mar, close jandiff, color.yellow);

#February
def feb = getmonth() == 2;
def febopen = if feb and !feb[1] then open else febopen[1];
def febclose = if feb and feb[-1] then close else febclose[1];
def febdiff = if feb and !feb[-1] then (febclose-febopen)/febopen else 0;
def febup = totalsum( if feb and !feb[-1] and febdiff > 0 then 1 else 0);
def febdown = totalsum ( if feb and !feb[-1] and febdiff <= 0 then 1 else 0);
def febtotalcount = totalsum(feb and !feb[-1]);
def febavgdiff = totalsum(febdiff)/febtotalcount;

Addlabel(yes, "February Avg: " + aspercent( febup/febtotalcount) + " | " + aspercent(febavgdiff), if(febup/febtotalcount) > 0.5 and febavgdiff > 0 then color.green else color.red);

#addchartbubble(feb, close jandiff, color.yellow);

#MARCH
def mar = getmonth() == 3;
def maropen = if mar and !mar[1] then open else maropen[1];
def marclose = if mar and mar[-1] then close else marclose[1];
def mardiff = if mar and !mar[-1] then (marclose-maropen)/maropen else 0;
def marup = totalsum( if mar and !mar[-1] and mardiff > 0 then 1 else 0);
def mardown = totalsum ( if mar and !mar[-1] and mardiff <= 0 then 1 else 0);
def martotalcount = totalsum(mar and !mar[-1]);
def maravgdiff = totalsum(mardiff)/martotalcount;

Addlabel(yes, "March Avg: " + aspercent( marup/martotalcount) + " | " + aspercent(maravgdiff), if(marup/martotalcount) > 0.5 and maravgdiff > 0 then color.green else color.red);
#addchartbubble(mar, close jandiff, color.yellow);

#APRIL
def apr = getmonth() == 4;
def apropen = if apr and !apr[1] then open else apropen[1];
def aprclose = if apr and !apr[-1] then close else aprclose[1];
def aprdiff = if apr and !apr[-1] then (aprclose-apropen)/apropen else 0;
def aprup = totalsum( if apr and !apr[-1] and aprdiff > 0 then 1 else 0);
def aprdown = totalsum ( if apr and !apr[-1] and aprdiff <= 0 then 1 else 0);
def aprtotalcount = totalsum(apr and !apr[-1]);
def apravgdiff = totalsum(aprdiff)/aprtotalcount;

Addlabel(yes, "April Avg: " + aspercent( aprup/aprtotalcount) + " | " + aspercent(apravgdiff), if(aprup/aprtotalcount) > 0.5 and apravgdiff > 0 then color.green else color.red);
#addchartbubble(apr, close jandiff, color.yellow);


#MAY
def may = getmonth() == 5;
def  mayopen = if  may and ! may[1] then open else  mayopen[1];
def  mayclose = if  may and ! may[-1] then close else mayclose[1];
def  maydiff = if  may and ! may[-1] then ( mayclose- mayopen)/ mayopen else 0;
def  mayup = totalsum( if  may and ! may[-1] and  maydiff > 0 then 1 else 0);
def  maydown = totalsum ( if  may and ! may[-1] and  maydiff <= 0 then 1 else 0);
def  maytotalcount = totalsum( may and ! may[-1]);
def  mayavgdiff = totalsum( maydiff)/ maytotalcount;

Addlabel(yes, "May Avg: " + aspercent(  mayup/ maytotalcount) + " | " + aspercent( mayavgdiff), if( mayup/ maytotalcount) > 0.5 and  mayavgdiff > 0 then color.green else color.red);
#addchartbubble(may, close jandiff, color.yellow);


#June
def Jun = getmonth() == 6;
def Junopen = if Jun and !Jun[1] then open else Junopen[1];
def Junclose = if Jun and Jun[-1] then close else Junclose[1];
def Jundiff = if Jun and !Jun[-1] then (Junclose-Junopen)/Junopen else 0;
def Junup = totalsum( if Jun and !Jun[-1] and Jundiff > 0 then 1 else 0);
def Jundown = totalsum ( if Jun and !Jun[-1] and Jundiff <= 0 then 1 else 0);
def Juntotalcount = totalsum(Jun and !Jun[-1]);
def Junavgdiff = totalsum(Jundiff)/Juntotalcount;

Addlabel(yes, "June Avg: " + aspercent( Junup/Juntotalcount) + " | " + aspercent(Junavgdiff), if(Junup/Juntotalcount) > 0.5 and Junavgdiff > 0 then color.green else color.red);
#addchartbubble(jun, close jandiff, color.yellow);


#July
def jul = getmonth() == 7;
def  julopen = if  jul and ! jul[1] then open else  julopen[1];
def  julclose = if  jul and  jul[-1] then close else  julclose[1];
def  juldiff = if  jul and ! jul[-1] then ( julclose- julopen)/ julopen else 0;
def  julup = totalsum( if  jul and ! jul[-1] and  juldiff > 0 then 1 else 0);
def  juldown = totalsum ( if  jul and ! jul[-1] and  juldiff <= 0 then 1 else 0);
def  jultotalcount = totalsum( jul and ! jul[-1]);
def  julavgdiff = totalsum( juldiff)/ jultotalcount;

Addlabel(yes, "July Avg: " + aspercent(  julup/ jultotalcount) + " | " + aspercent( julavgdiff), if( julup/ jultotalcount) > 0.5 and  julavgdiff > 0 then color.green else color.red);
#addchartbubble(jul, close jandiff, color.yellow);


#August
def aug = getmonth() == 8;
def  augopen = if  aug and ! aug[1] then open else  augopen[1];
def  augclose = if  aug and ! aug[-1] then close else  augclose[1];
def  augdiff = if  aug and ! aug[-1] then ( augclose- augopen)/ augopen else 0;
def  augup = totalsum( if  aug and ! aug[-1] and  augdiff > 0 then 1 else 0);
def  augdown = totalsum ( if  aug and ! aug[-1] and  augdiff <= 0 then 1 else 0);
def  augtotalcount = totalsum( aug and ! aug[-1]);
def  augavgdiff = totalsum( augdiff)/ augtotalcount;

Addlabel(yes, "August Avg: " + aspercent(  augup/ augtotalcount) + " | " + aspercent( augavgdiff), if( augup/ augtotalcount) > 0.5 and  augavgdiff > 0 then color.green else color.red);
#addchartbubble(aug, close jandiff, color.yellow);

#September
def sep = getmonth() == 9;
def sepopen = if sep and !sep[1] then open else sepopen[1];
def sepclose = if sep and !sep[-1] then close else sepclose[1];
def sepdiff = if sep and !sep[-1] then (sepclose-sepopen)/sepopen else 0;
def sepup = totalsum( if sep and !sep[-1] and sepdiff > 0 then 1 else 0);
def sepdown = totalsum ( if sep and !sep[-1] and sepdiff <= 0 then 1 else 0);
def septotalcount = totalsum(sep and !sep[-1]);
def sepavgdiff = totalsum(sepdiff)/septotalcount;

Addlabel(yes, "September Avg: " + aspercent( sepup/septotalcount) + " | " + aspercent(sepavgdiff), if(sepup/septotalcount) > 0.5 and sepavgdiff > 0 then color.green else color.red);
#addchartbubble(sep, close jandiff, color.yellow);
#addchartbubble(mar, close jandiff, color.yellow);

#October
def oct = getmonth() == 10;
def octopen = if oct and !oct[1] then open else octopen[1];
def octclose = if oct and oct[-1] then close else octclose[1];
def octdiff = if oct and !oct[-1] then (octclose-octopen)/octopen else 0;
def octup = totalsum( if oct and !oct[-1] and octdiff > 0 then 1 else 0);
def octdown = totalsum ( if oct and !oct[-1] and octdiff <= 0 then 1 else 0);
def octtotalcount = totalsum(oct and !oct[-1]);
def octavgdiff = totalsum(octdiff)/octtotalcount;

Addlabel(yes, "October Avg: " + aspercent( octup/octtotalcount) + " | " + aspercent(octavgdiff), if(octup/octtotalcount) > 0.5 and octavgdiff > 0 then color.green else color.red);
#addchartbubble(oct, close jandiff, color.yellow);


#November
def nov = getmonth() == 11;
def novopen = if nov and !nov[1] then open else novopen[1];
def novclose = if nov and !nov[-1] then close else novclose[1];
def novdiff = if nov and !nov[-1] then (novclose-novopen)/novopen else 0;
def novup = totalsum( if nov and !nov[-1] and novdiff > 0 then 1 else 0);
def novdown = totalsum ( if nov and !nov[-1] and novdiff <= 0 then 1 else 0);
def novtotalcount = totalsum(nov and !nov[-1]);
def novavgdiff = totalsum(novdiff)/novtotalcount;

Addlabel(yes, "Nov Avg: " + aspercent( novup/novtotalcount) + " | " + aspercent(novavgdiff), if(novup/novtotalcount) > 0.5 and novavgdiff > 0 then color.green else color.red);
#addchartbubble(nov, close jandiff, color.yellow);

#December
def dec = getmonth() == 12;
def decopen = if dec and !dec[1] then open else decopen[1];
def decclose = if dec and dec[-1] then close else decclose[1];
def decdiff = if dec and !dec[-1] then (decclose-decopen)/decopen else 0;
def decup = totalsum( if dec and !dec[-1] and decdiff > 0 then 1 else 0);
def decdown = totalsum ( if dec and !dec[-1] and decdiff <= 0 then 1 else 0);
def dectotalcount = totalsum(dec and !dec[-1]);
def decavgdiff = totalsum(decdiff)/dectotalcount;

Addlabel(yes, "Dec Avg: " + aspercent( decup/dectotalcount) + " | " + aspercent(decavgdiff), if(decup/dectotalcount) > 0.5 and decavgdiff > 0 then color.green else color.red);
#addchartbubble(dec, close jandiff, color.yellow);
how do I modify this to become a watchlist looking back 10 years and just for 1 month for example January. I can manually duplicate the columns for subsequent months.
 
This is my seasonal Analysis script that I use.
It is for the past 5 years and shows label with percentage and is colored.

It does not show lines..

Code:
#Only use on a daily chart.
AddLabel(yes, "5 Year Seasonal Analysis", color.YELLOW);



#January
def jan = getmonth() == 1;
def janopen = if jan and !jan[1] then open else janopen[1];
def janclose = if jan and !jan[-1] then close else janclose[1];
def jandiff = if jan and !jan[-1] then (janclose-janopen)/janopen else 0;
def janup = totalsum( if jan and !jan[-1] and jandiff > 0 then 1 else 0);
def jandown = totalsum ( if jan and !jan[-1] and jandiff <= 0 then 1 else 0);
def jantotalcount = totalsum(jan and !jan[-1]);
def janavgdiff = totalsum(jandiff)/jantotalcount;

Addlabel(yes, "Jan Avg: " + aspercent( janup/jantotalcount) + " | " + aspercent(janavgdiff), if(janup/jantotalcount) > 0.5 and janavgdiff > 0 then color.green else color.red);

#addchartbubble(jan, close jandiff, color.yellow);
#addchartbubble(mar, close jandiff, color.yellow);

#February
def feb = getmonth() == 2;
def febopen = if feb and !feb[1] then open else febopen[1];
def febclose = if feb and feb[-1] then close else febclose[1];
def febdiff = if feb and !feb[-1] then (febclose-febopen)/febopen else 0;
def febup = totalsum( if feb and !feb[-1] and febdiff > 0 then 1 else 0);
def febdown = totalsum ( if feb and !feb[-1] and febdiff <= 0 then 1 else 0);
def febtotalcount = totalsum(feb and !feb[-1]);
def febavgdiff = totalsum(febdiff)/febtotalcount;

Addlabel(yes, "February Avg: " + aspercent( febup/febtotalcount) + " | " + aspercent(febavgdiff), if(febup/febtotalcount) > 0.5 and febavgdiff > 0 then color.green else color.red);

#addchartbubble(feb, close jandiff, color.yellow);

#MARCH
def mar = getmonth() == 3;
def maropen = if mar and !mar[1] then open else maropen[1];
def marclose = if mar and mar[-1] then close else marclose[1];
def mardiff = if mar and !mar[-1] then (marclose-maropen)/maropen else 0;
def marup = totalsum( if mar and !mar[-1] and mardiff > 0 then 1 else 0);
def mardown = totalsum ( if mar and !mar[-1] and mardiff <= 0 then 1 else 0);
def martotalcount = totalsum(mar and !mar[-1]);
def maravgdiff = totalsum(mardiff)/martotalcount;

Addlabel(yes, "March Avg: " + aspercent( marup/martotalcount) + " | " + aspercent(maravgdiff), if(marup/martotalcount) > 0.5 and maravgdiff > 0 then color.green else color.red);
#addchartbubble(mar, close jandiff, color.yellow);

#APRIL
def apr = getmonth() == 4;
def apropen = if apr and !apr[1] then open else apropen[1];
def aprclose = if apr and !apr[-1] then close else aprclose[1];
def aprdiff = if apr and !apr[-1] then (aprclose-apropen)/apropen else 0;
def aprup = totalsum( if apr and !apr[-1] and aprdiff > 0 then 1 else 0);
def aprdown = totalsum ( if apr and !apr[-1] and aprdiff <= 0 then 1 else 0);
def aprtotalcount = totalsum(apr and !apr[-1]);
def apravgdiff = totalsum(aprdiff)/aprtotalcount;

Addlabel(yes, "April Avg: " + aspercent( aprup/aprtotalcount) + " | " + aspercent(apravgdiff), if(aprup/aprtotalcount) > 0.5 and apravgdiff > 0 then color.green else color.red);
#addchartbubble(apr, close jandiff, color.yellow);


#MAY
def may = getmonth() == 5;
def  mayopen = if  may and ! may[1] then open else  mayopen[1];
def  mayclose = if  may and ! may[-1] then close else mayclose[1];
def  maydiff = if  may and ! may[-1] then ( mayclose- mayopen)/ mayopen else 0;
def  mayup = totalsum( if  may and ! may[-1] and  maydiff > 0 then 1 else 0);
def  maydown = totalsum ( if  may and ! may[-1] and  maydiff <= 0 then 1 else 0);
def  maytotalcount = totalsum( may and ! may[-1]);
def  mayavgdiff = totalsum( maydiff)/ maytotalcount;

Addlabel(yes, "May Avg: " + aspercent(  mayup/ maytotalcount) + " | " + aspercent( mayavgdiff), if( mayup/ maytotalcount) > 0.5 and  mayavgdiff > 0 then color.green else color.red);
#addchartbubble(may, close jandiff, color.yellow);


#June
def Jun = getmonth() == 6;
def Junopen = if Jun and !Jun[1] then open else Junopen[1];
def Junclose = if Jun and Jun[-1] then close else Junclose[1];
def Jundiff = if Jun and !Jun[-1] then (Junclose-Junopen)/Junopen else 0;
def Junup = totalsum( if Jun and !Jun[-1] and Jundiff > 0 then 1 else 0);
def Jundown = totalsum ( if Jun and !Jun[-1] and Jundiff <= 0 then 1 else 0);
def Juntotalcount = totalsum(Jun and !Jun[-1]);
def Junavgdiff = totalsum(Jundiff)/Juntotalcount;

Addlabel(yes, "June Avg: " + aspercent( Junup/Juntotalcount) + " | " + aspercent(Junavgdiff), if(Junup/Juntotalcount) > 0.5 and Junavgdiff > 0 then color.green else color.red);
#addchartbubble(jun, close jandiff, color.yellow);


#July
def jul = getmonth() == 7;
def  julopen = if  jul and ! jul[1] then open else  julopen[1];
def  julclose = if  jul and  jul[-1] then close else  julclose[1];
def  juldiff = if  jul and ! jul[-1] then ( julclose- julopen)/ julopen else 0;
def  julup = totalsum( if  jul and ! jul[-1] and  juldiff > 0 then 1 else 0);
def  juldown = totalsum ( if  jul and ! jul[-1] and  juldiff <= 0 then 1 else 0);
def  jultotalcount = totalsum( jul and ! jul[-1]);
def  julavgdiff = totalsum( juldiff)/ jultotalcount;

Addlabel(yes, "July Avg: " + aspercent(  julup/ jultotalcount) + " | " + aspercent( julavgdiff), if( julup/ jultotalcount) > 0.5 and  julavgdiff > 0 then color.green else color.red);
#addchartbubble(jul, close jandiff, color.yellow);


#August
def aug = getmonth() == 8;
def  augopen = if  aug and ! aug[1] then open else  augopen[1];
def  augclose = if  aug and ! aug[-1] then close else  augclose[1];
def  augdiff = if  aug and ! aug[-1] then ( augclose- augopen)/ augopen else 0;
def  augup = totalsum( if  aug and ! aug[-1] and  augdiff > 0 then 1 else 0);
def  augdown = totalsum ( if  aug and ! aug[-1] and  augdiff <= 0 then 1 else 0);
def  augtotalcount = totalsum( aug and ! aug[-1]);
def  augavgdiff = totalsum( augdiff)/ augtotalcount;

Addlabel(yes, "August Avg: " + aspercent(  augup/ augtotalcount) + " | " + aspercent( augavgdiff), if( augup/ augtotalcount) > 0.5 and  augavgdiff > 0 then color.green else color.red);
#addchartbubble(aug, close jandiff, color.yellow);

#September
def sep = getmonth() == 9;
def sepopen = if sep and !sep[1] then open else sepopen[1];
def sepclose = if sep and !sep[-1] then close else sepclose[1];
def sepdiff = if sep and !sep[-1] then (sepclose-sepopen)/sepopen else 0;
def sepup = totalsum( if sep and !sep[-1] and sepdiff > 0 then 1 else 0);
def sepdown = totalsum ( if sep and !sep[-1] and sepdiff <= 0 then 1 else 0);
def septotalcount = totalsum(sep and !sep[-1]);
def sepavgdiff = totalsum(sepdiff)/septotalcount;

Addlabel(yes, "September Avg: " + aspercent( sepup/septotalcount) + " | " + aspercent(sepavgdiff), if(sepup/septotalcount) > 0.5 and sepavgdiff > 0 then color.green else color.red);
#addchartbubble(sep, close jandiff, color.yellow);
#addchartbubble(mar, close jandiff, color.yellow);

#October
def oct = getmonth() == 10;
def octopen = if oct and !oct[1] then open else octopen[1];
def octclose = if oct and oct[-1] then close else octclose[1];
def octdiff = if oct and !oct[-1] then (octclose-octopen)/octopen else 0;
def octup = totalsum( if oct and !oct[-1] and octdiff > 0 then 1 else 0);
def octdown = totalsum ( if oct and !oct[-1] and octdiff <= 0 then 1 else 0);
def octtotalcount = totalsum(oct and !oct[-1]);
def octavgdiff = totalsum(octdiff)/octtotalcount;

Addlabel(yes, "October Avg: " + aspercent( octup/octtotalcount) + " | " + aspercent(octavgdiff), if(octup/octtotalcount) > 0.5 and octavgdiff > 0 then color.green else color.red);
#addchartbubble(oct, close jandiff, color.yellow);


#November
def nov = getmonth() == 11;
def novopen = if nov and !nov[1] then open else novopen[1];
def novclose = if nov and !nov[-1] then close else novclose[1];
def novdiff = if nov and !nov[-1] then (novclose-novopen)/novopen else 0;
def novup = totalsum( if nov and !nov[-1] and novdiff > 0 then 1 else 0);
def novdown = totalsum ( if nov and !nov[-1] and novdiff <= 0 then 1 else 0);
def novtotalcount = totalsum(nov and !nov[-1]);
def novavgdiff = totalsum(novdiff)/novtotalcount;

Addlabel(yes, "Nov Avg: " + aspercent( novup/novtotalcount) + " | " + aspercent(novavgdiff), if(novup/novtotalcount) > 0.5 and novavgdiff > 0 then color.green else color.red);
#addchartbubble(nov, close jandiff, color.yellow);

#December
def dec = getmonth() == 12;
def decopen = if dec and !dec[1] then open else decopen[1];
def decclose = if dec and dec[-1] then close else decclose[1];
def decdiff = if dec and !dec[-1] then (decclose-decopen)/decopen else 0;
def decup = totalsum( if dec and !dec[-1] and decdiff > 0 then 1 else 0);
def decdown = totalsum ( if dec and !dec[-1] and decdiff <= 0 then 1 else 0);
def dectotalcount = totalsum(dec and !dec[-1]);
def decavgdiff = totalsum(decdiff)/dectotalcount;

Addlabel(yes, "Dec Avg: " + aspercent( decup/dectotalcount) + " | " + aspercent(decavgdiff), if(decup/dectotalcount) > 0.5 and decavgdiff > 0 then color.green else color.red);
#addchartbubble(dec, close jandiff, color.yellow);

This seems to work well. Is there a way to create a scanner and a watchlist for this? I was thinking 'scan for stocks that have bullish or bearish tendencies on a specific month or months?
 

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
456 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top