PureBytes Links
Trading Reference Links
|
Hi,
So there is no way to make the market automatic for each symbol? (e.g. for MSFT it would be NASDAQ and for AA NYSE)?
So far here is what I got:
// Built-in relative performance chart with 3 EMA
// Par Louis Prefontaine
Ticker = GetBaseIndex();// plot industry, need to create composite sectors
for( i = 0; ( symbol = StrExtract( ticker, i ) ) != ""; i++ );
fc = Foreign( ticker,"C" );
fc1 = Foreign ("indu.x","C");
PlotGrid( 0, colorBrown);
_N( Title = "{{NAME}} - Relative Performance [%]: {{VALUES}}" );
ticker= ( 100 * ( fc - Ref( fc, -10 ))/Ref (fc,-10)) ;
Current= ( 100 * ( C - Ref (Close, -10) ) / Ref (Close, -10)) ;
ticker1= ( 100 * ( fc1 - Ref( fc1, -10 ))/Ref (fc1,-10)) ;
_SECTION_BEGIN("RS-Titre"); periods = Param( "Periods", 1, 1, 200, 1 );
Plot( Current ,_DEFAULT_NAME(), ParamColor( "color", colorRed ), ParamStyle("Style",styleDashed) ); _SECTION_END();
_SECTION_BEGIN("RS-Secteur"); periods = Param( "Periods", 1, 1, 200, 1 );
Plot( ticker ,_DEFAULT_NAME(), ParamColor( "Color", colorBlue ), ParamStyle("Style", styleDashed) ); _SECTION_END();
_SECTION_BEGIN("RS-Dow Jones"); periods = Param( "Periods", 1, 1, 200, 1 );
Plot( ticker1 ,_DEFAULT_NAME(), ParamColor( "Color", colorGreen ), ParamStyle("Style", styleDashed) ); _SECTION_END();
It works well with NYSE stocks, but I'd like some flexibility, been able to adapt to different markets. Instead of fc1 = Foreign ("indu.x","C"); that would have been nice if the market indice would change for each symbol.
What do you think about this?
Thanks!
Louis
p.s. Is it better for me to erase all the information previous to this message or is it ok to let it here? I read a message saying it was annoying and some people agreed whileo thers disagreed...
2008/2/16, Steve Dugas <sjdugas@xxxxxxxxxxx>:
Oops - forget to answer the first
question...
Yes, if you already have industries set up for base
index, I would just leave them there and make sure everything in Groups tab is
empty. Then you can use GetBaseIndex to get your industries, and you can easily
use Foreign or SetForeign functions to plot any broad mkt index like S&P,
Dow, NASD, etc..
----- Original Message -----
Sent: Saturday, February 16, 2008 9:34
PM
Subject: Re: [amibroker] Re: Trouble
trying to compare industry and market ...
OK - IndustryID function takes 1 arg. It can be
either 0 or 1. If you use 0, it returns a stock's industry *number*, so we can
test for that. If you use 1, it returns the stock's industry name, so we could
test for that also. It is easier to use the numbers than the names, but you
need to know them. You can use those 2 lines of code I gave you before to find
out the numbers and names of the different industries and then you can match
them up with their indexes.. So, just suppose for example
Gold stocks are industry #1 w/ index
XAU
Software stocks are industry #2 w/ index
SFT
etc, etc
You could do this to plot the
industry...
if (
industryID( 0 ) == 1 ) IndustryIDX = "XAU" // if stock assigned to ind
#1, select gold idx else if ( industryID( 0 ) == 2 ) IndustryIDX = "SFT" //
if assigned to ind #2, select software idx etc...
else IndustryIDX = "SPX" // default to SP500 if
stock not assigned to any industry
SetForeign( IndustryIDX );
Plot( Close, "Industry", colorBlack, styleCandle
);
RestorePriceArrays();
----- Original Message -----
Sent: Saturday, February 16, 2008 8:49
PM
Subject: Re: [amibroker] Re: Trouble
trying to compare industry and market ...
Hi Steve,
Thanks for your help.
My data
provider is IQ-Feed (DTN).
Ok, I read again your messages and others
messages as well. If I understand correctly, getbaseindex will return
the industry in the first place. So, if I simply decide to choose the
Dow Jones as the ultimate index, I might get my formula simply by using the
foreign command, is that right?
I'm still not sure about Graham's
code anyway, but I think I might use more flexibility with sector
index...
Ok, as an example, I can use:
AEM
with industry index XAU and market index
Indu.x TD.to with industry index c.ttfs.x (financial index)
and market index t0000.x (TSX) MSFT with industry index...
you get the idea.
I think I am pretty close to an answer to my
problem, thanks to you and to the ideas you gave me. I will try to
experiment with Graham formula but I am still not sure yet how it is suppose
to work and what is the purpose of
it.
Thanks!
Louis
2008/2/16, Steve Dugas <sjdugas@xxxxxxxxxxx>:
Louis - Let's start at the beginning
-
1. Who is your data provider? Different
providers can use different industry structures and use different tickers
for their industry indexes.
2. Can you give a couple of examples? Give me
3 stock tickers, the industries they belong to, and the ticker symbols for
those industries..
To get the info if you don't know
it, try running an Exploration on this code and sorting on the
different columns...
AddColumn( IndustryID( 0 ), "Industry
Number", 1.0 );
AddTextColumn( IndustryID( 1 ), "Industry
Name" );
-----
Original Message -----
Sent:
Saturday, February 16, 2008 8:03 PM
Subject:
Re: [amibroker] Re: Trouble trying to compare industry and market
...
Hi,
I don't understand what Graham posted to be
honest... I 'd need some examples I think.
I don't understand the
SectorIndex = "^XYZ"; // default if not specified
below if(sectorID()==1) SectorIndex = "^ABCD"; if(sectorID()==2)
SectorIndex = "^EFGH"; etc
part at all. Hmm.. What
does the 1 or 2 stand for? How to use the sectorid thing? I
don't understand this, even after looking at the "manual" (which should
have more examples)
Really, I think I must confuse everyone with
this. This is very very simple, really more simple than what
everyone seems to think.
What you told me was a good start
Steve. What I'd need now is a way to use the foreign command to
get the industry index I chose for each
stock.
Thanks,
Louis
2008/2/16, Steve Dugas <sjdugas@xxxxxxxxxxx>:
See the code Graham just
posted. IndustryID() function works for industries same
way that SectorID() function works for sectors. There is also a
MarketID() function for markets...
-----
Original Message -----
Sent:
Saturday, February 16, 2008 7:24 PM
Subject:
Re: [amibroker] Re: Trouble trying to compare industry and market
...
Hi Steve,
Thanks for this information; at
least I understand partly now how the getbaseindex
works...
Is there any way to get the other things.. I mean:
how do you use the foreign command to get the industry (considering
that I did use getbaseindex for market)? I looked at your
previous message but I was not sure. Is it possible to write
something like "foreign (IndustryID, "C")"? How to get that
second information?
Thanks!!
Louis
2008/2/16, Steve Dugas <sjdugas@xxxxxxxxxxx>:
Louis - you can only use BaseIndex()
for *one* category - you must choose either groups, industries,
sectors or markets. Then you must find another method to get the
other things. That is what my codes do. Here is TJ's answer to a
question that I asked him years ago...
Steve,
The order in which AmiBroker looks up
for base index is:
Group
Industry
Market
Preferences
(the first found is used, so in your case
Industry setting will take precedence)
-----
Original Message -----
Sent:
Saturday, September 07, 2002 6:41 AM
Subject:
[amibroker] TJ - base indexes
Hi,
What happens if I set up Base Indexes
for industries and also for markets?
I have already set up the Base Indexes
for my indusries, so now, for example, if I am
viewing an Auto Parts stock, AB automatically uses the Auto
Parts index to calculate RelStrength. If I now set up Base
Indexes for my markets, which one will be used in the
calculation, , the industry index or the market index? Sorry to
ask before trying it, but I have discovered that AB will not let
me blank out these fields after filling them in - or is
there something special that I need to do?. Thanks very
much!
Steve
-----
Original Message -----
Sent:
Saturday, February 16, 2008 6:43 PM
Subject:
Re: [amibroker] Re: Trouble trying to compare industry and
market ...
Hi,
In fact, I want to use baseindex both
for market and industry. I really have trouble explaining
what I need. I thought it was clear but maybe I just don't
know how to say it. I will try again.
I need BOTH market index and industry index.
You
are right; I want to assign the industry/sector stock by
stock. It is very long, but once it is done it is done.
So, basically, what I need is very very very simple: I
want to be able to assign a variable for the base index and another variable for the
industry index. That's it. Really, I just can't
explain it in any other way. If someone could simply tell
me what is the correct 2 lines code for that (e.g. Foreign
(IndustryID, "C") etc.) and that's ll be allright! I am
sure there is someone out there who knows how to do
this!
This is really not complicated:
variable a =
(market index) variable b = (industry
index)
Considering I already entered the specific indexes
for each stock by clicking on the stock and clicking
"information" and choosing the right category for each
stock.
Thanks,
Louis
2008/2/16, Steve Dugas <sjdugas@xxxxxxxxxxx>:
Louis - I think what you may
want to do is use BaseIndex to assign the industry, since
there are lots of them. It takes an hour or so to set it up
but works great afterwards. Then you can use other AFL like
Foreign(), etc for simpler task of retrieving
Sector, Market, etc. I don't know who your data provider
is but I wrote some code a few years ago that does what you
want for TC2K data, which you may find helpful. To
get the code, go to the AmiBroker-AFL Yahoo group, files
section, Steve Dugas folder, download Relative
Performance.zip and look through the codes. It has been a few
years, but I will try to help if you have questions about the
codes.
Steve
-----
Original Message -----
Sent:
Friday, February 15, 2008 8:12 PM
Subject:
Re: [amibroker] Re: Trouble trying to compare industry and
market ...
Hi Brian,
Thank you for your
help. There was some confusion with my messages.
As I said earlier, english is not my first language so maybe
I was not clear enough. What I want to do is the same
thing from the start: find a way to assign a variable that
will give me me the sector or industry index, like I am
already able to do with the base index.
Right
now, I can double-click on the stock, and enter indu.x
for the base index, and let's say xau.x for the industry
index, but whatever I do, I just can't use that industry
index. I need to manually enter "foreign ("xau.x,
"c")" which is not good because I want to build a
system based on that on which I would be able to assign a
variable for the base index AND a variable for the industry
index.
I just need to understand how to make it
possible. When I use the "getbaseindex" I can only get
the market index (indu.x, comp.x, etc.); I would like to
know how to get the industry index or the sector index which
I already entered at the correct place.
I am really
sorry if I made your head spin with this. I thought I
explaine the problem correctly at first, but now I realize
that it wasn't all that clear!
Thanks for your
help!
Louis
2008/2/15, brian_z111 <brian_z111@xxxxxxxxx>:
Louis,
The problem is you started out wanting to
plot three symbols in one chart, then you wanted to
make it automatic (based on the stock chosen) and now
you want to manipulate variables as well.
When
people started to answer one of those questions you didn't
go with them.
Also, you are trying to do
complex things without outstanding the basics. I am
not really a coder. I only get things done because I try
to understand the basics and keep it simple.
I
don't know where to start to try to help you because you
are making my head spin.
I can try to help you
with the first part - at least you will see three
symbols plotted in one chart to get a feel for what you
are trying to do.
Perhaps you have already done
this but I'm doing it for my benefit (I am trying to
find your starting line).
Using three symbols from
Yahoo as the example - ^OEX for the market, ^XAU for
the gold index and ABX Barrick GoldCorp as the
stock.
1) Make ^OEX the current chart. 2) Go to
Charts >> Basic >> RelativePerformance and
double click on it. 3) Enter ^XAU and ABX in the
parameters input box that opens OR right click in the
chart and select parameters to do enter the
symbols.
If you right click inside the chart and
select Edit Formula you can see the code Tomasz used
to create the chart.
First yoy need to understand
how he made the plots relative to each other by
standardizing to the close value on the first
bar.
Then you could do three symbol charts yourself
by using plotforeign twice and adding code to find the
first bar close then calculating and plotting them
relative to the first bar close of one of them.
If
you are OK with that someone might be around to help you
with step 2 (Patrick already showed one promising way
in).
Theres always more than one way to do
things.
brian_z
brian_z
--- In
amibroker@xxxxxxxxxxxxxxx, "Louis
Préfontaine" <rockprog80@xxx>
wrote: > > Hi Brian, >
> I am already able to compare one stock with one
base index; the only thing I > can't do is add
the industry or sector index to that. > > I
already have a variable for the stock and for the
index. > > //fc is for the index >
> ticker= ( 100 * ( fc - Ref( fc, -10 ))/Ref
(fc,-10)) ; > Current= ( 100 * ( C - Ref (Close,
-10) ) / Ref (Close, -10)) ;à > > Basically,
all I want is to add a third variable which would take
the > industryID or sectorID so I would be able
to add it to the package. > > You are right;
if I was more fluent in English probably the first
time > everyone would have said "ahah!" and you
would have understood then how easy > it should
be for people who know how AFL works. I am sure this is
easy; I > just don't get it...yet! >
> > Thanks! > > Louis >
> > 2008/2/15, brian_z111
<brian_z111@xxx>: > > > >
Hello Louis, > > > > Understandably
language makes it harder - just like when I was in >
> France. > > > > The main problem I
think is that you are mixing two ideas and the >
> second one is a little more complex. Also you are
switching between > > them so it makes it
harder for people to follow. > > > > 1)
You want to plot, for example, S&P500 (Market), ^XAU
(Gold Index) > > and ABX (stock e.g. Barrick
Gold) on one chart for comparison. > > >
> 2) When you plot the stock you want the corresponding
Index and > > Stock to Market to automatically
plot. > > > > Is that correct? >
> > > If so - can you do step 1? >
> > > I think Bill gave you a workable answer
for step 1? > > > > Yes,step2 can be
done - probably a few ways but maybe the forum
won't > > come up with the super deluxe
version - I don't know. > > > > Also -
you must have seen these. > > > > http://www.amibroker.com/guide/afl/afl_view.php?id=96
>
> > > http://www.amibroker.com/guide/afl/afl_view.php?id=134
>
> > > I don't know if I will try step 2 or
not. > > > > brian_z >
> > > --- In amibroker@xxxxxxxxxxxxxxx
<amibroker%40yahoogroups.com>, > >
"louisprefontaine" <rockprog80@> > >
wrote: > > > > > > Anyone can help
me? > > > > > > Yhis should not be
complicated for someone who knows AFL more
than > > me. > > > > >
> I am looking for: > > > > >
> > > > variablea = //get the
marketID > > > variableb = //get the
industryID > > > > > > That's
about it. > > > > > >
Thanks, > > > > > > Louis >
> > > > >
> > > --- In amibroker@xxxxxxxxxxxxxxx
<amibroker% 40yahoogroups.com>, "Louis >
> Préfontaine" <rockprog80@> > > >
wrote: > > > > > > > >
Hi, > > > > > > > > Hmm...
Maybe I am not clear enough, or what I am saying
is > > confusing. I > > > > will
try to explain it another way. > > >
> > > > > Right now when I choose a
stock, I can decide the market, the > > >
industry, and > > > > the sector. As an
example, AA is in the NYSE and I chose the > >
composite > > > > index indu.x for that
market. And YHOO is in the Nasdaq and I > >
chose > > > > comp.xfor the Nasdaq. I have
absolutely no problem getting those > > >
> index and do > > > > whatever I need I
have to do with them. My problem is that I > >
can't > > > get the > > > >
industry or sector index. Per example, AEM is in NYSE but
I want > > to > > >
compare > > > > DJI with GLD along with the
stock. Right now I can't do it. I > > can >
> > get the > > > > base market
index, but not the industry index. > > >
> > > > > I already wrote this
code > > > > > > > > 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)) ; > > > > > > > >
and what I need is a way to get a variable (let's say
fc1... or > > ticker1) > > > >
that would represent the sector/industry index already
linked to > > the > > >
stock. > > > > So all I need is a way to
get to that industry/sector index to be > >
> able to > > > > assign it to a
variable and then use that variable and write,
as > > an > > > example: >
> > > > > > > ticker1= ( 100 * (
fc1 - Ref( fc1, -10 ))/Ref (fc1,-10)) ; > > >
> > > > > I don't understand how to get
both the market index and the > > >
sector/industry > > > > index. > >
> > > > > > Thank you very much for
helping me with this issue. I am still > >
learning > > > > (got a long way to go) but
reading you guys sure helps me. > > >
> > > > > Louis > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
2008/2/13, gmorlosky <gmorlosky@>: > > >
> > > > > > > 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
<amibroker%
40yahoogroups.com><amibroker%
> > 40yahoogroups.com>, "Louis >
> > > > Préfontaine" > > > >
> <rockprog80@> 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@>: > > > > > >
> > > > > > > > *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@> > > > > > > >
*To:* amibroker@xxxxxxxxxxxxxxx
<amibroker%
40yahoogroups.com><amibroker% >
> 40yahoogroups.com> > > >
> > > > *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@>: > > > > > > >
> > > > > > > > > what data
source are you using? > > > > > >
> > > > > > > > > >
d > > > > > > > > > >
> > > > > >
------------------------------ > > > > >
> > > *From:* amibroker@xxxxxxxxxxxxxxx<amibroker%
40yahoogroups.com><amibroker% >
> 40yahoogroups.com> > > >
> > [mailto:amibroker@xxxxxxxxxxxxxxx
<amibroker% 40yahoogroups.com><amibroker% >
> 40yahoogroups.com>] *On > >
> > > > > > Behalf Of *Louis
Préfontaine > > > > > > > >
*Sent:* Wednesday, February 13, 2008 11:19 AM > >
> > > > > > *To:* amibroker@xxxxxxxxxxxxxxx
<amibroker% 40yahoogroups.com><amibroker%
> > 40yahoogroups.com> > > >
> > > > > *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@>: > > > > > > >
> > > > > > > > > > >
*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@*
<rockprog80@>*>* > > > > > >
> > > *To: > > > <**amibroker@xxxxxxxxxxxxxxx
<%2A%2Aamibroker%40yahoogroups.com> > >
<%2A%2Aamibroker%40yahoogroups.com>* > >
> > > > > > > > <amibroker@xxxxxxxxxxxxxxx
<amibroker%
40yahoogroups.com><amibroker%40yahoogroups.com>>*>*
> > > > > > > >
> *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
<%2A%2Aamibroker%40yahoogroups.com> > >
<%2A%2Aamibroker%40yahoogroups.com>* > >
> > > > > > > > <amibroker@xxxxxxxxxxxxxxx
<amibroker%
40yahoogroups.com><amibroker%40yahoogroups.com>>
> > > > > > > >
> *, "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
<fullfeatured%
40yahoogroups.com><fullfeatured%40yahoogroups.com>*<
>
> > > > > > > amibroker-fullfeatured@xxxxxxxxxxxxxxx<amibroker-fullfeatured%
40yahoogroups.com> > >
<amibroker-fullfeatured% > > 40yahoogroups.com> > > >
> > > > > > > > > > >
> *> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > >
-- > > > > > > > > > > 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
__,_._,___
|