Louis,
I am not exactly sure what you are saying about running
against single ticker. It really isn't of value. As for multiple tickers, here
is the way I use it. On Auto Analysis screen I define Filter to be the watchlist
containing the stocks that I want to be included in the Composite, set time
frame, then run Scan. Thats it! I don't know how you ran your multiple tickers,
so I don't know what your problem was. You do understand that if the
watchlist has multipe symbols you still only get One composite of ALL the
symbols in that watchlist, not one for each stock?
Donald F Lindberg
Hi Don,
I tried to run this code using multiple-tickers and it
didn't work. So I tried to use it running individual tickers once at a
time but each new ticker overrides the previous one so the result is strictly
the last ticker I scanned. Do you know how to solve this
problem?
Thanks!
Louis
2008/3/8, Don Lindberg <dlindber@xxxxxxxxxxnet>:
Louis,
I have
pasted code below that will do what you want. This will give you ATC with
Open, High, Low, Close and Open Interest as counter.
Enjoy.
Donald F Lindberg
/* AddToComposite statements are
for Automatic Analysis -> Scan */
AddToComposite( 1* L,
"~MyIndex","L",1+2+4+8+16+128);
AddToComposite( 1* O, "~MyIndex","O",1+2+4+8+16+128);
AddToComposite( 1 * H, "~MyIndex","H",1+2+4+8+16+128);
AddToComposite( 1 * C, "~MyIndex","C",1+2+4+8+16+128);
AddToComposite( 1 * V, "~MyIndex","V",1+2+4+8+16+128);
/* add one to open intest field (we use
this field as a counter) */
AddToComposite( 1, "~MyIndex", "I"
);
Buy = 0; // required by scan mode
/* this part is for Indicator
*/
V1=Foreign( "~MyIndex", "C") ;
V2=Foreign( "~MyIndex", "I") ;
Plot
(( V1/V2),"My Index
Close",colorBlack,styleBar);
Hi Mike,
What I got from that link is this:
/* AddToComposite statements are for Automatic
Analysis -> Scan */ /* add Close price to our
index OHLC fields */ AddToComposite(Close,
"~MyIndex", "X" );
/* add one to open intest
field (we use this field as a counter) */
AddToComposite( 1, "~MyIndex", "I" );
Buy = 0;
// required by scan mode
/* this part is for
Indicator */ Graph0 = Foreign( "~MyIndex", "C"
)/Foreign( "~MyIndex", "I" );
The problem
with this code is that it only shows the close. Would it be possible
to get a custom index with opening, close, high, low, volume for the
stocks I would choose?
Thanks,
Louis
2008/3/7, Mike <sfclimbers@xxxxxxcom>:
Louis,
I answered your earlier post in message 120865. I
believe that Example 1 from the first link of that post is what you
are looking for.
Mike
--- In amibroker@xxxxxxxxxps.com, "Louis Préfontaine"
<rockprog80@x..> wrote: > > Hi
Mike, > > Do you know how to create an artificial index
with multiple tickers? > > Thanks, > >
Louis > > 2008/3/6, Mike
<sfclimbers@x..>: > > > >
Thomas, > > > > You only need to run the formula once
(use selected symbol option > > from AA window on any symbol),
then you can reference the symbol from > > any _other_
script as applied against any number of symbols. > > >
> Or, if you are trying to include the code segment within some
other > > script applied to multiple symbols, what about
wrapping the logic > > inside an if condition such that it only
gets executed the first time > > (e.g. use a static
variable to control the flow > > http://www.amibroker.com/guide/afl/afl_view.php?id=263
) > > > > ... > > if (StaticVarGet("ATCFlag")
!= 1) { > > AddToComposite(...); > >
AddToComposite(...); > > AddToComposite(...); >
> AddToComposite(...); > > StaticVarSet("ATCFlag",
1); > > } > > > > I've never used statics, so
double check the syntax above, and test > > what happens
when the variable is Null. > > > > > >
Mike > > > > --- In amibroker@xxxxxxxxxps.com
<amibroker%40yahoogroups.com>,
Thomas > > Ludwig <Thomas.Ludwig@> >
> wrote: > > > > > > Mike, > >
> > > > thanks for your reply. In fact, I had tried the
ATC solution > > before. The > > > problem: When
used as an indicator (as mentioned in my previous > >
post) > > > the chart looks as expected. However, with ATC
the Open, High, Low > > and > > > Close of both
time series are added up. Thus, the logic of my > >
formulas > > > that works for the indicator code doesn't
work with ATC. Any idea > > how > > > to modfiy
that? > > > > > > Best regards, > >
> > > > Thomas > > > > > > >
Have a look at AddToComposite > > > > http://www.amibroker.com/guide/afl/afl_view.php?id=7 >
> > > > > > >
AddToComposite(Foreign("846900","o"), "~MyDAX", "O"); > >
> > > > > >
AddToComposite(IIF(IsEmpty(Foreign("A0C4CA","h")),Foreign >
> > > ("846900","h"),Max(Foreign("846900","h"),Foreign >
> > > ("A0C4CA","h"))), "~MyDAX", "H"); > > >
> > > > >
AddToComposite(IIf(IsEmpty(Foreign("A0C4CA","l")),Foreign >
> > > ("846900","l"),Min(Foreign("846900","l"),Foreign >
> > > ("A0C4CA","l"))), "~MyDAX", "L"); > > >
> > > > >
AddToComposite(IIf(IsEmpty(Foreign("A0C4CA","c")),Foreign >
> > > ("846900","c"),Foreign("A0C4CA","c")), "~MyDAX",
"C"); > > > > > > > > New symbol ~MyDAX
will appear under Market253 fully populated > > > >
according to your logic. > > > > > > > >
Add flags for exploration and backtesting as needed. > > >
> > > > > Mike > > >
>
> > > > --- In amibroker@xxxxxxxxxps.com <amibroker% 40yahoogroups.com>, Thomas
> > Ludwig <Thomas.Ludwig@> > > >
> > > > > wrote: > > > > >
Hello, > > > > > > > > > > I want to
create an artificial ticker from two existing > > tickers.
If > > > > > > > > I do > > >
> > > > > > it this way: > > > >
> > > > > > O1=Foreign("846900","o"); > >
> > >
H1=IIf(IsEmpty(Foreign("A0C4CA","h")),Foreign ("846900","h"),Max >
> > > > > > >
(Foreign("846900","h"),Foreign("A0C4CA","h"))); > > >
> > > > > >
L1=IIf(IsEmpty(Foreign("A0C4CA","l")),Foreign ("846900","l"),Min >
> > > > > > >
(Foreign("846900","l"),Foreign("A0C4CA","l"))); > > >
> > > > > >
C1=IIf(IsEmpty(Foreign("A0C4CA","c")),Foreign > >
("846900","c"),Foreign > > > > > > > >
("A0C4CA","c")); > > > > > > > > >
PlotOHLC(O1,H1,L1,C1,"MyDAX",colorBlack,styleCandle); >
> > > > > > > > > > > > >
> ... I get it as an indicator - but that's not what I want.
In > > order > > > > > > > >
to > > > > > > > > > get an artificial
ticker I guess that I have to export the > > values >
> > > > > > > to an > > >
> > > > > > ASCII file and import it again using
fputs() and fgets() but I'm > > > > > > >
> not > > > > > > > > > sure how to
do it. Any suggestions would be highly welcome. > > > >
> > > > > > Regards, > > > >
> > > > > > Thomas > > > > >
> > > 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 > >
> > > > > > > > > > > >
> > > > > >
> >
__._,_.___
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
__,_._,___
|