Click here to Login





                                                   Clear Symbol data stored in memory in global script

  0

0
Dave Walton
2014-08-31 18:31:49


Hi QS,

I'm working on automation using the global script and the new interface to the simulator. One of the things I'm doing is creating new symbols that are copies with modification of existing symbols. and then run a backtest on the modified version.

Here is my procedure:
for (int i = 0; i < numtrials; i++)
{
HistoricalQuotes OriginalData = Quotes.GetHistoricalQuotes(SymbolName);
Symbols.AddSymbol(ModifiedSymbolName);
HistoricalQuotes ModifiedData = Quotes.GetHistoricalQuotes(ModifiedSymbolName);
<Code to modify OriginalData and store in ModifiedData >
Quotes.SaveHistoricalQuotes(ModifiedData);
Simulator.Backtest(<Trading System>);
}

The problem is that even though I apply different modifications to the data and it gets stored in the database properly, the backtest always gets run on stale data in memory.
How can I flush the data and force a reload from the database? I have verified that the expected data is in the quote database after this script.
Even if I run a manual backtest later, the stale quote data is still used.

Please help me understand what is going on so i can remedy this situation.




Dave Walton
2014-09-01 12:05:12

  0

A little more information on this:

I worked around the issue above by setting: Account -> Application Settings -> Memory Management -> Load quotes in memory when performing simulations/backtesting -> Unchecked.

I don't really want to do this globally. I would prefer to be able to programmatically flush memory and force a quotes reload. is this possible? If not, could you consider adding that to a future release?



QuantShare
2014-09-01 14:38:49

  0

Best Answer
We will add this as a new option in each trading system where you can instruct not to load data from memory at all.
Or find a way to remove data from memory each time a symbol's data is updated.



Dave Walton
2014-09-02 00:39:29

  0

Thanks QS! Perhaps provide a function in the global script along the lines of Quotes.PurgeHistoricalQuotes(SymbolName)? Global script seems to be the only usage model for this functionality as far as I can see.


SystemTrade
2014-09-02 05:23:25

  0

@QS:
just for your information, the same happens when changing accounts.
I use 2 accounts, one with historical yahoo data "frozen" at the the end of 2012 for backtesting purposes and another account with "current" historical data adjusted for splits & dividends for the same symbols.
When I change between these accounts, quotes data is retrieved from memory and not from the newly selected account database.
As a workaround I use to close and re-start QS after I changed accounts.



QuantShare
2014-09-03 06:28:34

  0

This will be fixed. Thanks.


No more messages
0




Reply:

No html code. URLs turn into links automatically.

Type in the trading objects you want to include: - Add Objects
    To add a trading object in your message, type in the object name, select it and then click on "Add Objects"










    QuantShare

    Trading Items
    Historical economic calendar data by currency symbol
    Equity Data to Ticker Symbol
    LSE - UK - EOD data
    RTS RU data
    Bourse de Tunis - EOD data

    How-to Lessons
    How to get stocks for a particular index using the global script
    How to rename a ticker symbol
    How to download earnings calendar data for various stocks
    How to run a screen or a watchlist from a script
    How to download and use U.S. stocks earnings data

    Related Forum Threads
    Help With Daily Data Import Script
    Deleting Quote data for a symbol from the Database
    Adding data to database through script
    AMM script global variables do not appear to be thread safe
    Data Interpolation c# Script

    Blog Posts
    QS Trading Software: Global Script
    Charting & Scripts - Manage stock charts using the global script
    Create custom metrics for the statistical data analysis tool
    Speed Up Optimizations by Saving Ranking Data into a Custom Datab...
    Reading and Exporting Data from QuantShare to Excel Programmatica...









    QuantShare
    Product
    QuantShare
    Features
    Create an account
    Affiliate Program
    Support
    Contact Us
    Trading Forum
    How-to Lessons
    Manual
    Company
    About Us
    Privacy
    Terms of Use

    Copyright © 2025 QuantShare.com
    Social Media
    Follow us on Facebook
    Twitter Follow us on Twitter
    Google+
    Follow us on Google+
    RSS Trading Items



    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.