Calculating Standard Deviation on Live Trading

Questions about MultiCharts and user contributed studies.
bauhinia
Posts: 31
Joined: 08 Sep 2011
Has thanked: 4 times
Been thanked: 2 times

Calculating Standard Deviation on Live Trading

Postby bauhinia » 23 Feb 2012

Hi There,

I have a signal that I wish to calculate the running standard deviation of PnL.
Has anyone got any suggestions on how to code this up?

Cheers

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

Re: Calculating Standard Deviation on Live Trading

Postby furytrader » 23 Feb 2012

One strategy would be to use the ELCollections.dll and create a list in which you store the P&L of each trade once it is closed (if that's what you're looking to analyze). The ELCollections has a built-in standard deviation function that can calculate the standard deviation of any ELCollections list, so as long as you get the data into a list, the actual standard deviation calculation is very straightforward (and you can specify how many trades back to look, etc.)

You can learn more about the ELCollections.dll at:

viewtopic.php?t=2483

The ELCollections "pack" has a good user's guide that explains how to use it. If you need more guidance on how to do this, just let me know.
These users thanked the author furytrader for the post:
JoshM

User avatar
TJ
Posts: 6550
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 965 times
Been thanked: 1892 times

Re: Calculating Standard Deviation on Live Trading

Postby TJ » 23 Feb 2012

bauhinia wrote:Hi There,

I have a signal that I wish to calculate the running standard deviation of PnL.
Has anyone got any suggestions on how to code this up?

Cheers

You can put the Bollinger Band on the PnL. BB is std dev.
These users thanked the author TJ for the post:
bauhinia


Return to “MultiCharts”