PureBytes Links
Trading Reference Links
|
Nils,
You dont really need this complicated code to do the job.
In general, the use of "" into CategoryRemoveSymbol( ) means current
stock, but current stock is from the WatchList you have defined in
*use filter
settings.
To search WL 0, find the MACD()>0 tickers and place them all into WL
12 , explore
*all stocks for the
* n=1 last quotations
with
ORigin=0;
destination=12;
CategoryRemoveSymbol( "", categoryWatchlist, destination );
Filter = InWatchList(ORigin) AND MACD()>0;
AddColumn(RSI(),"");
CategoryAddSymbol( WriteIf(Filter,Name(),"xyz"), categoryWatchlist,
12 );
//Hit View->RefreshAll
It will work for you and it is faster.
Dimitris Tsokakis
--- In amibroker@xxxxxxxxxxxxxxx, "qavatina" <qavatina@xxxx> wrote:
> Dimitris,
> "CategoryRemoveSymbol" doesn´t seem to work for me. I have to make
> the WL empty manually before i run the code, otherwise it will just
> sum up the old objects in WL with the new ones.
>
> Thank You for sending very intresting codes to this group!
>
> Nils
>
> --- In amibroker@xxxxxxxxxxxxxxx, "DIMITRIS TSOKAKIS"
<TSOKAKIS@xxxx>
> wrote:
> > Andrew,
> > this is much better and independent of various indicators values.
> > Note also that the "List" may be a conditional one, it may be
> created
> > as the code goes on and saved in an empty destination WL, like
> >
> > destination=12;
> > CategoryRemoveSymbol( "", categoryWatchlist, destination );
> > ORigin=0;
> > list1 = GetCategorySymbols( categoryWatchlist, ORigin );
> > List = "";
> > for( i = 0; ( sym = StrExtract( list1, i ) ) != ""; i++ )
> > {
> > SetForeign( sym);
> > y=LastValue(RSI());
> > if( y>65)
> > {List=List+Name()+",";
> > CategoryAddSymbol( Name(), categoryWatchlist, destination );}
> > }
> > ORdNum = Status("StockNum");
> > sym = StrExtract( List, ORdnum );
> > ticker = "";
> > result = 0;
> > if(sym != "")
> > {
> > SetForeign(Sym);
> > Ticker = Name();
> > //Start your code
> > Result = RSI();
> > //finish your code
> > RestorePriceArrays();
> > }
> > Filter = ticker!="";
> > SetOption("NoDefaultColumns",True);
> > AddTextColumn(ticker,"Ticker");
> > AddColumn(result," RSI ");
> > AddTextColumn(List,"");
> > // Hit View->RefreshAll
> >
> > Explore the database for the n=1 last quotations. The code will
> take
> > tickers from the origin WL0, apply the condition y>65, create a
> > new "WatchList" and save it into the destination WL12, ie
immitate
> > the procedure
> >
> > destination=12;
> > CategoryRemoveSymbol( "", categoryWatchlist, destination );
> > Filter = InWatchList(0) AND RSI()>65;
> > AddColumn(RSI(),"");
> > CategoryAddSymbol( WriteIf(Filter,Name(),"xyz"),
categoryWatchlist,
> > 12 );
> > // Hit View->RefreshAll
> >
> > This artificial "list" creation is very useful for Indicator
> builder
> > applications.
> > Dimitris Tsokakis
> > --- In amibroker@xxxxxxxxxxxxxxx, "Andrew" <a.perrin@xxxx> wrote:
> > > DT
> > > Yes the original filter was not the best choice, a better
choice
> > > would be
> > > Filter = ticker !="";
> > > Andrew
> > > --- In amibroker@xxxxxxxxxxxxxxx, "DIMITRIS TSOKAKIS"
> > > <TSOKAKIS@xxxx> wrote:
> > > > Andrew uses a nice trick.
> > > > Although ORdNum = Status("StockNum"); refers to the whole
> > > database,
> > > > he counts through it the specific list.
> > > > [comment the SetOption("NoDefaultColumns",True); line to see
> what
> > > I
> > > > mean]
> > > > The filter condition
> > > > Filter = result;
> > > > means
> > > > Filter = result!=0;
> > > > BTW, Andrew, what shall we do if, instead of RSI(), we have,
> for
> > > > example, MACD(), who may accept zero values ?
> > > > Dimitris Tsokakis
> > > >
> > > > --- In amibroker@xxxxxxxxxxxxxxx, "Andrew" <a.perrin@xxxx>
> wrote:
> > > > > Yuki
> > > > > Try this AFL, BUT TAKE CARE WHERE YOU INSERT YOUR CODE.
> This
> > > AFL
> > > > > uses foreign statements to perform your code on your list
of
> > > > > stocks. Place your code in the wrong place and the results
> you
> > > > will
> > > > > get won't relate to "list" stock. Stocks in report are
only
> > > those
> > > > > in your list, but they are displayed in order.
> > > > >
> > > > > List = "MSFT,INTC,BEAS,CSCO";
> > > > > ORdNum = Status("StockNum");
> > > > > sym = StrExtract( List, ORdnum );
> > > > > ticker = "";
> > > > > result = 0;
> > > > > if(sym != "")
> > > > > {
> > > > > SetForeign(Sym);
> > > > > Ticker = Name();
> > > > > //Start your code
> > > > > Result = RSI();
> > > > > //finish your code
> > > > > RestorePriceArrays();
> > > > > }
> > > > > Filter = result;
> > > > > SetOption("NoDefaultColumns",True);
> > > > > AddTextColumn(ticker,"Ticker");
> > > > > AddColumn(result,"RSI");
> > > > >
> > > > >
> > > > > Andrew
> > > > >
> > > > >
> > > > > --- In amibroker@xxxxxxxxxxxxxxx, Yuki Taga <yukitaga@xxxx>
> > > wrote:
> > > > > > Hi Andrew,
> > > > > >
> > > > > > Saturday, December 6, 2003, 7:08:59 AM, you wrote:
> > > > > >
> > > > > > A> Yuki I don't see any automatic sort taking place in
the
> > > first
> > > > > > A> column when I run the AFL, I have to Click to sort so
> the
> > > > > > A> solution is beyond me
> > > > > >
> > > > > > Actually, when I played with this some more, I got some
> > > > > understanding
> > > > > > of what is happening.
> > > > > >
> > > > > > When you turn off the default columns, they disappear,
but
> > only
> > > > > > visually in the case of 'ticker'. The initial report
order
> > will
> > > > > > apparently be sorted exactly the same as if that column
was
> > > still
> > > > > > present. Strange to me that an exploration would print to
> the
> > > > > screen
> > > > > > using a sort category that isn't even present in the
> report,
> > > but
> > > > > that
> > > > > > is surely what I'm seeing.
> > > > > >
> > > > > > It's not that bad to have to click on the myorder column
> head
> > > to
> > > > > > resort of course, but it was a disappointment to realize
> that
> > > > > dumping
> > > > > > the initial column that seemed to be controlling the
> initial
> > > sort
> > > > > > order was a complete waste of time.
> > > > > >
> > > > > > Yuki
------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark
Printer at MyInks.com. Free s/h on orders $50 or more to the US & Canada.
http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/GHeqlB/TM
---------------------------------------------------------------------~->
Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
|