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

[amibroker] Re: function LastDateOfThisTicker("YHOO")



PureBytes Links

Trading Reference Links


Hello,

a solution could be to run an exploration with
SetOption("NoDefaultColumns",1);
Filter=1;
AddTextColumn(Name(), "Ticker", 1.0);
AddColumn(Close,"close", 1.0);
AddTextColumn(Date(),"Date",1.2);

Export quotes.csv

and call it in indicator builder with
_SECTION_BEGIN("New formula");
fh = fopen( "quotes.csv", "r"); 
if( fh ) 
{ 
   while( ! feof( fh ) ) 
   { 
      printf( fgets( fh ) );    
   } 
} 
else 
{ 
   printf("ERROR: file can not be found (does not exist)"); 
} 
_SECTION_END();

> Zoli,
> 
> <<The main Problem: Has already been trading today, or not?>>
> 
> This question can be answered by;
> 
> hasTradedToday= lastvalue(datenum())==now(3);
> 
> Which works for the current stock.
> If you need to reference other stock's stats from the current stock,
> it will take a bit more;
> 
> //-----------------------------------
> procedure loadList()
> {
> curList=StaticVarGetText("TradeList");
> ListDay=StaticVarGet("TradeListDay");
> //initialize if empty
> if (StrLen(curList)==0 OR ListDay!=Now(3))
> {
> curList=":";
> StaticVarSet("TradeListDay",Now(3));
> }
> if (StrFind(curList,":"+Name()+":")==0)
> {
> curList=curList+Name()+":";
> StaticVarSetText("TradeList",curList);
> }
> }
> 
> function isTradedToday(symb)
> {
> curList=StaticVarGetText("TradeList");
> return (StrFind(curList,":"+symb+":")>0);
> }
> //----------------------------------------
> 
> 
> call the "loadList" proc from the AA window and it will
> fill the "curTradeList" with all the currently traded symbols
> for the current day.
> 
> AFTER the first AA scan (which loads the list), the 
> function "isTradedToday" should
> return true if the symbol is in the list...
> 
> Warning; If your list of symbols gets too large, I have no idea
> what the performance impact is OR what, if any limit there is on
> the size of static vars...
> 
> 
> Walt
>  
> 
> --- In amibroker@xxxxxxxxxxxxxxx, "zoli_j" <novizoli@xxxx> wrote:
> > 
> > Hi,
> > 
> > About 10-12 Stocks.
> > The main Problem: Has already been trading today, or not?
> > This is the reason, why I want to know the last trading day.
> > 
> > BR, Zoli.
> > 
> > --- In amibroker@xxxxxxxxxxxxxxx, "hairy_mug" <WSCHWARZ@xxxx> 
wrote:
> > > 
> > > Zoli,
> > > How many stocks are you testing?
> > > If it a limited size, there may be a way of doing it...
> > > 
> > > Walt
> > > 
> > > --- In amibroker@xxxxxxxxxxxxxxx, "zoli_j" <novizoli@xxxx> 
wrote:
> > > > 
> > > > Hi group,
> > > > 
> > > > I would like to write a function, which can calculate the 
> > lastdate 
> > > of 
> > > > a selected Ticker.
> > > > It's neccressary for me to do a statistic about Market.
> > > > 
> > > > For example:
> > > > 
> > > > "
> > > > //ShownTicker = "YAHOO"; default. which is selected
> > > > //ItsANotShownTicker = what I want to prove. Any ticker. 
> > > > (GOOG,IXIC,DJI,QQQ)
> > > > 
> > > > _N( ShownTicker = Name() );
> > > > 
> > > > function LastDateOfThisTicker(ItsANotShownTicker) {
> > > >  SetForeign(ItsANotShownTicker);
> > > >  myLastDate = Date();
> > > >  return myLastDate;
> > > > }
> > > > 
> > > > ldGOOG = "GOOG: " + LastDateOfThisTicker("GOOG");
> > > > ldIXIC = "IXIC: " + LastDateOfThisTicker("IXIC");
> > > > ldDJI = "DJI: " + LastDateOfThisTicker("DJI");
> > > > ldQQQ = "QQQ: " + LastDateOfThisTicker("QQQ");
> > > > "
> > > > Could anybody help me?
> > > > 
> > > > BR, Zoli.





------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Check AmiBroker web page at:
http://www.amibroker.com/

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/