I want to capture the list of symbols that would be returned by explore. I would then post-process that list after the list of symbols are generated. This is for utility AFL, not for a system.
The filter could be complex, such as:
Market=ASX, Market=ASX Delisted Stocks, Match Any
Watchlist=All Ordinaries, Sector=Technology, Match All
Watchlist=All Ordinaries, Exclude=Stocks that are outliers
Etc.
In most cases Filter=1; I just need the list of stocks that match the filter ("funnel" icon) for further processing.
Essentially, you'll create an exploration analysis project (.apx) with your (complex as needed) rules. Then you add it to an AmiBroker batch (.abb), run it (explore), and export(clear/add) the results to a new watchlist that will contain only the "filtered" symbols.
Then you'll use such generated watchlist for further processing.
What I want to do is take the results of explore and randomly split the symbols, creating an in-sample and out-of-sample watchlist. If there is a way to do this in a single AFL that would be good.
Otherwise, I deduce from your reply that I can create two .apxs, two .afls called by the two .apxs, with the first .apx running the explore, the second using that watchlist as input for the random split, and a batch file to glue them all together.
I was hoping something like this would work, but I suspect explore/amibroker doesn't work this way:
StaticVarRemove("svTest");
StaticVarSetText("svTest","");
if (Status("action") == actionExplore) {
Filter=1;
StaticVarSetText("svTest",StaticVarGetText("svTest")+Name()+",");
}
_TRACE(StaticVarGetText("svTest"));
// further processing downstream from the explore
If I could capture the symbol list in a comma separated string I think I could work out the rest.
@LinusVanPelt, yes. I think this is the proper way to do it.
You can do it easily using the batch (.abb), or you can achieve it using OLE and external scripts, but in any case, it seems a two-step process: create a new watchlist/process the new watchlist.
If you want more control over your watchlist, you could export your explore results to a csv and then manualy edit that csv, then after that create your watchlist.
You then have 100% control over your final watchlist...
But my guess is that you allready figured that out, you just want it all done automaticaly.
Besides you can add symbols to watch list directly using CategoryAddSymbol() and retrieve it back from other formula using just ONE function call that gets comma separated symbol list: CategoryGetSymbols()
One function call is:CategoryGetSymbols() to do what you wanted: "capture the symbol list returned by explore".
You don't "WRAP" anything into APX. You just press "SAVE" button. One mouse button click to save Analysis setup to APX file, done ONCE in your lifetime.
And no it is neither "only" or "best". It is one of possible ways. And it is NOT convoluted. The other one is using CategoryAddSymbol as I noted previously.
If somebody offered me such EASY solutions to what I am facing each and everyday I would sing appreciations songs all day long.