a while back I asked for a feature to programatically allow turning off the option to cache price data in memory so that data can be modified on the fly. It appears you made some change because now I'm able to modify data and affect the backtest. However, the option in "Application Settings"->"Memory Management"->"Load Quotes in Memory when Performing Simulations/Backtests" seems to not do anything anymore. It appears that no matter what I do, quotes are not cached in memory. What am I missing?
I notice that when I use and external Metastock database, my simulations run 2x faster for the same system/symbols than if I use the built-in database. It appears to me that the external database quotes are cached but the internal database quotes or not. My hypothesis is not just based on performance as the memory usage profile is much different also. Can you shed some light?
There were some changes to the cache logic but it is working as expected. When "Load Quotes in Memory" is checked, data are cached and when it is not, data are no longer cached. Memory usage is managed by .Net, so you don't know really when it is released and when it is not.
Regarding performance, built-in databases should be much faster. I have done some tests here and I can confirm that.
Note that caching applies when performing optimizations. Cache data is always released after the simulation ends.
Hi QS, based on you response I did a little more digging. Here is the data. All of this data is from a 25 ETF trading system simulated from 1999 to present on EOD data. I subscribe to a data vendor and use the external Metastock database option as well as the built-in database with data downloaded from yahoo for dividend adjusted data. My downloaded data is stored into different symbol names ("_DIVADJ" is appended to the symbol name). Here is the data:
When "Download"->"External Database"->"Metastock database" is checked, along with "Application Settings"->"Memory Management"->"Load Quotes in Memory when Performing Simulations/Backtests" is checked these are the results:
* Metastock database symbols used: simulation time = 7 seconds
* Built-in database symbols used (dividend adjusted): simulation time = 6 seconds
When "Download"->"External Database"->"Metastock database" is UNchecked, along with "Application Settings"->"Memory Management"->"Load Quotes in Memory when Performing Simulations/Backtests" is checked these are the results:
* Built-in database symbols (also in Metastock database) used: simulation time = 10 seconds
* Built-in database symbols used (dividend adjusted): simulation time = 8 seconds
When "Download"->"External Database"->"Metastock database" is checked, along with "Application Settings"->"Memory Management"->"Load Quotes in Memory when Performing Simulations/Backtests" is UNchecked these are the results:
* Metastock database symbols used: simulation time = 12 seconds
* Built-in database symbols used (dividend adjusted): simulation time = 8 seconds
When "Download"->"External Database"->"Metastock database" is UNchecked, along with "Application Settings"->"Memory Management"->"Load Quotes in Memory when Performing Simulations/Backtests" is UNchecked these are the results:
* Built-in database symbols (also in Metastock database) used: simulation time = 13 seconds
* Built-in database symbols used (dividend adjusted): simulation time = 10 seconds
So why does the metastock database setting affect the performance when using the built-in database?
First of all, as said previously, "Load Quotes in Memory when Performing Simulations" has almost zero effect when doing a single simulation. This should apply only when performing optimizations.
You should do tests with much more symbols and several optimizations. The difference here is really small and could be explained by too many factors.
Trading financial instruments, including foreign exchange on margin, carries a high level of risk and is not suitable for all investors. The high degree of leverage can work against you as well as for you. Before deciding to invest in financial instruments or foreign exchange you should carefully consider your investment objectives, level of experience, and risk appetite. The possibility exists that you could sustain a loss of some or all of your initial investment and therefore you should not invest money that you cannot afford to lose. You should be aware of all the risks associated with trading and seek advice from an independent financial advisor if you have any doubts.