Click here to Login





                                                   Backtesting each symbol individually - doesn't seem to work ..

  0

0
Kiran
2016-04-23 14:30:02


I have a simple system (below) for 48 futures symbols and followed the instructions from the Blog - http://www.quantshare.com/sa-502-how-to-backtest-each-stock-or-asset-individually&kbaseid=blog-502-7381-3402
- I added the per-symbol Buy code to the script below and also the Money Mgmt script to report the symbol in the Optimization report described below ..

I get all results as 0 when i Optimize. When i backtest 1 symbol at a time, the script works fine.
Note - since i'm trading futures, i've also added another MM script to trade only 1 contract at a time - Buy/Short a Fixed # of Shares, Shares=1. Hope that's not interfering

//System ..

// Buy rules
Optimize("buyPer", 3, 7, 2);
buyRule = ema(close,buyPer)>ref(ema(close,buyPer),1) && close>open;

lt=-0.1; //Optimize("lt",-0.1,0.2,0.1);
SetSimTiming(_Buy,_Limit,0);
BuyPrice(close-lt*atr(10),1);
buy = buyRule;

//Backtest 1 symbol at a time
Optimize("sindex", 0, SymbolIndex(name(), -1), 1);
buy = buy and SymbolIndex(name(), sindex);

//Sell rule
sell = ema(close,buyPer)<ref(ema(close,buyPer),1);

//MM script
//On Start Simulation
Functions.AddReportMetric("Symbol", "");
//OnEndSimulation
MMPosition[] pos = Portfolio.GetAllPositions();
if(pos.Length > 0)
{
Variables.SetVariable("Symbol", pos[0].Symbol);
}




Kiran
2016-04-23 14:49:20

  0

I figured out - my .txt file was named wrong - ignore this request

thanks
Kiran



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
Equity Data to Ticker Symbol
Per Symbol Average Output
Industry Name of an External Symbol
Symbol Information on Chart
Random Value for Each Trading Bar

How-to Lessons
How to quickly add a ticker symbol
How to rename a ticker symbol
How to automatically draw Fibonacci Retracement for each new stoc...
How to run a screen or a watchlist from a script
How to export trading data to a CSV file

Related Forum Threads
Optimize for each symbol and walk-forward test on list
Create and Export each database for each market
Per-symbol backtests - select symbol list dynamically (vs from a ...
Different symbol list for Long/Short / custom portfolio categorie...
Accessing Symbol Info in Screener, Strategy script and in MM tool...

Blog Posts
How to Backtest Each Stock or Asset Individually
Backtesting Your Trading Systems: Symbol Segmentation
Trading System Analysis: Backtesting report and custom measures
Backtesting trading strategies using intraday data
How to Backtest Your Trading System for Each Industry









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 © 2024 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.