PureBytes Links
Trading Reference Links
|
hey, thanks for all this anthony, quite a bit more of an effort than I was
expecting; hope it was something you had lying around already (:-).
some of it comes up {EMPTY} for me, depending on the time frame, and I
haven't had a chance to go through it, but I appreciate your laying it out
like this, very much.
the key statement I want to make sure I understand is this:
Currentchart = 100 * ( price/ValueWhen( Cum(1) == startpoint, price ) -
1 );
am I right that in english, that's the percentage change in price since the
start of the comparison? makes sense.
thanks again,
dave
> From: Anthony Faragasso [mailto:ajf1111@xxxxxxxx]
>
> Something like this,
>
> //Comparative Analysis
>
> //Anthony Faragasso
>
> //
>
> /*Choose markets to compare current active chart with.*/
>
> /*To reduce number of Tickers...just put "" next to mkt
> variable...example:
> mkt1="";*/
>
> mkt1="^GSPC";//change ticker here
>
> mkt2="DELL";//change ticker here
>
> mkt3="MSFT";//change ticker here
>
> //Chose your timeframe for comparison
>
> barsAgo=100;
>
> barno=LastValue(Cum(1))-barsAgo;//Starts N last bars ago
>
> //Pick one and comment the other out
>
> timeframe=barno;//will start at the N bar ago.
>
> //timeframe=Year();
>
> //timeframe=Month();
>
> /***************************************/
>
> startpoint =
> IIf(timeframe==Year(),ValueWhen(Year()!=Ref(Year(),-1),Cum(1)),IIf
> (timeframe
> ==Month(),ValueWhen(Month()!=Ref(Month(),-1),Cum(1)),IIf(timeframe
> ==barno,ba
> rno,Null))); // the start point of comparision will be Yearly or
> monthly or
> N bar ago.
>
> //Current Active Chart
>
> price = Close;
>
> Color=colorBlue;
>
> Currentchart = 100 * ( price/ValueWhen( Cum(1) == startpoint,
> price ) - 1 );
>
> //Comparison chart #1
>
> Color1=colorRed;
>
> ticker1 = ParamStr( "Ticker1", mkt1);
>
> price1 = Foreign(mkt1, "C");
>
> Chart1 = 100 * ( price1/ValueWhen( Cum(1) == startpoint, price1 ) - 1 );
>
> //Comparison chart #2
>
> Color2=colorYellow;
>
> ticker2=ParamStr( "Ticker2", mkt2);
>
> price2 = Foreign(mkt2, "C");
>
> Chart2 = 100 * ( price2/ValueWhen( Cum(1) == startpoint, price2 ) - 1 );
>
> //Comparison chart #3
>
> Color3=colorWhite;
>
> ticker3=ParamStr( "Ticker3", mkt3);
>
> price3 = Foreign(mkt3, "C");
>
> Chart3 = 100 * ( price3/ValueWhen( Cum(1) == startpoint, price3 ) - 1 );
>
> /******************************************************/
>
> Plot(Currentchart,"",color,styleLine);
>
> Plot(Chart1,"",color1,styleLine);
>
> Plot(Chart2,"",color2,styleLine);
>
> Plot(Chart3,"",color3,styleLine);
>
> //plots vertical line at yearly or monthly intervals
>
> Plot(IIf(timeframe==Year(),Year()!=Ref(Year(),-1),IIf(timeframe==M
> onth(),Mon
> th()!=Ref(Month(),-1),IIf(timeframe==barno,Null,0))),"",colorBlack
> ,styleOwnS
> cale|styleHistogram);
>
> //Some title information
>
> barnotitle=WriteIf(timeframe==barno,EncodeColor(color)+Name()+Writ
> eVal(Curre
> ntchart)+"\n"+EncodeColor(color1)+ticker1+WriteVal(Chart1)+"\n"+En
> codeColor(
> Color2)+ticker2+WriteVal(Chart2)+"\n"+EncodeColor(Color3)+ticker3+
> WriteVal(C
> hart3),"");
>
> Monthly=WriteIf(timeframe==Month(),EncodeColor(color)+Name()+Write
> Val(Curren
> tchart)+"\n"+EncodeColor(color1)+ticker1+WriteVal(Chart1)+"\n"+Enc
> odeColor(C
> olor2)+ticker2+WriteVal(Chart2)+"\n"+EncodeColor(Color3)+ticker3+W
> riteVal(Ch
> art3),"");
>
> Yearly=WriteIf(timeframe==Year(),EncodeColor(color)+Name()+WriteVa
> l(Currentc
> hart)+"\n"+EncodeColor(color1)+ticker1+WriteVal(Chart1)+"\n"+Encod
> eColor(Col
> or2)+ticker2+WriteVal(Chart2)+"\n"+EncodeColor(Color3)+ticker3+Wri
> teVal(Char
> t3),"");
>
> /****************************************************/
>
>
>
> Title=WriteIf(timeframe==Year(),"Yearly...",WriteIf(timeframe==Mon
> th(),"Mont
> hly...",WriteIf(timeframe==barno,"Startpoint is ..(
> "+WriteVal(ValueWhen(barno==Cum(1),DateTime()),formatDateTime)+"
> )","")))+".
> .Comparative Analysis for
> :...."+EncodeColor(Color)+Name()+".."+EncodeColor(Color1)+ticker1+
> ".."+Encod
> eColor(Color2)+ticker2+".."+EncodeColor(Color3)+ticker3+"\n"+Write
> If(timefra
> me==Month(),Monthly,WriteIf(timeframe==Year(),Yearly,WriteIf(timef
> rame==barn
> o,barnotitle,"")));
------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for Your HP, Epson, Canon or Lexmark
Printer at Myinks.com. Free s/h on orders $50 or more to the US & Canada. http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/l.m7sD/LIdGAA/qnsNAA/GHeqlB/TM
---------------------------------------------------------------------~->
Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
|