#twitter-follow { border: 0;position: fixed; top: 240px; left:0;} #live-support { border: 0;position: fixed; top: 370px; left:0;} #knowledge-base { border: 0;position: fixed; top: 170px; left:0;}

## Upside-Downside and Custom Standard Deviation

by QuantShare, 3511 days ago

This function can be used to calculate Upside/Downside standard deviation or any other custom standard deviation.

As an example, let us say you want to calculate standard deviation of returns but just returns that occurred while a particular stock was trading below its long-term or 250-bar moving average. That particular standard deviation is very easy to calculate using this custom standard deviation function. You just have to type this:

a = StddevC(perf(close, 1), 200, close > open);
plot(a, "", colorRed);

Note that the function name is similar to the built-in standard deviation function. You just need to add "C" at the end of the function.
Also don't forget that you need to download the indicator first in order to use it. Just click on the "Download" link/button below.

Here is another quick example.
Calculate the difference between upside and downside standard deviation for the past 200 trading bars:

r = perf(close, 1);
up = StddevC(r, 200, r > 0);
dw = StddevC(r, 200, r < 0);
dif = up - dw;
plot(dif, "Difference between Upside and Downside standard deviation", colorBlue);

You have to log in to bookmark this object
What is this?

 Type: Trading Indicator Object ID: 1533 Country: All Market: All Style: Technical Analysis

 Related objects Empty
Number of reviews
Click to add a review
Average rate
Click to rate this item
Number of times this object was downloaded
Number of rates the current object received
Report an object
if you can't run it for example or if it contains errors
Click to report this object

 Random Blog Posts How to Create a Custom Real-Time Table using QS Trading Software Let me Show You How to Create Hundreds of Profitable Trading Systems How to Backtest a Strategy from a Chart How to Reference Drawing Studies in QS Formulas Let QuantShare Manage your List of Securities The Ultimate Guide to Create Trading Systems in QuantShare QuantShare New Website Feature: Groups QuantShare Trading Software: New Features in the 3.1.2 Version Show All

Number of reviews
Click to add a review
Average rate
Click to rate this item
Number of times this object was downloaded
Number of rates the current object received
Report an object
if you can't run it for example or if it contains errors
Click to report this object