Filter Settings

''' What AB code will permit Filter Code selection from within a programs code.
That is: Program Code that overrides whatever settings are applied manually within the analysis window.
An extract of my existing code is given below

MODERATOR COMMENT:
You must use CODE TAGS. I added them but any further posts without code tags will be deleted.

AddColumn(DateTime(), "Signal Date", formatDateTime);
AddColumn( IIf( Buy, BuyPrice, Null ),   "Buy Signal Close",  1.3, textColor = colorWhite, bkgndColor = colorGreen ); 
AddColumn( IIf( Sell, SellPrice, Null ), "Sell Signal Close",  1.3, textColor = colorWhite, bkgndColor = colorred ); 

Currently, I set FILTER to Watch List - S&P ASX 300. Which is 300 tickers. And then run the code but:
It reports all buy/sell signals on all 300 tickers which is inconvenient.
I want buy signal to report any signal that occurs on these 300 tickers BUT
I want the sell signal to report only for stocks I hold in my watch list “mystocks” '''

Just add this:

Filter = Buy OR (Sell AND InWatchListName("mystocks"));
1 Like

'''What AB code will override From Date setting as exist within the Analysis Window and set a date relative to the current date'''

Maybe instead of creating x new threads, you just continue your thread from a few days.

You've received a reply from me, but didn't respond in any way. Now you create another almost identical thread. It makes no sense...

You don't need to override anything. Just select "One recent bar" and if you want to receive signals only for the stocks which have been active today, you can add this to your Filter :

ActiveToday = Now(3) == LastValue( DateNum());

Filter = YourOtherCriteria AND ActiveToday;

Thanks to this, only the issues which have been quoted today, will be placed in the Exploration output.

http://amibroker.com/guide/afl/now.html4
http://amibroker.com/guide/afl/datenum.html1

2 Likes