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

[amibroker] Re: Trouble trying to compare industry and market ...



PureBytes Links

Trading Reference Links

Maybe this will help:

// AccuTrack Compares performance of two securities
// The basic idea is to switch between the two securities
// AccuTrack was developed by FastTrack (http://fasttrack.net)

// Following is the Indicator Builder Formula

fnd = Name();
ind = "FDRXX";      // FDRXX is money market fund, so the comparison 
is done with cash.
fund = Foreign(fnd, "Close");
index = Foreign(ind, "Close");

fast = 6;
slow = 24;
RawAT = EMA((EMA(ROC(fund,1), slow) - EMA(ROC(index,1),slow)),fast); 
tradeAccuTrack = RawAT * 265;
Plot(tradeAccuTrack, "tradeAccuTrack", colorBlue, styleLine);

Title =   Date()
        + "  Trade AccuTrack of "
        + fnd
        +" / "
        + ind 
        + " = " + WriteVal(tradeAccuTrack, 1.2) + " ";

GraphXSpace = 2;


--- In amibroker@xxxxxxxxxxxxxxx, "Louis Préfontaine" 
<rockprog80@xxx> wrote:
>
> Hi,
> 
> I thought about this, but I want something more systemic.. I mean: 
I want to
> build indicators based on that so I don't want to have to change 
the indexes
> manually each time.  I would like to have thev base index + 
industry/sector
> index automatically for each stock...
> 
> Sorry if I am not clear enough; english is not my first language.
> 
> Thanks for your help!
> 
> Louis
> 
> 2008/2/13, wavemechanic <timesarrow@xxx>:
> >
> >    *If I understand correctly, how about something along the 
lines of the
> > following for the visible bars using paramstr() (don't think I 
left anything
> > out but modify to do what you want):*
> > **
> > *status("barvisible"); //all have to have at least as many bars 
as base or
> > reduce time (# bars)*
> > *firstvisbar = status("firstvisiblebar");*
> > *list = paramstr("list", ^xau, ^gld, nem, ... );*
> > *plot(100 * (c - c[firstvisbar])/c[firstvisbar], name(), 
colorwhite);*
> > *for(i = 0, (symbol = strextract(list, i) != "", i++)*
> > *{*
> > *    forsym = foreign(symbol, "C");*
> > *    if(! isnull(forsym[0]))*
> > *    {*
> > *        plot(100 * (forsym - forsym[firstvisbar]) ..... *
> >   *  }*
> > *}*
> > **
> > *Bill*
> > **
> >
> > **
> > ----- Original Message -----
> >
> > **
> > *From:* Louis Préfontaine <rockprog80@xxx>
> > *To:* amibroker@xxxxxxxxxxxxxxx
> > *Sent:* Wednesday, February 13, 2008 11:44 AM
> > *Subject:* Re: [amibroker] Re: Trouble trying to compare industry 
and
> > market ...
> >
> > Hi,
> >
> > I am using DTN.
> >
> > Whatever the other source, that was only an example.  I want to 
compare a
> > base index (Dow Jones, Nasdaq, etc.) with a sector/industry index 
(XAU, GLD,
> > etc.) and with the actual stock.
> >
> > I am already able to compare the stock with the base index
> >
> > (with the following formla:
> >
> > Ticker = GetBaseIndex(); // plot industry, need to create 
composite
> > sectors
> >
> > TickerName = IndustryID(1);
> >
> > TickerClose = Foreign( Ticker, "close" );
> >
> > for( i = 0; ( symbol = StrExtract( Ticker, i ) ) != ""; i++ )
> > {
> > fc = Foreign( ticker, "C" );
> > }
> >
> > PlotGrid( 0, colorYellow );
> >
> > _N( Title = "{{NAME}} - Relative Performance [%]: {{VALUES}}" );
> >
> > ticker= ( 100 * ( fc - Ref( fc, -10 ))/Ref (fc,-10)) ;
> > Current= ( 100 * ( C - Ref (Close, -10) ) / Ref (Close, -10)) ;
> >
> > )
> >
> > but for some reasons I just don't know how to add a sector index 
to the
> > thing so I can get a third graph...
> >
> > Louis
> >
> >
> >
> > 2008/2/13, dingo <dingo@xxx>:
> > >
> > >    what data source are you using?
> > >
> > > d
> > >
> > >  ------------------------------
> > > *From:* amibroker@xxxxxxxxxxxxxxx 
[mailto:amibroker@xxxxxxxxxxxxxxx] *On
> > > Behalf Of *Louis Préfontaine
> > > *Sent:* Wednesday, February 13, 2008 11:19 AM
> > > *To:* amibroker@xxxxxxxxxxxxxxx
> > > *Subject:* Re: [amibroker] Re: Trouble trying to compare 
industry and
> > > market ...
> > >
> > >  Hi,
> > >
> > > Thanks for your help!
> > >
> > > I scanned the whole user guide but I think I am missing some 
insight on
> > > this.  The guide explains how to use the relativestrength or 
foreign, but I
> > > just didn't see any example how to actually assign a variable 
for BOTH the
> > > marketid and the industry or sector.  I have no trouble 
assigning a variable
> > > to the base index, but I just can't use both industry/sector 
and base index
> > > at the same time.  That's why I was wondering if anybody knew 
how to do this
> > > and could show me an example of how to do it.
> > >
> > > Thanks!
> > >
> > > Louis
> > >
> > > 2008/2/13, wavemechanic <timesarrow@xxx>:
> > > >
> > > >    *The Users Guide and Library might provide some help.  For 
example:
> > > > *
> > > > **
> > > > *http://www.amibroker.com/guide/afl/afl_view.php?id=123*
> > > > **
> > > > *http://www.amibroker.com/library/detail.php?id=294*
> > > > **
> > > > *Bill*
> > > >  **
> > > > **
> > > > *----- Original Message ----- * *From: "louisprefontaine" <**
> > > > rockprog80@xxx* <rockprog80@xxx>*>*
> > > > *To: <**amibroker@xxxxxxxxxxxxxxx* 
<amibroker@xxxxxxxxxxxxxxx>*>*
> > > > *Sent: Wednesday, February 13, 2008 10:55 AM*
> > > > *Subject: [amibroker] Re: Trouble trying to compare industry 
and
> > > > market ...*
> > > > *
> > > > *
> > > > *> Maybe my last message was not clear, so I will try to 
explain
> > > > better.
> > > > >
> > > > > I know how to use the getbaseindex()  to get the base index 
(DJ, or
> > > > > comp, etc.) for each of the stocks, and to apply a formula 
on that
> > > > > index.  But what I really want to do is to get BOTH the 
base index
> > > > for
> > > > > the stock AND the industry or sector index, as to compare 
the
> > > > > industry/sector index with the base index and with the 
stock.   I am
> > > > > looking for 3 informations there to compare one to each 
other.
> > > > >
> > > > > If anyone could help me with this issue, maybe by telling 
me how I
> > > > > could write such code to get both index and industry or 
sector, I
> > > > > would greatly appreciate.
> > > > >
> > > > > I tried to search through all the information in the group 
in the
> > > > last
> > > > > years, but found no answer to my question.
> > > > >
> > > > > Thank you very much!
> > > > >
> > > > > Louis
> > > > >
> > > > > --- In **amibroker@xxxxxxxxxxxxxxx* 
<amibroker@xxxxxxxxxxxxxxx>
> > > > *, "louisprefontaine" <rockprog80@>* *
> > > > > wrote:
> > > > >>
> > > > >> Hi,
> > > > >>
> > > > >> I am a newbie with Amibroker as well as on this board, but 
I have
> > > > some
> > > > >> talent for learning and am trying to learn to write code 
really
> > > > hard.
> > > > >>  So far, I had no problem that did not have a solution.
> > > > >>
> > > > >> But now this is something that I don't understand.  I want 
to
> > > > compare
> > > > >> a market indicator (such as the Dow Jones)  and a sector 
indicator
> > > > >> (such as the mining index).
> > > > >>
> > > > >> Here is the code I wrote so far (I know it's messy; I'm 
still
> > > > learning)
> > > > >>
> > > > >>
> > > > >>
> > > > >
> > > > --------------------------------------------------------------
----------------------------------------------------------------------
--------------------------------------------
> > > > >>
> > > > >> Ticker = GetBaseIndex(); // plot industry, need to create 
composite
> > > > >> sectors
> > > > >>
> > > > >> TickerName = IndustryID(1);
> > > > >>
> > > > >> TickerClose = Foreign( Ticker, "close" );
> > > > >>
> > > > >>
> > > > >> for( i = 0; ( symbol = StrExtract( Ticker, i ) ) != ""; 
i++ )
> > > > >> {
> > > > >>   fc = Foreign( ticker, "C" );
> > > > >> }
> > > > >>
> > > > >> PlotGrid( 0, colorYellow );
> > > > >>
> > > > >>
> > > > >> _N( Title = "{{NAME}} - Relative Performance [%]: 
{{VALUES}}" );
> > > > >>
> > > > >>      ticker= ( 100 * ( fc - Ref( fc, -10 ))/Ref (fc,-10)) ;
> > > > >> Current= ( 100 * ( C - Ref (Close, -10) ) / Ref (Close, -
10)) ;
> > > > >>
> > > > >>
> > > > >>
> > > > >
> > > > --------------------------------------------------------------
----------------------------------------------------------------------
----------------------------------------------------------------------
------------------
> > > > >>
> > > > >> Basically, all I want to do is to add the Industry index 
along with
> > > > >> the Market index which is what is displayed right now.  
Anybody
> > > > would
> > > > >> know how to do this?  I tried to experiment with 
getbaseindex  and
> > > > >> industry()  and things like that but I got no way to add 
both
> > > > >> marketid(0) and industryid (0)  in the same piece of code.
> > > > >>
> > > > >> Thanks!!
> > > > >>
> > > > >
> > > > >
> > > > >
> > > > >
> > > > *
> > > > *> 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 NEW RELEASE ANNOUNCEMENTS and other news always check 
DEVLOG:
> > > > > 
**http://www.amibroker.com/devlog/*<http://www.amibroker.com/devlog/>
> > > > *>
> > > > > For other support material please check also:
> > > > > 
**http://www.amibroker.com/support.html*<http://www.amibroker.com/supp
ort.html>
> > > > *>
> > > > > Yahoo! Groups Links
> > > > >
> > > > >
> > > > >    **mailto:amibroker-
fullfeatured@xxxxxxxxxxxxxxx*<amibroker-fullfeatured@xxxxxxxxxxxxxxx>
> > > > *>
> > > > >
> > > > >
> > > > > --
> > > > > No virus found in this incoming message.
> > > > > Checked by AVG Free Edition.
> > > > > Version: 7.5.516 / Virus Database: 269.20.4/1275 - Release 
Date:
> > > > 2/12/2008 3:20 PM
> > > > >
> > > > >*
> > > >
> > > >
> > >
> >  ------------------------------
> >
> > No virus found in this incoming message.
> > Checked by AVG Free Edition.
> > Version: 7.5.516 / Virus Database: 269.20.4/1275 - Release Date: 
2/12/2008
> > 3:20 PM
> >
> >  
> >
>




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 NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

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/

<*> 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:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto: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/