Click here to Login

                                                   Optimize for each symbol and walk-forward test on list


2016-06-28 19:38:52

I'm testing a strategy on a list of S&P500 stocks. Is there a way to optimize strategy parameters for each symbol (say over a 6-month period) and then
backtest against the entire list (say over 2 month out-of-sample period) with the optimized parameters assigned per-symbol? Then repeat this process over 5-6 sliding windows

Essentially i'm trying to run a walk-forward optimization process and generate an out-of-sample equity curve, but with the per-symbol optimized strategy parameters used for each symbol during the oos run.

Please advise easiest way to code this?


2016-06-28 20:38:19


Also, in the out-of-sample run, want to filter symbols based on whether their best (optimized) in-sample Net Profit >0.
Couple of options - can i use ..
1) Meta-Strategy for out-of-sample and include the Strategy in it for In-sample run? Challenge is the dates are different for IS (strategy) and OOS (meta-strategy) and also symbol list for Meta-Strategy is different from Strategy (which runs per strategy)

2) Dynamic list to filter symbols in In-sample period (based on optimal performance) and use Strategy to run out-of-sample period against the dynamic list. Challenge is how do i pass the optimal per-symbol parameters evaluated in the Dynamic List to the strategy so it uses these?

2016-06-29 09:47:12


You can do so using "Tools -> Script Editor". You can run backtests/optimizations programmatically, update trading system parameters and store report results.

2016-06-29 12:22:02


I looked in the Quantshare directory and found *.azf scripts only for some indicators. Didn't find any help in the doc or How-to guides or Knowledge Base.
Can you point me to some sample scripts that
1) run simulation/optimizations of a strategy that iterates through each symbol in the list on a specific date-range (Not sure how to invoke a strategy and update the Date and Symbol settings, access the symbols in a list)

2) store these optimal parameter values for each symbol (i guess these would be stored in an array within the script?)

3) run an out-of-sample backtest on the list by plugging in these parameter values back in the strategy script for each symbol.

2016-06-30 10:41:43


After selecting "Tools -> Script Editor", click on the "Help" button at the bottom in the new control. This will display all available functions. The rest is just C# coding.

If you need help to implement this script, you can hire one of our programmers to do this for you. Just contact support for that.

No more messages


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"


Trading Items
Industry and Sector Information for the US Stock Market
Open Interest Data for Equity, Index and Futures Securities
5-Minute Historical Intraday Data for Forex, Indices and Futures/...
EOD Quotes Data for Hong Kong Stocks and ETFs
Average Stock Performance for each U.S Exchange

How-to Lessons
How to download EOD quotes for active and valid stocks only
How to automatically draw Fibonacci Retracement for each new stoc...
How to import your own list of stocks/symbols
How to optimize the number of positions in a trading system
How to associate an index with a list of stocks

Related Forum Threads
Equity Curve and Trades list for out-of-sample Walk Forward test
Optimize a list (vs rules) for a strategy
Different symbol list for Long/Short / custom portfolio categorie...
indicator for 1 symbol in screener and simulation
Create and Export each database for each market

Blog Posts
How to Backtest Your Trading System for Each Industry
Creating and managing notes for your stocks
Different Ticker Symbols for Each Data Source
Step by step on how to get free realtime/delayed data for stocks,...
How to get buy and sell orders for a portfolio based on a trading...

Create an account
Affiliate Program
Contact Us
Trading Forum
How-to Lessons
About Us
Terms of Use

Copyright 2021
Social Media
Follow us on Facebook
Twitter Follow us on Twitter
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.