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

Re: [amibroker] Re: scrolling through a watchlist



PureBytes Links

Trading Reference Links

Your totally right actually. As long as the list is finite that should be fine. Im such a newbie at this coding though so the simplest things are difficult.
How do I say:
If current ticker belongs to watchlist1, then ticker1=F and ticker2=GM.

Ticker1 and Ticker2 are parts of my code. Then I figure I do it this way. Next writing if current ticker belongs to watchlist2 then ....
Then I run the code. I think that way would be the best.

--- On Wed, 12/17/08, Mike <sfclimbers@xxxxxxxxx> wrote:
From: Mike <sfclimbers@xxxxxxxxx>
Subject: [amibroker] Re: scrolling through a watchlist
To: amibroker@xxxxxxxxxxxxxxx
Date: Wednesday, December 17, 2008, 11:57 PM

What's wrong with the "both symbols in a single list" approach? I
believe that the assumption is that you would have multiple lists,
each with exactly two symbols (as you had originally suggested). Where
are you running into problems?

If it's a case of the script logic not being applicable from one pair
to the next, then the whole hard coding of names problem goes away
because each script would be customized to a pair and you could hard
code the names after all, as per Tomasz's example. Otherwise, were you
not able to dig out the names correctly using StrExtract?

Mike

--- In amibroker@xxxxxxxxx ps.com, jim fenster <normanjade@ ...> wrote:
>
> Ya that code isn't working very well. Also all the 1st part of the
pairs in one watchlists and the seconds in a second list can't really
work because its alphabetizing each list. So when I enter the orders
for the first list its fine, but then I get to the second list and it
alphabetizes that so it ruins the order with the first list. This is
tough man!
>
> --- On Mon, 12/15/08, Mike <sfclimbers@ ...> wrote:
> From: Mike <sfclimbers@ ...>
> Subject: [amibroker] Re: scrolling through a watchlist
> To: amibroker@xxxxxxxxx ps.com
> Date: Monday, December 15, 2008, 8:21 PM
>
>
>
>
>
>
>
>
>
>
>
> Hi,
>
>
>
> Sorry, it was not clear that you were wanting to act on both
symbols.
>
> I thought you were trying to buy from the first list only, based on
>
> signals/confirmatio n from the second list.
>
>
>
> As you've now discovered, the Foreign functionality allows access to
>
> foreign data, but it does not allow you to generate signals for that
>
> foreign symbol. To act on the symbol, it must appear in the
watchlist
>
> and be processed in turn.
>
>
>
> Tomasz has answered your question, which is the route that you were
>
> originally heading down. But, he did not address the hard coded
names
>
> that you were trying to avoid.
>
>
>
> To avoid the hard coded names of Tomasz's answer, Dingo gave you the
>
> answer, which is also what I used in my earlier sample.
Specifically;
>
> use StrExtract from the watchlist.
>
>
>
> Putting it all togeather...
>
>
>
> Again the symbols will be evaluated in alphabetical order, but
>
> CategoryGetSymbols will give the ordering as they appear in the
>
> watchlist (i.e. not necessarily alphabetized) . So, if it matters,
>
> populate your list such that the symbol you want to to be treated as
>
> first actually appears first in the watchlist, even though the
second
>
> may get run through the script before the first one.
>
>
>
> Buy = Sell = Short = Cover = 0;
>
>
>
> list = CategoryGetSymbols( categoryWatchlis t, 1);
>
> first = StrExtract(list, 0);
>
> opposite = StrExtract(list, 1);
>
>
>
> _TRACE(first + " and " + opposite);
>
>
>
> if (Name() == first) {
>
> SetForeign(opposite );
>
> // Read whatever you want from opposite data
>
> RestorePriceArrays( );
>
>
>
> Buy = ... enter long for first symbol
>
> Sell = ... exit long for first symbol;
>
> }
>
>
>
> if (Name() == opposite) {
>
> SetForeign(first) ;
>
> // Read whatever you want from first data
>
> RestorePriceArrays( );
>
>
>
> Buy = ... enter long for opposite symbol
>
> Sell = ... exit long for opposite symbol;
>
> }
>
>
>
> Mike
>
>
>
> --- In amibroker@xxxxxxxxx ps.com, jim fenster <normanjade@ ...>
wrote:
>
> >
>
> > Thanks so much. I tried it this way and I almost got it. Im
running
>
> it on the first watchlist and then using the setforeign(opposite );
>
> function. But Im having a problem. There are variables I declared
>
> early in the code. Then I say setforeign(opposite ); Then put in buy
>
> conditions based on those variables but I get no buys or sells in
>
> this foreign ticker. Only buys and sells in the first watchlist. How
>
> come?
>
> >
>
> > --- On Sun, 12/14/08, Mike <sfclimbers@ ...> wrote:
>
> > From: Mike <sfclimbers@ ...>
>
> > Subject: [amibroker] Re: scrolling through a watchlist
>
> > To: amibroker@xxxxxxxxx ps.com
>
> > Date: Sunday, December 14, 2008, 2:31 AM
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> > If you want to go down that route, you might consider
>
> just two lists,
>
> >
>
> > each with one side of the pair for each pair, rather than separate
>
> >
>
> > lists per pair.
>
> >
>
> >
>
> >
>
> > e.g.
>
> >
>
> > instead of:
>
> >
>
> > watchList1 = A,X
>
> >
>
> > watchList2 = M,Y
>
> >
>
> > watchList3 = I,Z
>
> >
>
> >
>
> >
>
> > do:
>
> >
>
> > watchList1 = A,I,M
>
> >
>
> > watchList2 = X,Z,Y
>
> >
>
> >
>
> >
>
> > Then you can run your script on watchList1, making indexed
>
> reference
>
> >
>
> > to the symbols in watchList2 as shown below.
>
> >
>
> >
>
> >
>
> > Note, however, that I rearanged watchList1 to be in alphabetical
>
> >
>
> > order before adding the indexed opposite symbols in watchList2.
>
> >
>
> >
>
> >
>
> > It appears that AmiBroker iterates through the active watchList in
>
> >
>
> > alphabetical order (regardless of the order that the symbols were
>
> >
>
> > added to the list). So, you must ensure that the indexed opposites
>
> in
>
> >
>
> > watchList2 will match their partner based on the assumption that
>
> the
>
> >
>
> > partners were sorted before being processed by your script.
>
> >
>
> >
>
> >
>
> > If your lists are expected to be relatively unchanging, this may
be
>
> >
>
> > an acceptable bit of book keeping.
>
> >
>
> >
>
> >
>
> > Buy = Sell = Short = Cover = 0;
>
> >
>
> >
>
> >
>
> > // Get opposites from second list, ordered as originally entered.
>
> >
>
> > list = CategoryGetSymbols( categoryWatchlis t, 2);
>
> >
>
> >
>
> >
>
> > // Get alphabetized index of current symbol from first list.
>
> >
>
> > index = status("stocknum" );
>
> >
>
> >
>
> >
>
> > // Extract opposite for the current symbol.
>
> >
>
> > opposite = StrExtract(list, index);
>
> >
>
> >
>
> >
>
> > _TRACE(Name( ) + " and " + opposite);
>
> >
>
> >
>
> >
>
> > SetForeign(opposite );
>
> >
>
> > // Do whatever you want with foreign opposite
>
> >
>
> > RestorePriceArrays( );
>
> >
>
> >
>
> >
>
> > Mike
>
> >
>
> >
>
> >
>
> > --- In amibroker@xxxxxxxxx ps.com, jim fenster <normanjade@ ...>
>
> wrote:
>
> >
>
> > >
>
> >
>
> > > thanks yes Im looking for something like this. In the end I have
>
> a
>
> >
>
> > code that at the beginning designates two symbols. ticker1=ibm ,
>
> >
>
> > ticker2=ge for example. Then I run the code.
>
> >
>
> > > The thing is, I have a few of them and I dont want to manually
>
> >
>
> > enter them. Instead I was thinking of putting a couple of tickers
>
> per
>
> >
>
> > watchlist. Then trying to call upon them by saying take each
>
> >
>
> > watchlist and make first symbol in watchlist = ticker1 and then
2nd
>
> =
>
> >
>
> > ticker2.
>
> >
>
> > > Then run code. Then take watchlist 2 and do the same thing and
>
> run
>
> >
>
> > code.
>
> >
>
> > > Is it possible to do that? How would I code that?
>
> >
>
> > >
>
> >
>
> > > --- On Wed, 12/10/08, Barry Scarborough <razzbarry@ ..> wrote:
>
> >
>
> > > From: Barry Scarborough <razzbarry@ ..>
>
> >
>
> > > Subject: [amibroker] Re: scrolling through a watchlist
>
> >
>
> > > To: amibroker@xxxxxxxxx ps.com
>
> >
>
> > > Date: Wednesday, December 10, 2008, 11:32 PM
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > > I an not sure what you are looking for. This program
>
> >
>
> > runs through a
>
> >
>
> > >
>
> >
>
> > > watch list and processes the the symbols individually. You can
do
>
> >
>
> > all
>
> >
>
> > >
>
> >
>
> > > sorts of things within SetForeign() and RestorePriceArrays( );
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > > Barry
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > > _SECTION_BEGIN( "Using SetForeign") ;
>
> >
>
> > >
>
> >
>
> > > SetChartOptions( 0, chartShowArrows | chartShowDates );
>
> >
>
> > >
>
> >
>
> > > Filename = StrLeft(_DEFAULT_ NAME(),StrLen( _DEFAULT_ NAME())-2)
;
>
> >
>
> > >
>
> >
>
> > > _N(Title = filename + StrFormat(" - {{DATE}} {{VALUES}} "));
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > > // parameters
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > > Watchlist = 10;
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > > // create comma separated list of symbols in the watch list
>
> >
>
> > >
>
> >
>
> > > list = CategoryGetSymbols( categoryWatchlist, watchlist );
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > > /*
>
> >
>
> > >
>
> >
>
> > > this gets the symbol name and the for loop will process every
one
>
> >
>
> > in
>
> >
>
> > >
>
> >
>
> > > the watch list for each bar. In an auto trading program it will
>
> run
>
> >
>
> > >
>
> >
>
> > > every time a tick is received
>
> >
>
> > >
>
> >
>
> > > */
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > > for( i = 0; ( sym = StrExtract( list, i ) ) != ""; i++ )
>
> >
>
> > >
>
> >
>
> > > {
>
> >
>
> > >
>
> >
>
> > > SetForeign(sym) ; // switches to the symbol array, OHLCVOi
>
> >
>
> > >
>
> >
>
> > > /*
>
> >
>
> > >
>
> >
>
> > > put your code here. You can create an include that will define
>
> the
>
> >
>
> > >
>
> >
>
> > > parameters for each symbol you have optimized and dynamically
>
> >
>
> > switch
>
> >
>
> > >
>
> >
>
> > > the parameters for the indicators. You can also dynamically
>
> switch
>
> >
>
> > to
>
> >
>
> > >
>
> >
>
> > > a different system for some symbols. Your imagination is the
>
> limit.
>
> >
>
> > >
>
> >
>
> > > */
>
> >
>
> > >
>
> >
>
> > > RestorePriceArrays( );
>
> >
>
> > >
>
> >
>
> > > }
>
> >
>
> > >
>
> >
>
> > > _SECTION_END( );
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > > --- In amibroker@xxxxxxxxx ps.com, jim fenster <normanjade@ ...>
>
> >
>
> > wrote:
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > If you have a code that works on two symbols, is it possible
>
> call
>
> >
>
> > >
>
> >
>
> > > upon the first and second tickers in the watchlist without
having
>
> >
>
> > to
>
> >
>
> > >
>
> >
>
> > > actually manually write the tickers? Like referring to them as
>
> 1st
>
> >
>
> > >
>
> >
>
> > > and 2nd ticker in this specific watchlist. possible?
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>


__._,_.___

**** IMPORTANT ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

*********************
TO GET TECHNICAL 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

*********************************




Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___