PureBytes Links
Trading Reference Links
|
TA
You can just call CategoryAddSymbol() in the code that creates the
composite, immedately after creating the composite:
AddToComposite(yourarray,CompositeName,"C",65);
CategoryAddSymbol(CompositeName, *categoryWatchlist*, 61);
Brenton
ta wrote:
>
>
> Bruce, Thanks for your help. I did figure it out. I should have used
> var Ticker in my if statement and in CategoryAddSymbol. Sometimes
> small stupidity creates big problems. The following is the completed
> code.
>
>
>
> TickerList = CategoryGetSymbols( *categoryGroup*, 253);
> *for*( i=0; (Ticker=StrExtract( TickerList, i)) != ""; i++)
> {
> *if* ((StrLeft(Ticker,1)=="~") *AND* (StrLeft(Ticker,3)!="~~~"))
> {
> CategoryAddSymbol(Ticker, *categoryWatchlist*, 61);
> }
> }
> *Buy*=0;
>
>
>
> *From:* amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx]
> *On Behalf Of *Bruce
> *Sent:* Wednesday, September 30, 2009 6:37 PM
> *To:* amibroker@xxxxxxxxxxxxxxx
> *Subject:* [amibroker] Re: Add addtocompiste generated ticker to a
> watchlist
>
>
>
>
>
> TA -
>
> Debugging from afar can be tough, and I'm having a little trouble
> following what the results were when you ran the AFL with the for loop
> that I replied with. You said -
>
> "If I scan only on the current symbol, It would only add that on
> symbol (although the trace statement shows all symbols were added)."
>
> SO, let's take it one step at a time. When you run the following
> program with some additional trace as a Scan on the Current Symbol
> from the AA window (not from JScript) - what does it report in the
> trace on the first line, "Group = ", and the last line, "Watchlist
> after = " ?
>
> TickerList = CategoryGetSymbols( categoryGroup, 253);
> _TRACE( "Group = " + tickerlist );
> for( i=0; (Ticker=StrExtract( TickerList, i)) != ""; i++)
> {
> if ( StrLeft( ticker, 1 ) == "~" AND
> StrLeft( ticker, 3 ) != "~~~" )
> {
> CategoryAddSymbol(ticker, categoryWatchlist, 61);
> _TRACE( "Added - " + ticker );
> }
> }
> _TRACE( "Watchlist after = " + CategoryGetSymbols( categoryWatchlist,
> 61 ) );
> Buy=0;
>
> If this works, then you can layer the JScript on it and debug further.
>
> -- BruceR
>
> --- In amibroker@xxxxxxxxxxxxxxx <mailto:amibroker%40yahoogroups.com>,
> "ta" <tagroups@xxx> wrote:
> >
> > Bruce
> >
> > I tried the following code and it did not work. The issue is that if I
> > select "current Symbol" it does not add any ticker to the watchlist.
> If I
> > select all tickers then it add all the correct symbols to the
> watchlist but
> > it take 19 minutes. I understand your point that selecting "current
> symbol"
> > should be sufficient because the afl code should retrieve from group
> 253 and
> > then loop thru them.
> >
> >
> >
> > AB = new ActiveXObject("Broker.Application");
> >
> > AB.LoadDatabase("c:\\Amibroker\\DataAIQRecon");
> >
> > AB.Visible = true;
> >
> >
> >
> > AA = AB.Analysis;
> >
> > AA.ClearFilters();
> >
> > AA.ApplyTo = 1; // use symbols
> >
> > AA.RangeMode = 3; // Last Day
> >
> >
> >
> > AA.LoadFormula("c:\\amibroker\\Formulas\\Addcomposite tickers to
> > Watchlist.afl");
> >
> > AA.Scan();
> >
> >
> >
> > From: amibroker@xxxxxxxxxxxxxxx <mailto:amibroker%40yahoogroups.com>
> [mailto:amibroker@xxxxxxxxxxxxxxx
> <mailto:amibroker%40yahoogroups.com>] On Behalf
> > Of Bruce
> > Sent: Wednesday, September 30, 2009 11:26 AM
> > To: amibroker@xxxxxxxxxxxxxxx <mailto:amibroker%40yahoogroups.com>
> > Subject: [amibroker] Re: Add addtocompiste generated ticker to a
> watchlist
> >
> >
> >
> >
> >
> > TA -
> >
> > I have to go out, so let me see if I can explain quickly.
> >
> > 1. The AFL will add all symbols from group 253 that satisfy the
> condition.
> > You only need to use the current symbol because the symbol loop is built
> > into the AFL. If you want to run it again group 253, you would set
> the Apply
> > To to Use Filter and the group to 253. If you did that, AA is looping
> > through the symbols for you and you would only need -
> >
> > if ( StrLeft( Name( ), 1 ) == "~" AND
> > StrLeft( Name( ), 3 ) != "~~~" )
> > {
> > CategoryAddSymbol( Name( ), catgorywatchlist, 61 );
> > }
> >
> > 2. See above for how to code what you expressed -
> >
> > "I had the following two conditions is that all my composite tickers
> have
> > one "~" as the first character in their symbol. I also want to
> exclude all
> > equity tickers that have "~~~" as the first three characters in their
> > symbols."
> >
> > Note - this will process anything that begins with "~" including for
> > example, "~ABC". This may or may not be what you want.
> >
> > -- BruceR
> >
> > --- In amibroker@xxxxxxxxxxxxxxx
> <mailto:amibroker%40yahoogroups.com>
> <mailto:amibroker%40yahoogroups.com> , "ta"
> > <tagroups@> wrote:
> > >
> > > Thanks Bruce. If I scan only on the current symbol, It would only
> add that
> > > on symbol (although the trace statement shows all symbols were
> added). The
> > > reason I had the following two conditions is that all my composite
> tickers
> > > have one "~" as the first character in their symbol. I also want to
> > exclude
> > > all equity tickers that have "~~~" as the first three characters
> in their
> > > symbols. TIA
> > >
> > >
> > >
> > > if ((StrLeft(Name(),1)=="~") AND (StrLeft(Name(),2)!="~~"))
> > >
> > >
> > >
> > > From: amibroker@xxxxxxxxxxxxxxx
> <mailto:amibroker%40yahoogroups.com> <mailto:amibroker%40yahoogroups.com>
> > [mailto:amibroker@xxxxxxxxxxxxxxx
> <mailto:amibroker%40yahoogroups.com>
> <mailto:amibroker%40yahoogroups.com> ] On
> > Behalf
> > > Of Bruce
> > > Sent: Wednesday, September 30, 2009 10:34 AM
> > > To: amibroker@xxxxxxxxxxxxxxx <mailto:amibroker%40yahoogroups.com>
> <mailto:amibroker%40yahoogroups.com>
> > > Subject: [amibroker] Re: Add addtocompiste generated ticker to a
> watchlist
> > >
> > >
> > >
> > >
> > >
> > > Close. See changes and run the following as a SCAN on the CURRENT
> SYMBOL
> > > only -
> > >
> > > TickerList = CategoryGetSymbols( categoryGroup, 253);
> > > for( i=0; (Ticker=StrExtract( TickerList, i)) != ""; i++)
> > > {
> > > if (StrLeft(ticker, 2)=="~~")
> > > {
> > > CategoryAddSymbol(ticker, categoryWatchlist, 61);
> > > _TRACE( "Added - " + ticker );
> > > }
> > > }
> > > Buy=0;
> > >
> > > -- BruceR
> > >
> > > --- In amibroker@xxxxxxxxxxxxxxx
> <mailto:amibroker%40yahoogroups.com> <mailto:amibroker%40yahoogroups.com>
> > <mailto:amibroker%40yahoogroups.com> , "ta"
> > > <tagroups@> wrote:
> > > >
> > > > Since, I did not hear from anybody I assume that there is not a
> way. As
> > a
> > > > result I wrote the following code to read the addtocomposite created
> > > tickers
> > > > from group 253 and add them to watchlist 61. However, it takes
> about 19
> > > > minutes to do this. Does anybody see a way to improve the speed
> of my
> > > code?
> > > > Perhaps Tomasz can comment on why this process is so slow? TIA
> > > >
> > > >
> > > >
> > > > TickerList = CategoryGetSymbols( categoryGroup, 253);
> > > > for( i=0; (Ticker=StrExtract( TickerList, i)) != ""; i++)
> > > > {
> > > > if ((StrLeft(Name(),1)=="~") AND (StrLeft(Name(),2)!="~~"))
> > > > CategoryAddSymbol("", categoryWatchlist, 61);
> > > > }
> > > >
> > > > Buy=0;
> > > >
> > > >
> > > >
> > > > From: amibroker@xxxxxxxxxxxxxxx
> <mailto:amibroker%40yahoogroups.com> <mailto:amibroker%40yahoogroups.com>
> > <mailto:amibroker%40yahoogroups.com>
> > > [mailto:amibroker@xxxxxxxxxxxxxxx
> <mailto:amibroker%40yahoogroups.com> <mailto:amibroker%40yahoogroups.com>
> > <mailto:amibroker%40yahoogroups.com> ] On
> > > Behalf
> > > > Of ta
> > > > Sent: Tuesday, September 29, 2009 9:56 PM
> > > > To: amibroker@xxxxxxxxxxxxxxx
> <mailto:amibroker%40yahoogroups.com> <mailto:amibroker%40yahoogroups.com>
> > <mailto:amibroker%40yahoogroups.com>
> > > > Subject: [amibroker] Add addtocompiste generated ticker to a
> watchlist
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > I did not see a flag that would add a ticker created by
> addtocomposite
> > > > function to a watchlist. Is there a way of doing this as the new
> tickers
> > > are
> > > > created? TA
> > > >
> > >
> >
>
>
>
>
> __________ Information from ESET NOD32 Antivirus, version of virus
> signature database 4471 (20090930) __________
>
> The message was checked by ESET NOD32 Antivirus.
>
> http://www.eset.com
__________ Information from ESET NOD32 Antivirus, version of virus signature database 4471 (20090930) __________
The message was checked by ESET NOD32 Antivirus.
http://www.eset.com
------------------------------------
**** 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/
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/
|