Is there an efs out there which calculates bollinger bands based on a weighted moving average instead of a simple moving average. If not can some one show me how i can code one up
thanks
yoda
Here's another formula that might be helpful. It will show you how to code the Bollinger study using EMA. You could replace the code in the function EMA() with the weighted MA code.
thanks,
however the problem is what is the code for the weighted ma that i place in the main function area to replace all the ema code. i do know that there is a code for WMA that goes somthing like
vWMA = new MAStudy(10,0, "Close", MAStudy.WEIGHTED)
but how would i incorporate that since i thought this would be put in the program before the premain section.
Thanks in advance for anyone that can asist me with this matter
yoda
Here's a new formula that will give you the option to calculate the basis line as a Simple, Exponential or Weighted moving average for the Bollinger Bands study. The inputs available in "Edit Studies" are Length (20), MA Type (SMA) and Standard Deviations (2.0).
Hello Jason,
Thank you for the Answer and the Program’s. I found now also a Solution.
With my Program it’s possible to offset all 3 Lines separately with different Numbers
The program works fine and stable, the Performance Monitor show’s low CPU used.
Plaese have a look at it.
Herma
var fp1 = new FunctionParameter("nLength", FunctionParameter.NUMBER);
fp1.setLowerLimit(1);
fp1.setDefault(21);
var fp2 = new FunctionParameter("nStdDev", FunctionParameter.NUMBER);
fp2.setLowerLimit(0.1);
fp2.setDefault(2.0);
var fp3 = new FunctionParameter("nOffsetUp", FunctionParameter.NUMBER);
fp3.setLowerLimit(0);
fp3.setDefault(0);
var fp4 = new FunctionParameter("nOffsetBas", FunctionParameter.NUMBER);
fp4.setLowerLimit(0);
fp4.setDefault(0);
var fp5 = new FunctionParameter("nOffsetLow", FunctionParameter.NUMBER);
fp5.setLowerLimit(0);
fp5.setDefault(0);
}
var study = null;
function main(nLength, nStdDev, nOffsetUp, nOffsetBas, nOffsetLow) {
if (study == null) study = new BollingerStudy(nLength, "Close", nStdDev);
var vUpper = study.getValue(BollingerStudy.UPPER,-nOffsetUp);
var vBasis = study.getValue(BollingerStudy.BASIS,-nOffsetBas);
var vLower = study.getValue(BollingerStudy.LOWER,-nOffsetLow);
Comment