#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, 1904 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.

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);

What is this?

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

Related objects
Show All
Rate of Change Volume (by srishail, uploaded several months ago)
No notes
 10
Better Volume Indicator (by Savio Rodrigues, uploaded several months ago)
No notes
 43
Support & Resistance Breakout Indicator (by Tom Huggens, uploaded several months ago)
No notes
 63
Coefficient of Variation - Relative Standard Deviation (by The trader, uploaded several months ago)
No notes
 26
Volume near Price Level - Detect Strong Support & Resistance Areas (by Big Yahoo, uploaded several months ago)
No notes
 49
No notes
 123
Decreasing the Trailing Stop Level every Trading Bar (by QuantShare, uploaded several months ago)
No notes
 41
Number of reviews
Average rate
Click to rate this item
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
Average rate
Click to rate this item
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