Here is preliminary information on Multi-System support in the New Analysis window.
It is work-in-progress and the purpose of this thread is to collect early feedback. More info will be provided soon.
MULTI-SYSTEM BACKTESTING WAVE 1
New Analysis: Multi-system report now includes some per-system trade stats
AFL: SetOption(), experimental new option "PerSystemMaxOpenPos" defines maximum number of open positions per system in multi-system setups. Does not affect single system backtests
AFL: Custom Backtester: new property in Signal object: SystemID (1-based system index, for multi-system backtests only, for single-system it always gives 0)
AFL: Custom Backtester: new property in Trade object: SystemID (1-based system index, for multi-system backtests only, for single-system it always gives 0)
AFL: new functions _SYSTEM_BEGIN(); and _SYSTEM_END() - you need to wrap your system trading rules inside those to enable multi-system mode
Multi-system support in backtestRegular mode implemented (partially)
Approach A: Unified Portfolio
Unified porfolio concept is described here:
Limitations of Wave 1:
UNIFIED portfolio approach only (all systems share one portfolio and there is ONE equity that all systems use)
the only supported mode is backtestRegular
stop settings (ApplyStop) are shared
most other settings via SetOption() are shared
PositionScore ranking is common across the systems so you need to normalize score across the systems, so one system doesn't "win" always
"Individual backtest" mode is not implemented - (this doesn't mean that you can't backtest single symbol, you can. But if you want to backtest multiple systems on individual stocks from the list, you need to run as batch, each symbol in "single symbol portfolio")
PositionSize refers to entire portfolio (multisystem), so you would need to adjust it accordingly if you use percent of equity
Individual-system Reporting is limited to certain stats only, most of the stats are per entire portfolio
PerSystemMaxOpenPos setting (available by SetOption) is currently global (applies to all systems, if you use it many times with different values, the value set as last one will count)
AFL: new functions _SYSTEM_BEGIN(); and _SYSTEM_END() - you need to wrap your system trading rules inside those to enable multi-system mode
Examples
// all SetOptions() settings are currently shared between systems (i.e. global)
// this controls total number of open positions in portfolio
SetOption("MaxOpenPositions", 10 );
// this controls per-system limit
SetOption("PerSystemMaxOpenPos", 2 );
//----- First system -----
_SYSTEM_BEGIN(); // required marker
// currently you can have per system entry/exit signals, prices, position size and score
Buy = Cross( C, MA( C, 10 ) );
Sell = Cross( MA( C, 10 ), C );
PositionScore = RSI(14);
SetPositionSize( 10, spsPercentOfEquity );
_SYSTEM_END(); // required marker
//----- Second system -----
_SYSTEM_BEGIN();
Buy = Cross( MACD(), Signal() );
Sell = Cross( Signal(), MACD() );
PositionScore = RSI(14);
SetPositionSize( 10, spsPercentOfEquity );
_SYSTEM_END();
FUTURE VERSIONS
Since this is quite complex stuff the implementation is divided into development waves. Each wave will bring some new features until we reach completeness. In the meantime I would appreciate any reports of problems of what is already implemented as problems need to be fixed before adding new stuff.
Wave 2
In Wave 2 there are following features are already planned:
ability to set PerSystemMaxOpenPos on system-by-system basis (not shared)
support for per-system stop settings (via ApplyStop per-system)
support for backtestRegularRaw mode
Possible additions (comments?)
ability to set system name (to show up in the report)
Somehow I receive NO FEEDBACK at all on this feature that was so much pushed and requested, even though several people wanted to participate and give feedback.
I have multiple systems that use different databases because they use different data sources (Norgate, MetaStock and IQFeed) and different base intervals. I trade these systems in a few accounts, so I need to model their performance together. Currently I use a batch file to open the relevant DBs and run backtests for the strategies, and store each of the resulting equity curves as persistent static variables that can be accessed from any of the DBs. Then I have a chart that I created that uses Parameters to weight each of the strategies, and I click a button to create a blended equity curve that uses daily P&L changes to roll forward the equity value. I then store this equity curve as a custom ticker symbol, and run a buy-and-hold backtest on that symbol so I can use the MCS to calculate CAR25 and DD95 like Dr. Bandy proposes in his books. It would be great if I could simply use the new multi-strategy backtest feature.
Although I like your approach of splitting the AFL into multiple systems, it would be better for me if there was an approach that also enabled the use of different DBs for each strategy.
Also, I think the parenthetical system number in the backtest trade results Symbol field is preventing the "Show current trade arrows" feature from working. It returns "Error 706. Show Arrows feature needs a Trade list." It would be great if the system number / name could be moved to a separate column.
And finally, it also would be great to be able to calculate marginal contribution statistics for each system, something that shows the marginal value (or loss of value) that each system provides the overall portfolio.
Thank you for your work on this feature and I look forward to continue testing your new versions.
There will NOT be a possibility to use multiple data plugins at the same time and each symbol having different data source because
a) stability - each extra plugin into the mix may potentially cause stability problems
b) performance - each extra plugin means extra CPU load and load time
c) resources - each extra plugin means more RAM usage
What you should do, is not expecting software to by custom-build just for your single-user use scenario, but rather adopt yourself to the way how software is written because it is written properly.
What you should do is to
EXPORT all your data from multiple databases and IMPORT to SINGLE local database. Local database offers maximum performance (contrary to suggested 'solution')
Perform backtesting on that single local database.
If I import Norgate data into a mixed-mode 1-min DB, will these functions continue to work correctly when used in a daily analysis project? NorgateIndexConstituentTimeSeries(), NorgateOriginalCloseTimeSeries(), NorgateOriginalVolumeTimeSeries(), NorgateAllDividendsTimeSeries()
If so, then the single local DB could work to merge Norgate, MetaStock and IQFeed intraday data.
That is the question to Norgate not me because they wrote the plugin. Theoretically Norgate* AFL functions are exposed by separate DLL so technically it might work, but that entirely depends on how Norgate implemented it.
However, if Norgate requires their plugin to be connected to given DB you can use the other way round:
import INTRADAY data into Norgate database. But all those non-Norgate symbols should have "Use only local database for this symbol" flag set.
That would prevent AmiBroker from calling Norgate plugin to deliver data for those particular symbols.
By the way: when you import NEW symbols into database that is driven by the plugin already, those NEW symbols (added freshly) are automatically marked as "use only local database for this symbol" as described here (scroll down to "Things that you should not do, or you should do very carefully"):
The Norgate data plugin prevents the use of an intraday time interval, so I'll check with them on the use of their functions in local DBs. Thank you for your advice on a clean setup.