Help with Print function in Portfolio backtester ......

Questions about MultiCharts and user contributed studies.
aconnery
Posts: 32
Joined: 21 Apr 2013
Has thanked: 9 times
Been thanked: 4 times

Help with Print function in Portfolio backtester ......

Postby aconnery » 05 Aug 2014

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 !

User avatar
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 ......

Postby Henry MultiСharts » 06 Aug 2014

Hello aconnery,

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 600 times
PrintPortfolio_9_0.pla
for MultiCharts 9.0 and newer
(2.35 KiB) Downloaded 623 times

aconnery
Posts: 32
Joined: 21 Apr 2013
Has thanked: 9 times
Been thanked: 4 times

Re: Help with Print function in Portfolio backtester ......

Postby aconnery » 07 Aug 2014

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

User avatar
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 ......

Postby Henry MultiСharts » 11 Aug 2014

Please find updated study attached.
Attachments
PrintPortfolio_88.v1.1.pla
(2.42 KiB) Downloaded 602 times

aconnery
Posts: 32
Joined: 21 Apr 2013
Has thanked: 9 times
Been thanked: 4 times

Re: Help with Print function in Portfolio backtester ......

Postby aconnery » 17 Aug 2014

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


Return to “MultiCharts”