Announcement

Collapse
No announcement yet.

bollinger bands based on a weighted ma

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • bollinger bands based on a weighted ma

    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

  • #2


    should have an efs by Jason which is close to what you need

    Comment


    • #3
      Hello 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.

      BollingerEMA.efs
      Jason K.
      Project Manager
      eSignal - an Interactive Data company

      EFS KnowledgeBase
      JavaScript for EFS Video Series
      EFS Beginner Tutorial Series
      EFS Glossary
      Custom EFS Development Policy

      New User Orientation

      Comment


      • #4
        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

        Comment


        • #5
          Hello 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).

          BollingerMAs.efs

          Jason K.
          Project Manager
          eSignal - an Interactive Data company

          EFS KnowledgeBase
          JavaScript for EFS Video Series
          EFS Beginner Tutorial Series
          EFS Glossary
          Custom EFS Development Policy

          New User Orientation

          Comment


          • #6
            thanks it works great

            Comment


            • #7
              Hello Jason
              is it possible to offset the Bollinger-Band?

              Comment


              • #8
                Hello Herma,

                Sure we can. Here are a couple versions for you to try.

                BollingerOffset.efs - Uses the built-in Bollinger study.
                BollingerMAsOffset.efs - Modified version of BollingerMAs.efs.
                Jason K.
                Project Manager
                eSignal - an Interactive Data company

                EFS KnowledgeBase
                JavaScript for EFS Video Series
                EFS Beginner Tutorial Series
                EFS Glossary
                Custom EFS Development Policy

                New User Orientation

                Comment


                • #9
                  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


                  /************************************************** **************************************************
                  Copyright © eSignal, a division of Interactive Data Corporation. 2002. All rights reserved.
                  Var.2 - Herma 30-9-2003
                  ************************************************** ************************************************** */


                  function preMain() {

                  setPriceStudy(true);

                  setStudyTitle("BolBands w3 Offsets");

                  setCursorLabelName("BolUp",0);
                  setCursorLabelName("BolBas",1);
                  setCursorLabelName("BolLow",2);

                  setDefaultBarFgColor(Color.green, 0); // upper
                  setDefaultBarFgColor(Color.blue, 1); // basis
                  setDefaultBarFgColor(Color.red, 2); // lower

                  setDefaultBarThickness(1, 0);
                  setDefaultBarThickness(2, 1);
                  setDefaultBarThickness(1, 2);

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

                  return new Array(vUpper, vBasis, vLower);
                  }
                  Attached Files

                  Comment

                  Working...
                  X