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

Re: [amibroker] Re: Setting the start date for "Relative Performance" indicator



PureBytes Links

Trading Reference Links

Try this one.. you can probably do a scan, add the results to a watchlist and use the code to examine the "relative performance".
The "black thick line" represent the current stock while other color represent the other stock in the watchlist.
 
By the way, thanks for the code!
 
Wilson

_SECTION_BEGIN("Relative Performance");

Watchlist = CategoryGetSymbols( categoryWatchlist, 5 );  // watchlist number
NumBars = 20;

fvb = SelectedValue(C);

Plot( 100 * ( C - fvb ) / fvb, Name(), colorBlack, styleNoLabel|styleNoTitle|styleThick );

for( i = 0; ( symbol = StrExtract( Watchlist, i ) ) !=""; i++ )
{
fc = Foreign( symbol, "C" );
fcb = SelectedValue(Foreign( symbol, "C" ));

if( ! IsNull( fc[ 0 ] ) )
{
 Plot( 100 * ( fc - fcb )/ fcb, symbol, colorBrown + ( (2*i) % 15 ), styleLine);
}
}

Plot(0,"0",colorGrey50,1|styleNoLabel|styleNoTitle);

_N(Title = "{{NAME}} - ASD - Relative Performance [%]: {{VALUES}}");
_SECTION_END();



 
On 6/1/05, a1ex_douglas <a1ex_douglas@xxxxxxxxx> wrote:
Many thanks for the help - Those codes give me some ideas, but they
seem to be for Relative Strength as oppossed to Relative Performance.

I'll paste a copy of the code I am using below.  All I need to do is
be able to manually select the start date, rather than be forced to
use the "firstvisiblebar".  Perhaps there is a way to set the date
of the firstvisiblebar in the chart window...?

Here is the code - which shows the Relative Performance of various
Australian Sectors along with the ticker you have open.

----

