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

[amibroker] Re: Code needed to always include a certain ticker in Explore ???



PureBytes Links

Trading Reference Links

Interaction with ApplyTo is already available via the COM interface. The usage pattern for dynamic ApplyTo would be to write a JScript/VBScript/etc. that uses automation to configure the COM model to your desired ApplyTo settings and then fire off the operation (e.g. exploration, backtest, optimization) before finally cleaning up.

Generally, it does not make sense to change the ApplyTo in mid execution. It's like being asked to shuffle a deck of cards and then being given more cards after you already started shuffling. Why didn't you just give me all the cards to begin with?!

Better, I think, would be to have a more flexible ApplyTo such that we could build up unlimited clauses with AND and OR operators. Specifically, the ability to have multiple clauses of the same type  (e.g. multiple watchlist clauses) as opposed to the existing implementation of single clause per type, all of which are ANDed together.

For example; In your use case you would put your reference symbol in a watchlist all by itself (say watchlist1) then run an exploration over watchlist1 AND watchlist2. This effectively allows you to say "shuffle this deck of cards, and these cards too" without impacting any other AFL that runs on watchlist2 without wanting the reference symbol in there.

In the current implementation you cannot do that since the existing UI only allows selecting a single watchlist clause. Thus, if you do not want to pollute your watchlist, you are currently forced to either create a separate watchlist into which all symbols are put, including reference symbol. Else, use automation to dynamically add/remove the reference symbol each run.

Mike

