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

[amibroker] Re: Get active watchlist



PureBytes Links

Trading Reference Links



Try this:

function GetCurrentWatchlist()
{
    AB =
CreateObject( "Broker.Application"
);
    AA = AB.Analysis;
    
return AA.Filter( 0, "watchlist"
);
}

function
RetrieveSymbolList( )
{
    
return CategoryGetSymbols( categoryWatchlist
, GetCurrentWatchlist() );
}

_TRACE( "Symbols: "
+ RetrieveSymbolList() );

Mike


--- In amibroker@xxxxxxxxxxxxxxx, "nunopires2001" <nunopires2001@xxx> wrote:
>
> --- In amibroker@xxxxxxxxxxxxxxx, "nunopires2001" nunopires2001@ wrote:
> >
> > Hello,
> >
> > There is any way to retrieve the currently selected watchlist?
> >
> > Many thanks,
> > Nuno
> >
> I will try to explain in more detail my problem.
>
> I have a graphic where i plot the correlation between 2 stocks.
> The code used:
> _________________________________________________________________
> include "C:\bolsa\AmiBroker5\Formulas\Custom\PairTrading\includes\utils.afl"
>
>
> period=60;
> list=RetrieveSymbolList();
> sym0 = StrExtract( list, 0 );
> sym1 = StrExtract( list, 1 );
>
> _correlation = Correlation( Foreign( sym0, "C") , Foreign( sym1, "C"), period);
>
> Plot( _correlation , "correlation"+period + " " + sym0 + "-" + sym1 , colorLightBlue,4);
> ___________________________________________________________________
> where utils.afl is:
>
> function RetrieveSymbolList( ) {
>
> for( i = 0; CategoryGetName( categoryWatchlist, i )!= ""; i++ )
> {
> if( InWatchList( i ) ) _list = CategoryGetSymbols( categoryWatchlist, i );
> }
>
> return _list;
>
> }
>
> _____________________________________________________________________
>
> I populate each watchlist with 2 symbols, I select one of the 2 stocks on the watchlist, and the correlation between them is plotted.
> Everything works well, except when i have the same symbol on multiple watchlists.
> On that case, the correlation plotted is from the last watchlist where the selected symbol is found, not the actual one.
>
> Anyone can suggest me a way to correct the code?
>



__._,_.___


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

TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/





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

__,_._,___