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

[amibroker] Re: How to execute external command from AFL ?



PureBytes Links

Trading Reference Links

Try this:

EnableScript("jscript");

<%
function getWatchlist() {
	var AB = new ActiveXObject("Broker.Application"); 
	var AA = AB.Analysis;

	return AA.Filter(0, "watchlist");
}
%>

if (Status("stocknum") == 0) {
	Script = GetScriptObject();
	Symbols = CategoryGetSymbols(categoryWatchlist, 
Script.getWatchlist());
	_TRACE(Symbols);
}

Buy = True;

Mike

--- In amibroker@xxxxxxxxxxxxxxx, "przemyslawuk" <przemyslawuk@xxx> 
wrote:
>
> thank you for this code. It was very helpful and I now have the 
whole
> thing almost automated.
> the last thing that I need is to be able to retrieve the name of the
> currently selected watchlist in the "filter" section of the AA 
window.
> At the moment I have type the name of the watchlist (List 0) but it
> would be very good to get the name of that watchlist automatically.
>  
> StaticVarSet( "NoOfSymbols", CountTickersInWatchList("List
> 0",categoryWatchlist )-1 );
> 
> 
> 
> --- In amibroker@xxxxxxxxxxxxxxx, "murthysuresh" <money@> wrote:
> >
> > --- In amibroker@xxxxxxxxxxxxxxx, "przemyslawuk" <przemyslawuk@> 
> > wrote:
> > >
> > > Mike,
> > > Thank you for your answer. As you pointed it out the external 
> > command
> > > would run once per each symbol. What I need to do is to run AA 
(the
> > > AFL script I posted) and when the AA is finished I want to run 
my
> > > external command (once only) .
> > > Do you know whether it is possible ?
> > > Thanks
> > >
> > 
> > check this rough code
> > 
> > function CountTickersInWatchList( ListName, ListType )
> > {
> > // retrive comma-separated list of symbols in watch list
> >     list = GetCategorySymbols( ListType, CategoryFind( ListName, 
> > ListType ) );
> > 
> > 
> >     for ( i = 0; ( sym = StrExtract( list, i ) ) != ""; i++ )
> >     {
> > 
> >         if ( i == 0 )
> >             i = 0;
> >         else
> >             i = i ;
> >     }
> > 
> >     return i;
> > }
> > 
> > 
> > 
> > 
> > if ( s = Status( "stocknum" ) == 0 )
> > {
> >     _TRACE( "No of symbols entered at beginning " + NumToStr( 
> > CountTickersInWatchList( "Scans", categoryGroup ) ) );
> >     StaticVarSetText( "ScanResults", "" );
> > 	StaticVarSet( "NoOfSymbols", CountTickersInWatchList("Scans", 
> > categoryGroup ) );
> > 
> > 
> > }
> > 
> > Buy=true;
> > 
> > 
> > 
> > if ( s = Status( "stocknum" ) == StaticVarGet( "NoOfSymbols" ))
> > {
> >     
> >     
> > 
> > 
> >         		AlertIf(True, "exec notepad.exe" ,0,1);
> > 
> > }
> >
>



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

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

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