For various reasons (order placing, OCAGroup forming, etc.) I would like the Explorer to process symbols top down as they appear in the Watchlist. Tomasz explained in this post why this is not done:
Failing to obtain sequential processing would lead to a major rework of my code and probably means porting it to an Indicator. The simplest solution seems to set maxthreads=1, select only one watchlist in the AA Filter, and copy the symbols while adding an alpha prefix to the symbol name. The explorer would then sort by the prefix and processing would be top down.
In my opinion changing Symbols' names just to achieve sequential processing in some custom order, is not the best idea. I would opt for porting the whole solution (or at least some part of it) to an Indicator. In case of the Indicator, sequential execution is guaranteed and you can perform all operations in a fully customizable order. For example:
Meanwhile, I just realized that I can use the AddToComposite() to copy symbols to a name with the WL Index prefixed. I can delete old composites and create new composites in a small loop when Stocknum == 0.
I will try that first, it might be the only thing I have to add to the code. That would be a simple solution! I would strip the prefix when placing orders.
Another alternative would be first you do an exploration saving in a text file your instructions, than in the in second exploration using stocknum == 0 you process only the text file with your instructions
AFAIU, your only issue is the order of exploration output. Right? If that is case then you don't need indicator mode but still can use explorer. Also there are not text files required. And no symbol change and no ATC.
Just use CategoryGetSymbols() and use AddRow() for output. If you want to output further data for each symbol then store it to matrix (and again output via AddRow).
The code being used for below sample result output has just some 30 to 40 lines so it is no rocket science (And no, not multiple lines of AddRow but just one line of AddRow have been used). As you can see explorer symbol order matches symbol order of WL.
Thanks, everyone! It was very helpful to see the different ideas.
I have the basics working using ATCs. Just a small loop that executes at StockNum==0 to create composites with the WL index prefixed to the symbol name and copy them to a watchlist. There was no need to make any changes to the main code. However, I still have to perform two explorations and manually switch watchlists in the filter. One explore would be nice but that solution is for another day.