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

[amibroker] Re: Basic Chart overlay



PureBytes Links

Trading Reference Links



Hello Richard,

This is what I use to rank mutual funds. 

The authors are highlighted in bold below.

 

Wrzec

 

// Multi - Charts in the FastTrack Total Return Format

// Normalized to left edge with right axis indicating %return of screen

// Bracketed values indicate returns from left screen to pole OR

// between Date markers if in place

// Use <Cntr>R to set ticker symbols

// left click to set pole, double left click to set marker

// Colors may be changed below:

// Modified Frederick Miller (rick300m@xxxxxxxxxxxx) 2/9/04

// Modified K Close 8/2/02  */

/* support code from Thomas Zmuck/Anthony Faragasso  */

 

Cl0=colorLightOrange;

Cl1=colorPink;

Cl2=colorOrange;

Cl3=colorGreen ;

Cl4=colorTurquoise;

Cl5=colorLime;

Cl6=colorBlueGrey;

Cl7=colorYellow;

Cl8=colorBrightGreen;

Cl9=colorRed;

 

//Set Variables

barvisible = Status("barvisible");

FVB = barvisible AND NOT Ref( barvisible, -1 );

CVB = ValueWhen(  FVB,C) ;

Leftbar=ValueWhen(Ref(barvisible,-1)==0 AND barvisible,DateTime() );

Rightbar=LastValue(DateTime() );

DateSpan = EndValue(BarIndex()) - BeginValue(BarIndex());

Range = DateSpan ;

StartDate = BeginValue(BarIndex());

EndDate = EndValue(BarIndex());

 

//Select Tickers

Fn0=ParamStr( "Fund0", "$INDU");

Fn1=ParamStr( "Fund1", "DJSEU");

Fn2=ParamStr( "Fund2", "DJW-X");

Fn3=ParamStr( "Fund3", "OTC-C");

Fn4=ParamStr( "Fund4", "RUT-I");

Fn5=ParamStr( "Fund5", "STBI-");

Fn6=ParamStr( "Fund6", "PSE-X");

Fn7=ParamStr( "Fund7", "");

Fn8=ParamStr( "Fund8", "");

Fn9=ParamStr( "Fund9", "");

 

//Normalized to left edge

Fa0=Prec(100*(Foreign(Fn0,"C")/ValueWhen(FVB,Foreign(Fn0,"C"))-1),2.2);

Fa1=Prec(100*(Foreign(Fn1,"C")/ValueWhen(FVB,Foreign(Fn1,"C"))-1),2.2);

Fa2=Prec(100*(Foreign(Fn2,"C")/ValueWhen(FVB,Foreign(Fn2,"C"))-1),2.2);

Fa3=Prec(100*(Foreign(Fn3,"C")/ValueWhen(FVB,Foreign(Fn3,"C"))-1),2.2);

Fa4=Prec(100*(Foreign(Fn4,"C")/ValueWhen(FVB,Foreign(Fn4,"C"))-1),2.2);

Fa5=Prec(100*(Foreign(Fn5,"C")/ValueWhen(FVB,Foreign(Fn5,"C"))-1),2.2);

Fa6=Prec(100*(Foreign(Fn6,"C")/ValueWhen(FVB,Foreign(Fn6,"C"))-1),2.2);

Fa7=Prec(100*(Foreign(Fn7,"C")/ValueWhen(FVB,Foreign(Fn7,"C"))-1),2.2);

Fa8=Prec(100*(Foreign(Fn8,"C")/ValueWhen(FVB,Foreign(Fn8,"C"))-1),2.2);

Fa9=Prec(100*(Foreign(Fn9,"C")/ValueWhen(FVB,Foreign(Fn9,"C"))-1),2.2);

 

//Plot Normalized Graphs

Plot(Fa0,Fn0,Cl0,4);

Plot(Fa1,Fn1,Cl1,4);

Plot(Fa2,Fn2,Cl2,4);

Plot(Fa3,Fn3,Cl3,4);

Plot(Fa4,Fn4,Cl4,4);

Plot(Fa5,Fn5,Cl5,4);

Plot(Fa6,Fn6,Cl6,4);

Plot(Fa7,Fn7,Cl7,4);

Plot(Fa8,Fn8,Cl8,4);

Plot(Fa9,Fn9,Cl9,4);

Plot(0,"",colorDarkBlue,styleNoLine+styleDots);

 

//Calculate % Change between markers

Fv0=IIf(startdate==0,Fa0,100*(EndValue(Foreign(Fn0,"C")-BeginValue(Foreign(Fn0,"C"))))/BeginValue(Foreign(Fn0,"C")));

Fv9=IIf(startdate==0,Fa9,100*(EndValue(Foreign(Fn9,"C")-BeginValue(Foreign(Fn9,"C"))))/BeginValue(Foreign(Fn9,"C")));

Fv8=IIf(startdate==0,Fa8,100*(EndValue(Foreign(Fn8,"C")-BeginValue(Foreign(Fn8,"C"))))/BeginValue(Foreign(Fn8,"C")));

