I'm looking to run a portfolio backtest and would like to print the results for each stock to .csv or .txt...... as well as a header to show what each column represents...... something that looks like this......
Symbol, open, signal (where signal is a variable)
AAPL 95.36 1
MSFT 43.31 -1
JPM 56.43 0
etc etc......
A new line would have to be therefore created after each print command until the report has been completed.
Thanks in advance for any help !
Help with Print function in Portfolio backtester ......
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
Re: Help with Print function in Portfolio backtester ......
Hello aconnery,
Please find two sample studies created by our programmer for you attached.
Please find two sample studies created by our programmer for you attached.
- Attachments
-
- PrintPortfolio_8_8.pla
- for MultiCharts 8.8 and older
- (2.29 KiB) Downloaded 607 times
-
- PrintPortfolio_9_0.pla
- for MultiCharts 9.0 and newer
- (2.35 KiB) Downloaded 633 times
Re: Help with Print function in Portfolio backtester ......
Thanks for this Henry. This is basically what I need but there are 2 small issues. It's actually a good example of the print function.
1) The Header does not appear on my text file (I'm using the 8.8 PLA version) and I have no idea why.
2) When I use it with backtester, it creates a file for every day of the backtest. I would only like to generate a file for the last day. I tried a 20 year test and it produced thousands of text files.
Any help on this appreciated.
Thanks
1) The Header does not appear on my text file (I'm using the 8.8 PLA version) and I have no idea why.
2) When I use it with backtester, it creates a file for every day of the backtest. I would only like to generate a file for the last day. I tried a 20 year test and it produced thousands of text files.
Any help on this appreciated.
Thanks
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
Re: Help with Print function in Portfolio backtester ......
Please find updated study attached.
- Attachments
-
- PrintPortfolio_88.v1.1.pla
- (2.42 KiB) Downloaded 611 times
Re: Help with Print function in Portfolio backtester ......
Thanks very much for this Henry and team. This code was very helpful and, with a little customisation using the Wiki files, I have been able to do exactly as I needed.
Regards
Regards