Does anyone have any ideas on how best to get the EMA of the standard deviation indicator below? I don't want to plot an EMA over stddev, but create a formula to give me the EMA of stddev.
In other words, how best to adapt the ema.efs formula in the Library folder so that it gives the ema not of the close, but of stddev below?
Here's my formula for stddev:
function main(nInputLength) {
if(nInputLength == null)
nInputLength = 13;
var nLength = nInputLength;
var i;
var j;
var vSum = 0.0;
var vSuma = 0.0;
var vSumAvg;
var vValue;
var stdev;
var period;
var vSumaprev;
var test;
period = 0;
vValue = close(period, -nLength);
if(vValue == null) {
return;
}
for(i = 0; i < nLength; i++) {
vSum += vValue[i];
}
vSumAvg = vSum/nLength;
// return (vSum / nLength);
for(j = 0; j < nLength; j++) {
vSuma += ((vValue[j] - vSumAvg)*(vValue[j] - vSumAvg))/nLength;
}
stdev = Math.sqrt(vSuma);
return stdev;
}
In other words, how best to adapt the ema.efs formula in the Library folder so that it gives the ema not of the close, but of stddev below?
Here's my formula for stddev:
function main(nInputLength) {
if(nInputLength == null)
nInputLength = 13;
var nLength = nInputLength;
var i;
var j;
var vSum = 0.0;
var vSuma = 0.0;
var vSumAvg;
var vValue;
var stdev;
var period;
var vSumaprev;
var test;
period = 0;
vValue = close(period, -nLength);
if(vValue == null) {
return;
}
for(i = 0; i < nLength; i++) {
vSum += vValue[i];
}
vSumAvg = vSum/nLength;
// return (vSum / nLength);
for(j = 0; j < nLength; j++) {
vSuma += ((vValue[j] - vSumAvg)*(vValue[j] - vSumAvg))/nLength;
}
stdev = Math.sqrt(vSuma);
return stdev;
}
Comment