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

[amibroker] Re: Get active watchlist



PureBytes Links

Trading Reference Links

--- In amibroker@xxxxxxxxxxxxxxx, "nunopires2001" <nunopires2001@xxx> 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/

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/