_SECTION_BEGIN("Relative Performance");
_N(TickerList = ParamStr
("Tickers", "^AXJO,^AXDJ,^AXEJ,^AXFJ,^AXHJ,^AXIJ,^AXMJ,^AXNJ,^AXPJ,^A
XSJ,^AXTJ,^AXUJ,^AXXJ"));
NumBars = 20;
fvb = Status("firstvisiblebar");
Plot( 100 * ( C - C[ fvb ] ) / C[ fvb ], Name(), colorBlack,
styleThick=4 );
for( i = 0; ( symbol = StrExtract( TickerList, i ) ) != ""; i++ )
{
fc = Foreign( symbol, "C" );

if( ! IsNull( fc[ 0 ] ) )
{
   Plot( 100 * ( fc - fc[ fvb ] )/ fc[ fvb ], symbol, colorBrown + (
(2*i) % 15 ), styleLine);
}
}

Plot(0,"0",colorGrey50,1);
_N(Title = "{{NAME}} - ASD - Relative Performance [%]: {{VALUES}}");
_SECTION_END();







--- In amibroker@xxxxxxxxxxxxxxx, Wilson <wiz899@xxxx> wrote:
> I modified some part of the code.. it looks good! thanks Terry!
>   "INDEX RelStrength";
> "Indexes will MATCH at Selected Bar";
>
> BaseStock = "^PSI";
> constant = SelectedValue(Foreign(BaseStock,"C"));
>
> /* RelStrength of the Base */
> Base = Foreign( BaseStock, "C" )/Foreign( BaseStock, "C" ) *100 /
> (SelectedValue(Foreign(BaseStock,"C"))/constant);
> Plot(Base , BaseStock, colorRed, styleThick); //base is always
100%
>
> mystock = Foreign( Name(), "C" )/Foreign( BaseStock, "C" ) *100 /
> (SelectedValue(Foreign(Name(),"C"))/constant);
> Plot(mystock , Name(), colorBlue,
styleThick|styleNoTitle); //mystock is
> 100% at the selected bar
>  - Wilson
>
>  On 6/1/05, Terry <MagicTH@xxxx> wrote:
> >
> > Try this code. It doesn't have selectable tickers, but it does
what you
> > want:
> >
> > "INDEX RelStrength";
> > "Indexes will MATCH at Selected Bar";
> >
> > constant = SelectedValue(Foreign("^SPC","C"));
> >
> > /* RelStrength of the NDX */
> > ndx = Foreign( "^NDX", "C" )/Foreign( "^SPC", "C" ) * 1000 /
> > (SelectedValue(Foreign("^NDX","C"))/constant);
> > Plot(ndx ,"^NDX", colorWhite,styleThick);
> >
> > /* RelStrength of the COMP */
> > Comp = Foreign( "IWM", "C" )/Foreign( "^SPC", "C" ) * 1000 /
> > (SelectedValue(Foreign("IWM","C"))/constant);
> > Plot(Comp ,"IWM",colorBlue,styleThick);
> >
> > /* RelStrength of the RUT */
> > Comp = Foreign( "QQQQ", "C" )/Foreign( "^SPC", "C" ) * 1000 /
> > (SelectedValue(Foreign("QQQQ","C"))/constant);
> > Plot(Comp ,"QQQQ", colorGreen,styleThick);
> >
> > /* RelStrength of the RYVYX */
> > Comp = Foreign( "SMH", "C" )/Foreign( "^SPC", "C" ) * 1000 /
> > (SelectedValue(Foreign("SMH","C"))/constant);
> > Plot(Comp ,"SMH", colorViolet,styleThick);
> >
> > /* RelStrength of the RYVNX
> > Comp = Foreign( "RYVNX", "C" )/Foreign( "^SPC", "C" ) * 1000 /
> > (SelectedValue(Foreign("RYVNX","C"))/constant);
> > Plot(Comp ,"Venture RS",colorRed,styleThick);*/
> >
> > --
> > Terry
> >
> >
> > | -----Original Message-----
> > | From: amibroker@xxxxxxxxxxxxxxx
> > | [mailto: amibroker@xxxxxxxxxxxxxxx] On Behalf Of a1ex_douglas
> > | Sent: Tuesday, May 31, 2005 8:47 AM
> > | To: amibroker@xxxxxxxxxxxxxxx
> > | Subject: [amibroker] Setting the start date for "Relative
> > | Performance" indicator
> > |
> > |
> > | Is there a way to set the start date for the "Relative
Performance"
> > | Indicator? As it is, it simply resets all securities to "0" at
the
> > | far left-hand side of the screen and allows the relative
performance
> > | to unfold across the screen - but there doesn't appear t obe
an easy
> > | way to elect which date is the first visible date on the
screen (&
> > | thus the first date of the "Relative Performance").
> > |
> > | Any ideas?
> > |
> > | Many thanks,
> > | Alex.
> > |
> > | alexdouglas@xxxx
> > |
> > |
> > |
> > |
> > |
> > |
> > |
> > | ------------------------ Yahoo! Groups Sponsor
> > | --------------------~-->
> > | What would our lives be like without music, dance, and
> > | theater? Donate or volunteer in the arts today at Network for
> > | Good! http://us.click.yahoo.com/Tcy2bD/SOnJAA/cosFAA/GHeqlB/TM
> > | --------------------------------------------------------------
> > | ------~->
> > |
> > | Please note that this group is for discussion between users
only.
> > |
> > | To get support from AmiBroker please send an e-mail directly
to
> > | SUPPORT {at} amibroker.com <http://amibroker.com/>
> > |
> > | For other support material please check also:
> > | http://www.amibroker.com/support.html
> > |
> > |
> > | Yahoo! Groups Links
> > |
> > |
> > |
> > |
> > |
> > |
> >
> >
> >
> > Please note that this group is for discussion between users only.
> >
> > To get support from AmiBroker please send an e-mail directly to
> > SUPPORT {at} amibroker.com <http://amibroker.com/>
> >
> > For other support material please check also:
> > http://www.amibroker.com/support.html
> >
> >
> >
> >
> > ------------------------------
> > *Yahoo! Groups Links*
> >
> >    - To visit your group on the web, go to:
> >    http://groups.yahoo.com/group/amibroker/
> >    - To unsubscribe from this group, send an email to:
> >    amibroker-unsubscribe@xxxxxxxxxxxxxxx<amibroker-
unsubscribe@xxxxxxxxxxxxxxx?subject=Unsubscribe >
> >    - Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> >    Service < http://docs.yahoo.com/info/terms/>.
> >
> >




Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com

For other support material please check also:
http://www.amibroker.com/support.html





Yahoo! Groups Links



Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com

For other support material please check also:
http://www.amibroker.com/support.html





Yahoo! Groups Links