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

[amibroker] Sell after X days since buying



PureBytes Links

Trading Reference Links

Tomasz,
Do you really thing your code works ?
Did you really try it , in your amibroker, before posting it ?
Don't you really know how Foreign( sym, "C", False ) works ?
[it is your choice and you should know the very strange way False 
works : 
If a stock XXX  is missing the last 5 days of the user defined base 
index [in Symbol->Categories->] and the last available bar ic C=100, 
then the [strange !!] result of  Foreign( "XXX", "C", False ) will be 
{empty}
100
{empty}
100
{empty}
Please open the IB, paste your code, put in your WL20 3 stocks and 
cause 10 holes at the end of one stock and then see the ziggy 
result : WL20 has 2 tickers, 3 tickers, 2 tickers, 3 tickers etc.
If I had not spent 3 years with this great software, I would ask the 
very simple question :
"Sorry sir, how many tickers belong to WL20 in final analysis ???"
But, I have spent a lot of my time with your software. 
It was my choice and I don't think I was wrong. 
I am more than sure that you will see the problem, no matter if you 
fix it or not, and you will give a more serious reply. 
With all due respect
Dimitris 
--- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko" <amibroker@xxxx> 
wrote:
> Hello,
> 
> > The only safe way to count [and use it as a daily function] is 
> > through AddToComposite() function.
> This is NOT entirely true. 
> The code you are using counts simply the number of items in comma 
separated
> list of tickers. There are 3 strings so the result is thee.
> 
> BUT THERE IS NOTHING THAT PREVENTS US FROM COUNTING ON BAR BY BAR 
BASIS
> and this does NOT really require AddToComposite, see the code below:
> 
> //Count tickers in watchlist function 
> //For Indicator Builder 
> WatchlistNumber=Param("Watchlist",20,0,63,1) ;//enter watchlist 
number 
> function CountTickersInWatchList( Listnum ) 
> { 
>    // retrive comma-separated list of symbols in watch list 
>      list = GetCategorySymbols( categoryWatchlist, listnum ); 
>    Counter=0; // INITIALIZE COUNTER 
> 
>    for( i = 0; ( sym = StrExtract( list, i ) ) != ""; i++ ) 
>    { 
>      // TO COUNT BAR BY BAR YOU HAVE TO USE ARRAYS NOT SCALAR AND 
USE FOREIGN TO FIND OUT HOLES
>      Counter=Counter + ( NOT IsNull( Foreign( sym, "C", 
False ) ) ); 
>    } 
> 
>    return Counter; 
> } 
> 
> Title="Watchlist # "+WriteVal(watchlistnumber,1)+" has "+ 
> CountTickersInWatchList( WatchlistNumber) + " Tickers"; 
> Plot(CountTickersInWatchList( WatchlistNumber) ,"",1,1); 
> Plot(Foreign("~count","v"),"",4,2); 
> 
> Best regards,
> Tomasz Janeczko
> amibroker.com
> ----- Original Message ----- 
> From: "DIMITRIS TSOKAKIS" <TSOKAKIS@xxxx>
> To: <amibroker@xxxxxxxxxxxxxxx>
> Sent: Saturday, February 28, 2004 9:45 AM
> Subject: [amibroker] Re: empty scan of a watchlist (?)
> 
> 
> > Anthony,
> > One important detail !
> > The code counts the symbols of WLxx, it DOES NOT give the 
population 
> > of WLxx in daily basis.
> > If you have 3 tickers in WL20 and there are some missing data, 
the 
> > result will still be 3.
> > The only safe way to count [and use it as a daily function] is 
> > through AddToComposite() function.
> > Try to delete some quotations in WL20 stocks, run the
> > AddToComposite(1,"~count","v");
> > Buy=0;
> > for WL20 and then plot the
> >  //Count tickers in watchlist function
> > //For Indicator Builder
> > WatchlistNumber=Param("Watchlist",20,0,63,1) ;//enter watchlist 
number
> > function CountTickersInWatchList( Listnum )
> > {
> > // retrive comma-separated list of symbols in watch list
> > list = GetCategorySymbols( categoryWatchlist, listnum );
> > for( i = 0; ( sym = StrExtract( list, i ) ) != ""; i++ )
> > {
> > Count1=i;
> > }
> > return i;
> > }
> > Title="Watchlist # "+WriteVal(watchlistnumber,1)+" has "+
> > CountTickersInWatchList( WatchlistNumber) + " Tickers";
> > Plot(CountTickersInWatchList( WatchlistNumber) ,"",1,1);
> > Plot(Foreign("~count","v"),"",4,2); 
> > and you will see.
> > [We have a recent discussion with Stephane on the same subject.]
> > The reason should be simple: If WL20 includes IBM, INTC and MSFT, 
> > then there should be somewhere an inside  syntax 
> > WL20="IBM,INTC,MSFT", in other words WL20 should be nothing but a 
> > comma separated string. This fact does not include any info about 
> > missing [or excessive] bars.
> > Dimitris Tsokakis
> > --- In amibroker@xxxxxxxxxxxxxxx, "Anthony Faragasso" 
<ajf1111@xxxx> 
> > wrote:
> > > Dalengo,
> > > 
> > > Put this into Indicator builder, you can use  Parameter to 
select 
> > different
> > > watchlist....the total count will be in the title.
> > > 
> > > 
> > > //Count tickers in watchlist function
> > > 
> > > //For Indicator Builder
> > > 
> > > WatchlistNumber=Param("Watchlist",0,0,63,1) ;//enter watchlist 
> > number
> > > 
> > > function CountTickersInWatchList( Listnum )
> > > 
> > > {
> > > 
> > > // retrive comma-separated list of symbols in watch list
> > > 
> > > list = GetCategorySymbols( categoryWatchlist, listnum );
> > > 
> > > for( i = 0; ( sym = StrExtract( list, i ) ) != ""; i++ )
> > > 
> > > {
> > > 
> > > Count1=i;
> > > 
> > > }
> > > 
> > > return i;
> > > 
> > > }
> > > 
> > > Title="Watchlist # "+WriteVal(watchlistnumber,1)+" has "+
> > > 
> > > CountTickersInWatchList( WatchlistNumber) + " Tickers";
> > > 
> > > 
> > > 
> > > Anthony
> > > 
> > > ----- Original Message ----- 
> > > From: "dalengo" <dalengo@xxxx>
> > > To: <amibroker@xxxxxxxxxxxxxxx>
> > > Sent: Friday, February 27, 2004 12:29 PM
> > > Subject: [amibroker] empty scan of a watchlist (?)
> > > 
> > > 
> > > > Hi,
> > > > Can someone help with the scan of a watchlist function?
> > > > I am trying a trivial counting of entries in N100 watchlist
> > > > by scanning the AFL AB 4.51.1:
> > > >
> > > > AddToComposite(1,"~COUNT","V");
> > > > Buy=0;
> > > >
> > > > N100 is in List0, and all entries in List0 are valid (display
> > > > properly).
> > > > I use filter:list0 in AA to aim AA at list0 per User Guide,
> > > > run the Scan and get nothing.
> > > > Run for CURRENT stock, get ~COUNT=1, run for ALL STOCKS, get
> > > > (in US-Stocks) ~COUNT=6592 on 2/23/04, again for one stock, 
get 1.
> > > > Run again on List0 using Filter: get nothing (old result 
remains
> > > > unchanged).
> > > >
> > > > What's wrong?
> > > >
> > > > Many thanks for your suggestions,
> > > > -Dalengo
> > > >
> > > >
> > > >
> > > > Send BUG REPORTS to bugs@xxxx
> > > > Send SUGGESTIONS to suggest@xxxx
> > > > -----------------------------------------
> > > > 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
> > > > Yahoo! Groups Links
> > > >
> > > >
> > > >
> > > >
> > > >
> > > 
> > > 
> > > ---
> > > Outgoing mail is certified Virus Free.
> > > Checked by AVG anti-virus system (http://www.grisoft.com).
> > > Version: 6.0.583 / Virus Database: 369 - Release Date: 2/10/2004
> > 
> > 
> > 
> > Send BUG REPORTS to bugs@xxxx
> > Send SUGGESTIONS to suggest@xxxx
> > -----------------------------------------
> > 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 
> > Yahoo! Groups Links
> > 
> > 
> > 
> >  
> > 
> >



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 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
     http://groups.yahoo.com/group/amibroker/

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