<\/p>
<\/p>
<\/p>
<\/ol>
An alternative solution to this is to filter out unwanted symbols in the code. In this case AmiBroker would need to run analysis for all tickers (so Apply to<\/strong> would need to be set to All symbols<\/strong>) and apply filtering while executing your formula. To do so you may use code like this for backtesting (filtering Buy<\/strong> signals):<\/p>Buy <\/span>= <\/span>\/* your regular trading rules here *\/<\/span>;
<\/span>watchlistCheck <\/span>= <\/span>InWatchList<\/span>( <\/span>1 <\/span>) OR <\/span>InWatchList<\/span>( <\/span>2 <\/span>);
<\/span>Buy <\/span>= <\/span>watchlistCheck <\/span>AND <\/span>Buy<\/span>; <\/span>\/\/ combine watch list filter with your rule<\/code>
or code like this in exploration (adding extra condition to Filter variable):<\/p>
Filter <\/span>= <\/span>\/* your regular exploration filter here *\/<\/span>;
<\/span>watchlistCheck <\/span>= <\/span>InWatchList<\/span>( <\/span>1 <\/span>) OR <\/span>InWatchList<\/span>( <\/span>2 <\/span>);
<\/span>Filter <\/span>= <\/span>watchlistCheck <\/span>AND <\/span>Filter<\/span>; <\/span>\/\/ combine watch list filter with your rule<\/code>
Please keep in mind that filtering in the code is significantly slower. Using this method AmiBroker needs to read the data for all tickers, prepare arrays, then evaluate the formula and verify the condition – so using Filter window<\/strong> and the first approach will be faster, as the filtering is done before the formula execution, saving lots of time required for data retrieval and AFL execution.<\/p>","protected":false},"excerpt":{"rendered":"
The Filter window in the Analysis screen allows us to define a filter for symbols according to category assignments, for example watchlist members (or a result of mutliple criteria search).The filter allows us to select one watch list for “inclusion” and one for “exclusion”. To include members of more than one watchlist, we can not […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[57],"tags":[53,14,15,28,24],"_links":{"self":[{"href":"https:\/\/www.amibroker.com\/wordpress\/kb\/wp-json\/wp\/v2\/posts\/990"}],"collection":[{"href":"https:\/\/www.amibroker.com\/wordpress\/kb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.amibroker.com\/wordpress\/kb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.amibroker.com\/wordpress\/kb\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.amibroker.com\/wordpress\/kb\/wp-json\/wp\/v2\/comments?post=990"}],"version-history":[{"count":2,"href":"https:\/\/www.amibroker.com\/wordpress\/kb\/wp-json\/wp\/v2\/posts\/990\/revisions"}],"predecessor-version":[{"id":1002,"href":"https:\/\/www.amibroker.com\/wordpress\/kb\/wp-json\/wp\/v2\/posts\/990\/revisions\/1002"}],"wp:attachment":[{"href":"https:\/\/www.amibroker.com\/wordpress\/kb\/wp-json\/wp\/v2\/media?parent=990"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.amibroker.com\/wordpress\/kb\/wp-json\/wp\/v2\/categories?post=990"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.amibroker.com\/wordpress\/kb\/wp-json\/wp\/v2\/tags?post=990"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}