Fv7=IIf(startdate==0,Fa7,100*(EndValue(Foreign(Fn7,"C")-BeginValue(Foreign(Fn7,"C"))))/BeginValue(Foreign(Fn7,"C")));

Fv6=IIf(startdate==0,Fa6,100*(EndValue(Foreign(Fn6,"C")-BeginValue(Foreign(Fn6,"C"))))/BeginValue(Foreign(Fn6,"C")));

Fv5=IIf(startdate==0,Fa5,100*(EndValue(Foreign(Fn5,"C")-BeginValue(Foreign(Fn5,"C"))))/BeginValue(Foreign(Fn5,"C")));

Fv4=IIf(startdate==0,Fa4,100*(EndValue(Foreign(Fn4,"C")-BeginValue(Foreign(Fn4,"C"))))/BeginValue(Foreign(Fn4,"C")));

Fv3=IIf(startdate==0,Fa3,100*(EndValue(Foreign(Fn3,"C")-BeginValue(Foreign(Fn3,"C"))))/BeginValue(Foreign(Fn3,"C")));

Fv2=IIf(startdate==0,Fa2,100*(EndValue(Foreign(Fn2,"C")-BeginValue(Foreign(Fn2,"C"))))/BeginValue(Foreign(Fn2,"C")));

Fv1=IIf(startdate==0,Fa1,100*(EndValue(Foreign(Fn1,"C")-BeginValue(Foreign(Fn1,"C"))))/BeginValue(Foreign(Fn1,"C")));

 

 

Title=

// Left Bar Date

WriteIf(startdate==0, WriteVal(leftbar,formatDateTime),WriteVal(BeginValue(DateTime()),formatDateTime))+

//Right Bar Date

WriteIf(EndValue(DateTime() )==rightbar, "              Normalized Return Chart                  "+Date(),

"                       "+WriteVal(Range,1)+" days                       "+WriteVal(EndValue(Month()),1.0) +"/" + WriteVal(EndValue(Day()),1.0) + "/20" + StrRight( WriteVal(EndValue(Year()),1.0),2))

 

//List of Funds

+" \n"+EncodeColor(Cl0)+Fn0+ WriteIf(IsTrue(fa0)," ["+WriteVal(fv0,1.2)+ "]  ","") +EncodeColor(Cl1)+Fn1+WriteIf(IsTrue(fa1)," ["+WriteVal(fv1,1.2)+"]  ","")+EncodeColor(Cl2)+Fn2 + WriteIf(IsTrue(fa2)," ["+WriteVal(fv2,1.2)+"]  ","")+"\n"+EncodeColor(Cl3)+fn3 + WriteIf(IsTrue(fa3)," ["+WriteVal(fv3,1.2)+"]  ","")+EncodeColor(Cl4)+Fn4 + WriteIf(IsTrue(fa4)," ["+WriteVal(fv4,1.2)+"]  ","")+EncodeColor(Cl5)+Fn5 + WriteIf(IsTrue(fa5)," ["+WriteVal(fv5,1.2)+"]  ","")+"\n"+EncodeColor(Cl6)+Fn6 + WriteIf(IsTrue(fa6)," ["+WriteVal(fv6,1.2)+"]  ","")+EncodeColor(Cl7)+Fn7 + WriteIf(IsTrue(fa7)," ["+WriteVal(fv7,1.2)+"]  ","")+EncodeColor(Cl8)+Fn8 + WriteIf(IsTrue(fa8)," ["+WriteVal(fv8,1.2)+"]  ","")+EncodeColor(Cl9)+Fn9 + WriteIf(IsTrue(fa9)," ["+WriteVal(fv9,1.2)+"]  ","");

 

 


From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf Of Richard
Sent: Wednesday, September 23, 2009 2:55 PM
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] Re: Basic Chart overlay

 

 

Thanks Reinsley,

I tried his first example (modified) and it seems to work.ie:

Plot(Foreign("HOT","Close"),"HOT",colorRed,styleOwnScale|5);
Plot(Foreign("BEE","Close"),"BEE",colorBlue,styleThick);
Plot(Foreign("^RUT","Close"),"^RUT",1,styleOwnScale|5);

Now I need to figure out a simplified way to change stocks or Indexes by trying out some of his other options. If others have done this I would like to hear from you.

Dick H

