# StandardDeviation.efs

ICE Data Services -

 StandardDeviation.efs

File Name: StandardDeviation.efs

Description:
This formula is intended to be used within custom formulas through the callFunction() function to get the standard deviation of one of the following price sources (Open, High, Low, Close, Volume). It may also be used as a non-price study.

Formula Parameters:
nLength - 25
sPriceSource - "Close"

Notes:
Here's an example for calling this formula from a custom formula. If the formula is in a different folder than the calling formula, change the first input parameter to the correct path (i.e. "/Other/StandardDeviation.efs").

var nStdev = callFunction("StandardDeviation", "main", 10, "Close");
if (nStdev == null) return; // null check

StandardDeviation.efs EFS Code:

 `/*********************************Provided By : eSignal. (c) Copyright 2004Study: Standard DeviationVersion 1.0 - 4/8/204Formula Parameters: Defaults: nLength 25 sPriceSource "Close"Notes: This formula is intended to be used within custom formulas through the callFunction() function to get the standard deviation of one of the following price sources. It may also be used as a non-price study. "Open" "High" "Low" "Close" "Volume" Example Usage: var nStdev = callFunction("StandardDeviation.efs", "main", 10, "Close"); if (nStdev == null) return; ********************************/function preMain() { setStudyTitle("Standard Deviation "); setDefaultBarFgColor(Color.blue); setCursorLabelName("Stdev");}function main(nLength, sPriceSource) { if (nLength == null) nLength = 25; if (sPriceSource == null) sPriceSource = "Close"; var aSource = getValue(sPriceSource, 0, -nLength); if (aSource == null) return null; var sumX = 0; var sumX2 = 0; for (i = 0; i < nLength; ++i) { sumX += aSource[i]; sumX2 += (aSource[i] * aSource[i]) } var meanX = (sumX/nLength); var stdev = Math.sqrt((sumX2/nLength) - (meanX*meanX)); return stdev;} `
{"ft_lang_label":"__label__en","ft_lang_prob":0.58941233,"math_prob":0.8424755,"size":1862,"snap":"2022-40-2023-06","text_gpt3_token_len":503,"char_repetition_ratio":0.17115177,"word_repetition_ratio":0.23809524,"special_character_ratio":0.2964554,"punctuation_ratio":0.19426751,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9847138,"pos_list":[0,1,2],"im_url_duplicate_count":[null,4,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2023-02-06T00:11:43Z\",\"WARC-Record-ID\":\"<urn:uuid:3fa832ed-497e-4adf-ad9a-5702f488dbbd>\",\"Content-Length\":\"20552\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:341d1627-3eae-4056-9ab8-dbe36ba676e1>\",\"WARC-Concurrent-To\":\"<urn:uuid:50809476-e78a-49ec-9599-d8e2769510cd>\",\"WARC-IP-Address\":\"104.16.53.111\",\"WARC-Target-URI\":\"https://efs.kb.esignal.com/hc/en-us/articles/6362812626331-StandardDeviation-efs\",\"WARC-Payload-Digest\":\"sha1:YLNKY5ZM43JEPJVKLBAH5O3PNYZLV4N7\",\"WARC-Block-Digest\":\"sha1:XI6JMR372SJ26DHB3FLKUNFCRKZTUT7R\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2023/CC-MAIN-2023-06/CC-MAIN-2023-06_segments_1674764500294.64_warc_CC-MAIN-20230205224620-20230206014620-00504.warc.gz\"}"}