[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Re: Seasonality Plot


  • Date: Tue, 15 Dec 2009 09:37:04 -0000
  • From: "vlanschot" <vlanschot@xxxxxxxxx>
  • Subject: [amibroker] Re: Seasonality Plot

PureBytes Links

Trading Reference Links

Below is some old code of mine. May get you going though.

PS

#include_once <Nested_Includes.AFL>

Maand = Month();

JanRet = ValueWhen(Maand == 1  AND Ref(Maand,1)==2,ROC(C,MonthPer));
FebRet = ValueWhen(Maand == 2  AND Ref(Maand,1)==3,ROC(C,MonthPer));
MarRet = ValueWhen(Maand == 3  AND Ref(Maand,1)==4,ROC(C,MonthPer));
AprRet = ValueWhen(Maand == 4  AND Ref(Maand,1)==5,ROC(C,MonthPer));
MayRet = ValueWhen(Maand == 5  AND Ref(Maand,1)==6,ROC(C,MonthPer));
JunRet = ValueWhen(Maand == 6  AND Ref(Maand,1)==7,ROC(C,MonthPer));
JulRet = ValueWhen(Maand == 7  AND Ref(Maand,1)==8,ROC(C,MonthPer));
AugRet = ValueWhen(Maand == 8  AND Ref(Maand,1)==9,ROC(C,MonthPer));
SepRet = ValueWhen(Maand == 9  AND Ref(Maand,1)==10,ROC(C,MonthPer));
OctRet = ValueWhen(Maand == 10 AND  Ref(Maand,1)==11,ROC(C,MonthPer));
NovRet = ValueWhen(Maand == 11 AND  Ref(Maand,1)==12,ROC(C,MonthPer));
DecRet = ValueWhen(Maand == 12 AND 	Ref(Maand,1)==1,ROC(C,MonthPer));


SeasRet = 
IIf(Maand == 1, LastValue(Cum(JanRet)),
IIf(Maand == 2, LastValue(Cum(FebRet)),
IIf(Maand == 3, LastValue(Cum(MarRet)),
IIf(Maand == 4, LastValue(Cum(AprRet)),
IIf(Maand == 5, LastValue(Cum(MayRet)),
IIf(Maand == 6, LastValue(Cum(JunRet)),
IIf(Maand == 7, LastValue(Cum(JulRet)),
IIf(Maand == 8, LastValue(Cum(AugRet)),
IIf(Maand == 9, LastValue(Cum(SepRet)),
IIf(Maand == 10,LastValue(Cum(OctRet)),
IIf(Maand == 11,LastValue(Cum(NovRet)),
IIf(Maand == 12,LastValue(Cum(DecRet)),0))))))))))));

SeasRet = SeasRet/(BarCount-1);

KleurHist = IIf(SeasRet<0, colorRed,IIf(SeasRet>0,colorGreen,colorLightGrey));

Plot(SeasRet,FullName()+" Seasonal Return for "+StrExtract(ListMonths,SelectedValue(Month()-1)),KleurHist,2+4);
//Plot(OctRet,"ret",1,1);
Title = "{{DATE}} -- {{INTERVAL}}\n{{VALUES}}   ";

--- In amibroker@xxxxxxxxxxxxxxx, Rick Osborn <ricko@xxx> wrote:
>
> I would be interested in that too
> 
>  Best Regards
> Rick Osborn
> 
> 
> 
> 
> ________________________________
> From: Rick_Miller_98 <rick300m@xxx>
> To: amibroker@xxxxxxxxxxxxxxx
> Sent: Mon, December 14, 2009 9:53:23 PM
> Subject: [amibroker] Seasonality Plot
> 
>   
> I am looking for some code to overlay multiple years on the same Jan-Dec axis and to create a composite plot of all of those years to identify seasonality trends.
> 
> Please E-Mail me if you have it. I am willing to contribute to the cause.
> 
> Thanks!
>




------------------------------------

**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to 
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    amibroker-digest@xxxxxxxxxxxxxxx 
    amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/