--- In amibroker@xxxxxxxxxps.com, reinsley <reinsley@xx.> wrote:
>
>
>
> Hi,
>
> Joris M.schuller gave me a copious answer in February 2009...
>
> Best regards
>
>
>
> both symbols in one pane
>
> //if you have the same database provider for Futures and Stocks all you
> have to do is:
>
> 1. Have all the symbols Of interest in the same database (I Have no
> futures, so demonstrate it with Forex AND stocks}
>
> 2. Make a new indicator.afl for each symbol that you want in a separate
> pane
>
> ///////////////Examples
>
> ///////////////Example1 (both symbols in 1 pane)//////////////////
>
> Create an indicator Example1.afl)
>
> Plot(Foreign("EUR.USD-IDEALPRO-CASH","Close"),"EUR.USD",1,styleOwnScale|5);
>
> Plot(Foreign("DIA","Close"),"DIA",1,styleOwnScale|5);
>
>
>
> ///////////////Example2 (1 symbol each in its own pane)///////////////
>
> Example21.afl
>
> Plot(Foreign("EUR.USD-IDEALPRO-CASH","Close"),"EUR.USD",1,5);
>
> Example22.afl
>
> Plot(Foreign("DIA","Close"),"DIA",1,5);
>
>
>
> ////////////////Example3 (Rel Performance in 1 pane)///////////////////
>
> Ticker1= "EUR.USD-IDEALPRO-CASH";
>
> price1 = Foreign( ticker1, "C");
>
> Ticker2= "DIA";
>
> price2 = Foreign( ticker2, "C");
>
> Plot( price1 ,"\n"+ StrMid( ticker1,4,3)+StrMid(ticker1,0,3),
> colorBlack,styleOwnScale|5);
>
> Plot( price2 ,"\n"+ Ticker2, colorBlue,styleOwnScale|5);
>
>
>
> ///////////////Example4//////////////////////
>
> // A little bit more fluff, but basically the same: Instead pf stepping
> thru each tickerlist in 1 pane,
>
> //one can of course assign each tickerlist to an individual tickerlist.afl
>
> DrawList = ParamList("TickerList1|TickerList2","1|2|3|4");
>
> _N( TickerList1 = ParamStr("EUR",
> "DIA,EUR.CAD-IDEALPRO-CASH,EUR.CHF-IDEALPRO-CASH,EUR.JPY-IDEALPRO-CASH,EUR.USD-IDEALPRO-CASH,EUR.GBP-IDEALPRO-CASH,EUR.AUD-IDEALPRO-CASH")
> );
>
> _N( TickerList2 = ParamStr("Tickers2",
> "QQQQ,USD.CHF-IDEALPRO-CASH,USD.JPY-IDEALPRO-CASH,USD.CAD-IDEALPRO-CASH")
> );
>
> _N( TickerList3 = ParamStr("Tickers3",
> "SPY,GBP.USD-IDEALPRO-CASH,GBP.JPY-IDEALPRO-CASH,GBP.CHF-IDEALPRO-CASH,GBP.AUD-IDEALPRO-CASH")
> );
>
> _N( TickerList4 = ParamStr("Tickers4",
> "MSFT,AUD.JPY-IDEALPRO-CASH,AUD.NZD-IDEALPRO-CASH,AUD.USD-IDEALPRO-CASH,AUD.CHF-IDEALPRO-CASH")
> );
>
>
>
> //TickerList = IIf(DrawList==1,TickerList1,TickerList2);
>
> if(DrawList=="1")TickerList=TickerList1;
>
> if(DrawList=="2")TickerList=TickerList2;
>
> if(DrawList=="3")TickerList=TickerList3;
>
> if(DrawList=="4")TickerList=TickerList4;
>
>
>
> NumBars = 40;
>
> fvb = Status("firstvisiblebar");
>
> //Plot( 100 * ( C - C[ fvb ] ) / C[ fvb ], Name(), colorBlue );
>
> for( i = 0; ( symbol = StrExtract( TickerList, i ) ) != ""; i++ )
>
> {
>
> fc = Foreign( symbol, "C" );
>
> if( ! IsNull( fc[ 0 ] ) )
>
> {
>
> //use either following
>
> Plot( 100 * ( fc - fc[ fvb ] )/ fc[ fvb ],"\n"+symbol,colorGreen+ (
> (2*i) % 15 ),styleLine );
>
> //or to shorten display; shows only 3 letters for stocks
>
> // symbol2 = "\n"+ StrMid( symbol ,4,3)+StrMid(symbol ,0,3);
>
> // Plot( 100 * ( fc - fc[ fvb ] )/ fc[ fvb ],symbol2,colorGreen+ (
> (2*i) % 15 ),styleLine );
>
> }
>
> }
>
> PlotGrid( 0, colorYellow );
>
> _N( Title = "Rel.Str-FX-Loop - Rel. Perf. [%]: {{VALUES}}" );
>
>
> Richard a écrit :
> >
> >
> > I've never been able to overlay a stock or stocks or Index on a basic
> > Amibroker chart (price only for the overlay). I'm sure there must be
> > simple way … it's just knowing how.
> > Am example of what I'd like to see is at:
> > http://finance.yahoo.com/q/bc?t=1y&s=HOT&l=on&z=m&q=l&c=BEE&c=
> > <http://finance.yahoo.com/q/bc?t=1y&s=HOT&l=on&z=m&q=l&c=BEE&c=>^IXIC
> >
> > I'm sure one of you experts like Herman, Barry, Terry etc. has the
> > answer. Thanks
> >
> > Dick H.
> >
> >
>



__._,_.___


**** 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/





Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___

GIF image

GIF image