--- In amibroker@xxxxxxxxxxxxxxx, "gmorlosky" <gmorlosky@xxx> wrote:
>
> I'd also like to see something allowing the interaction with the "Apply To" include / exclude, which will really shorten the processing time over filtering...
> 
> 
> --- In amibroker@xxxxxxxxxxxxxxx, dingo <waledingo@> wrote:
> >
> > Your RunNext()  suggestion is a great idea!  I also think that would be
> > something TJ should add ASAP.
> > 
> > d
> > 
> > On Tue, Jun 9, 2009 at 8:21 AM, bruce1r <brucer@> wrote:
> > 
> > > Graham / Mike -
> > >
> > > I'd like to briefly offer a couple of suggestions about your comments
> > > regarding watchlists.  But, first the bottom line.  Adding the symbol to
> > > your watchlists in a two step (preferrably automated process) is the
> > > best way to save yourself some grief.  There are several different ways
> > > to do this.
> > >
> > > Mike - you were moving toward something I've used for a while but have
> > > never shown because of the special cases.  I'd call it dynamic
> > > watchlsits.  There is an easier way, though.  You were modifying the
> > > watchlist as it was being processed.  The easiest way to do this is
> > > simply detect the watchlist that is used in the filter and use
> > > CategoryWatchlist().  Because the entries are cached, the change is
> > > reflected in the AA Filter loop.  BUT, the issue is this.  The Filter
> > > loop processes issues in alpha order.  SO, the one(s) that you add need
> > > to be after stocknum 0 in the collating sequence.  I have used the
> > > technique in the past for app's that need to process dynamic watchlists.
> > > Now, I just use a two step process, as it is more straightforward.  But
> > > since you went down that path, here's some test code to show the
> > > technique -
> > >
> > > OAB         = CreateObject( "Broker.Application" );
> > > OAA            = OAB.Analysis;
> > > incwl        = OAA.Filter( 0, "watchlist" );
> > > ;  The symbol added must be after the first symbol in alpha order
> > > CategoryAddSymbol( "SPY", categoryWatchlist, incwl );
> > > Filter    = Status( "lastbarinrange" );
> > > AddColumn( C, "C", 8.2 );
> > >
> > > Graham - I totally agree with your conclusion about keeping it simple.
> > > I think that the issue with your second suggestion about using a sector
> > > or industry is that the long-known issue with the Filter interface is
> > > the lack of an "OR" operation.  If I understand what you were suggesting
> > > correctly, you'll find that multiple selections on the Include tab are
> > > an "AND" operation.  The Exclude tab effectively implements an "AND NOT"
> > > operation.  A simple "OR" interface has been long needed.
> > >
> > > P.S. This usage pattern of running a two step (AFL) job is so common,
> > > that I'd really like to see Tomasz add a RunNext() command for newer
> > > users that would execute a subsequent AFL after the current one
> > > completes.
> > >
> > > -- BruceR
> > >
> > >
> > >
> > > --- In amibroker@xxxxxxxxxxxxxxx, Graham <kavemanperth@> wrote:
> > > >
> > > > The simplest way is to just add the index symbol to your watchlist.
> > > > You will just tie yourself up into knots otherwise
> > > > If you use this watchlist for other items like trade system then just
> > > > include a condition eg. Buy = BuyConditions AND Name() != "^GSPC";
> > > >
> > > > Another simple method would be to have the index symbol in its own
> > > > group, eg an unused sector/industry. Then in exploring your watchlist
> > > > you can add this sector to your analysis window filter.
> > > >
> > > > --
> > > > Cheers
> > > > Graham Kav
> > > > AFL Writing Service
> > > > http://www.aflwriting.com
> > > >
> > > >
> > > >
> > > > 2009/6/9 Mike sfclimbers@:
> > >  > > You can cheat, explicitly doing what you are not supposed to do, by
> > > writing code to use the OLE interface to add your symbol to the
> > > watchlist as it is being iterated through, then use the API to remove
> > > your symbol at the end of the exploration.
> > > > >
> > > > > In my quick try, adding the symbol seemed to work e.g. assuming
> > > symbol AA and watchlist #2, add to watchlist on processing of first
> > > symbol.
> > > > >
> > > > > EnableScript("jscript");
> > > > >
> > > > > if ( Status( "stocknum" ) == 0 )
> > > > > {
> > > > > <%
> > > > >        AB = new ActiveXObject("Broker.Application");
> > > > >        Stocks = AB.Stocks;
> > > > >        Symbol = Stocks.Item("AA");
> > > > >        Symbol.WatchListBits |= 1 << 2;
> > > > > %>
> > > > > }
> > > > >
> > > > > I used JScript because AFL did not seem to natively support the <<
> > > operator used in the example found in the user guide
> > > > >
> > > > > http://www.amibroker.com/guide/objects.html
> > > > >
> > > > > Trying to remove it afterwards was not quite working in my quick
> > > test.
> > > > >
> > > > > Seems like a lot of fuss. What about writing a script to drive the
> > > OLE interface to include the symbol in all the watchlists that you want
> > > before running your exploration. Then run your explorations. Then run a
> > > cleaning script to remove the symbol from the watchlists after you're
> > > done?
> > > > >
> > > > > Moving the code I provided above to an "add to watchlist" script
> > > would probably do the job. Repeat the line Symbol.WatchListBits |= 1 <<
> > > ??? for each watchlist you want it to appear in.
> > > > >
> > > > > To remove from the watchlist try something along the lines of:
> > > > >
> > > > > <%
> > > > >        AB = new ActiveXObject("Broker.Application");
> > > > >        Stocks = AB.Stocks;
> > > > >        Symbol = Stocks.Item("AA");
> > > > >        Symbol.WatchListBits &= ~(1 << 2);
> > > > > %>
> > > > >
> > > > > None of the above is tested. And I have not spent the time to verify
> > > its validity or even the wisdom of the approach. But if you're
> > > determined to go down this road, it might help.
> > > > >
> > > > > Mike
> > > > >
> > > > > --- In amibroker@xxxxxxxxxxxxxxx, "gmorlosky" gmorlosky@ wrote:
> > > > >>
> > > > >> Understood... bummer..we really access to the Apply To: function.
> > > > >>
> > > > >> --- In amibroker@xxxxxxxxxxxxxxx, dingo <waledingo@> wrote:
> > > > >> >
> > > > >> > I already explained that to you in my msg above.  Read it again.
> > > > >> >
> > > > >> > d
> > > > >> >
> > > > >> >
> > > > >> > On Mon, Jun 8, 2009 at 6:18 PM, gmorlosky <gmorlosky@> wrote:
> > > > >> >
> > > > >> > > If I do an _TRACE (Tickerlist) the addon ticker is there.
> > > > >> > > I don't understand why it shows up in the indicator, but not in
> > > an Explore
> > > > >> > > ???
> > > > >> > >
> > > > >> > >
> > > > >> > >
> > > > >> > > --- In amibroker@xxxxxxxxxxxxxxx, dingo <waledingo@> wrote:
> > > > >> > > >
> > > > >> > > > by using the filter = 1 you're only going to get the tickers
> > > that are in
> > > > >> > > the
> > > > >> > > > watchlist - AB will only read from that list.
> > > > >> > > >
> > > > >> > > > Option 1. Use the watchlist and after the last ticker use the
> > > foreign on
> > > > >> > > a
> > > > >> > > > line by its self. I don't know if this will actually work.
> > > You'll have
> > > > >> > > to
> > > > >> > > > figure out a way to detect that the last ticker in the watch
> > > list had
> > > > >> > > been
> > > > >> > > > read by using the "Status" function.
> > > > >> > > >
> > > > >> > > > Option 2. Process the updated ticker list in a loop like
> > > you've done
> > > > >> > > > before.  When doing this don't use the filter and watchlist -
> > > just
> > > > >> > > current
> > > > >> > > > ticker.
> > > > >> > > >
> > > > >> > > > d
> > > > >> > > >
> > > > >> > >  > On Mon, Jun 8, 2009 at 5:13 PM, gmorlosky <gmorlosky@>
> > > wrote:
> > > > >> > > >
> > > > >> > > > > My test is simply to set my Filter = 1; (at the bottom of
> > > the code to
> > > > >> > > > > include all tickers in the output). I get all the watchlist
> > > tickers,
> > > > >> > > but,
> > > > >> > > > > not the additional ^GSPC ticker....
> > > > >> > > > > Tried:
> > > > >> > > > >
> > > > >> > > > > Tickerlist = Tickerlist + ",^GSPC"; // no results (included
> > > comma)
> > > > >> > > > > tickerlist=tickerlist AND Foreign("^GSPC","C"); // AND
> > > errors
> > > > >> > > > > tickerlist=tickerlist + Foreign("^GSPC","C"); // no results
> > > > >> > > > >
> > > > >> > > > > Any more ideas and what is a skew ?
> > > > >> > > > >
> > > > >> > > > >
> > > > >> > > > >
> > > > >> > > > >
> > > > >> > > > >
> > > > >> > > > > --- In amibroker@xxxxxxxxxxxxxxx, "Anthony Faragasso"
> > > <ajf1111@>
> > > > >> > > wrote:
> > > > >> > > > > >
> > > > >> > > > > > TRY:
> > > > >> > > > > >
> > > > >> > > > > > tickerlist=tickerlist and foreign("^GSPC","C");
> > > > >> > > > > >
> > > > >> > > > > >
> > > > >> > > > > >   ----- Original Message -----
> > > > >> > > > > >   From: gmorlosky
> > > > >> > > > > >   To: amibroker@xxxxxxxxxxxxxxx
> > > > >> > > > >  >   Sent: Monday, June 08, 2009 3:40 PM
> > > > >> > > > > >   Subject: [amibroker] Re: Code needed to always include
> > > a certain
> > > > >> > > ticker
> > > > >> > > > > in Explore ???
> > > > >> > > > > >
> > > > >> > > > > >
> > > > >> > > > > >
> > > > >> > > > > >
> > > > >> > > > > >
> > > > >> > > > > >   I have used Foreign for plotting, but I don't want to
> > > manually add
> > > > >> > > it
> > > > >> > > > > for each column.
> > > > >> > > > > >   I like the idea of an addon to the ticker list. I
> > > tried:
> > > > >> > > > > >   Tickerlist = CategoryGetSymbols( Tickercategory,
> > > ListNum );//
> > > > >> > > existing
> > > > >> > > > > code
> > > > >> > > > > >   Tickerlist = Tickerlist + "^GSPC"; // new code
> > > > >> > > > > >
> > > > >> > > > > >   but still not picking up on the extra ticker of ^GSPC
> > > (S&P500).
> > > > >> > > > > >
> > > > >> > > > > >   Any other ideas on properly concatenating a ticker to a
> > > list of
> > > > >> > > tickers
> > > > >> > > > > ???
> > > > >> > > > > >
> > > > >> > > > > >   --- In amibroker@xxxxxxxxxxxxxxx, "Anthony Faragasso"
> > > <ajf1111@>
> > > > >> > > > > wrote:
> > > > >> > > > > >   >
> > > > >> > > > > >   > you probably do something like:
> > > > >> > > > > >   >
> > > > >> > > > > >   > InWatchList( listno ) and "your ticker here";
> > > > >> > > > > >   >
> > > > >> > > > > >   > Anthony
> > > > >> > > > > >   > ----- Original Message -----
> > > > >> > > > > >   > From: gmorlosky
> > > > >> > > > > >   > To: amibroker@xxxxxxxxxxxxxxx
> > > > >> > > > > >   > Sent: Monday, June 08, 2009 3:08 PM
> > > > >> > > > > >   > Subject: [amibroker] Code needed to always include a
> > > certain
> > > > >> > > ticker
> > > > >> > > > > in Explore ???
> > > > >> > > > > >   >
> > > > >> > > > > >   >
> > > > >> > > > > >   >
> > > > >> > > > > >   >
> > > > >> > > > > >   >
> > > > >> > > > > >   > I would like to have a certain ticker (S&P500) always
> > > included as
> > > > >> > > one
> > > > >> > > > > of the tickers in the Explore. For example, I choose my
> > > watchlist that
> > > > >> > > has
> > > > >> > > > > ETFs only, BUT I want the explore to also have the S&P500
> > > ticker info,
> > > > >> > > for
> > > > >> > > > > relevance.
> > > > >> > > > > >   > I want to have the reference in the code, not include
> > > the S&P500
> > > > >> > > > > ticker in the watchlist.
> > > > >> > > > > >   > Thanks.
> > > >
> > >
> > >
> > >
> > >
> > > ------------------------------------
> > >
> > > **** 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
> > >
> > >
> > >
> > >
> >
>




------------------------------------

**** 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/