Calculating standard deviation of trades in portfolio

Questions about MultiCharts and user contributed studies.
User avatar
furytrader
Posts: 354
Joined: 30 Jul 2010
Location: Chicago, IL
Has thanked: 155 times
Been thanked: 217 times

Calculating standard deviation of trades in portfolio

Postby furytrader » 28 Oct 2013

Is there an easy way, using the Portfolio Backtester, to calculate the standard deviation per trade? I know I could export the entire Portfolio Report to Excel and do it manually, but I was wondering whether there is an easier way?

User avatar
Dave Masalov
Posts: 1712
Joined: 16 Apr 2010
Has thanked: 51 times
Been thanked: 489 times

Re: Calculating standard deviation of trades in portfolio

Postby Dave Masalov » 29 Oct 2013

Hello furytrader,

You can calculate the values in your script using the StandardDev function and print results to a file.

User avatar
furytrader
Posts: 354
Joined: 30 Jul 2010
Location: Chicago, IL
Has thanked: 155 times
Been thanked: 217 times

Re: Calculating standard deviation of trades in portfolio

Postby furytrader » 29 Oct 2013

Thanks Dave - so that value can be calculated for the entire portfolio? Can you give an example?

And by "entire portfolio", I do not mean each market + system in portfolio, but I mean for all the trades that occur within a portfolio in aggregate ... so, one standard deviation value for all the markets traded in a portfolio.

User avatar
Dave Masalov
Posts: 1712
Joined: 16 Apr 2010
Has thanked: 51 times
Been thanked: 489 times

Re: Calculating standard deviation of trades in portfolio

Postby Dave Masalov » 29 Oct 2013

furytrader,

Could you be more precise? I am not sure I am following you.

Are you referring to standard deviation based on Portfolio Strategy Performance‎ values that can be retrieved using the following keywords: https://www.multicharts.com/trading-sof ... erformance ?

User avatar
furytrader
Posts: 354
Joined: 30 Jul 2010
Location: Chicago, IL
Has thanked: 155 times
Been thanked: 217 times

Re: Calculating standard deviation of trades in portfolio

Postby furytrader » 29 Oct 2013

Sure, what I mean is that within a portfolio, there are a series of closed trades generated, each with either a profit or loss. I want to calculate the standard deviation of that string of closed trades.

User avatar
Dave Masalov
Posts: 1712
Joined: 16 Apr 2010
Has thanked: 51 times
Been thanked: 489 times

Re: Calculating standard deviation of trades in portfolio

Postby Dave Masalov » 29 Oct 2013

furytrader,

As far as I understand, you want to calculate standard deviation of a series of PnL values for each instrument (or entire portfolio). Unfortunately, there is no such sample code available.

You can use the Portfolio NetProfit to get PnL values and feed them into the StandardDev function.

If you want us to write this code for you as a custom project, please send a request to support@multicharts.com

User avatar
furytrader
Posts: 354
Joined: 30 Jul 2010
Location: Chicago, IL
Has thanked: 155 times
Been thanked: 217 times

Re: Calculating standard deviation of trades in portfolio

Postby furytrader » 29 Oct 2013

What I ended up doing was exporting the data to Excel and analyzing it there - it was a lot easier than I expected.


Return to “MultiCharts”