Click here to Login





                                                   Per-symbol backtests - select symbol list dynamically (vs from a file)

  0

0
Kiran
2015-04-14 12:32:49


The per-symbol backtest/optimization in this blog is an extremely useful feature .. however, it's tedious to go through 3 steps each time before backtesting/optimization -
a) set up a file with the symbol list on the hard drive,
b) modify the file-name in the SymbolIndex function
c) copy/paste the list as a Custom list of symbols in the trading syste,
http://www.quantshare.com/sa-502-how-to-backtest-each-stock-or-asset-individually

1) How can we modify the SymbolIndex function to grab the list dynamically from the Symbol List set up in the trading system? That would obviate all 3 steps
2) If that's not possible, how do we modify SymbolIndex function so we can pass the file-name as a parameter in the trading system (vs having to go through step b above)?

thanks
Kiran

//----------------SymbolIndex code-------------------------
string fileLocation = @"C:\Users\bellare\Documents\finance\QuantShare\lists
asdaq100.txt";
string[] lines = System.IO.File.ReadAllLines(fileLocation);

int index1 = (int)index[0];
string symbol1 = symbol[0].ToLowerInvariant();

if(index1 < 0)
{
result.Assign(lines.Length);
}
else if(index1 < lines.Length)
{
string symbol2 = lines[index1].Trim().ToLowerInvariant();
if(symbol1 == symbol2)
{
result.Assign(1);
}
}



QuantShare
2015-04-15 05:56:25



1) How can we modify the SymbolIndex function to grab the list dynamically from the Symbol List set up in the trading system? That would obviate all 3 steps

This is not possible as the trading indicator has no access to the trading system.

2) If that's not possible, how do we modify SymbolIndex function so we can pass the file-name as a parameter in the trading system (vs having to go through step b above)?

You just need to open the function using (Tools -> Create functions) then click on "Add a parameter" and update the parameter type to "string"
Say you added a parameter whose name is "file". After that you must replace:

string fileLocation = @"c:\mylist.txt";

by

string fileLocation = file[0];



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
US Historical Quotes from NASDAQ website
Ticker Symbol Index
Fidelity Select Funds
List of Shortable Stocks
Stock Picks from Wikinancial

How-to Lessons
How to run a screen or a watchlist from a script
How to quickly add a ticker symbol
How to import your own list of stocks/symbols
How to import trading data from CSV files
How to associate an index with a list of stocks

Related Forum Threads
STATIC WATCH LIST-add a symbol to existing static watch list from...
Optimize a list (vs rules) for a strategy
Different symbol list for Long/Short / custom portfolio categorie...
Optimize for each symbol and walk-forward test on list
Creat a Composite Index from few stock symbol

Blog Posts
How to Create a List of Ticker Symbols
Update Chart Layout based on Active Ticker Symbol
How to Send Commands to QuantShare from Excel or Other Applicatio...
Let QuantShare Manage your List of Securities
How to Select the Best Market Indicator for your Trading System









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.