Announcement

Collapse
No announcement yet.

Bollinger Band width

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Bollinger Band width

    Is it possible to create a study that is based upon the width of the Bollinger Bands?

    I'd like to have the bars change colors when the BolBands are smaller than xxxx.

    Bruce

  • #2
    Bruce
    Using the Editor you can edit the BollingerBands.efs that is in the Bollinger folder of Formulas. The conditions would be

    if((vUpper-vLower)<yourvalue)
    setPriceBarColor(Color.yourdefaultcolor);

    In preMain then you must add the following

    setColorPriceBars(true);
    setDefaultPriceBarColor(Color.yourcolor);

    Save the efs with a different name and you should be set
    Alex

    Comment


    • #3
      Alex:

      Could you look at the revised study and let me know what I need to do to get it to work.

      Bruce

      P.S. its placed on 6E M4 1min
      Attached Files

      Comment


      • #4
        Bruce
        FWIW the formula you posted is not the one I was referencing which is in the Bollinger folder.
        Anyhow the attached revision of the efs should do what you want.
        NOTES: I added a FunctionParameter for a "Value" so that you can modify it through Edit Studies.
        I also used a formatPriceNumber() in the equation which will allow you to write the Value as you see it in the chart otherwise the <300 would actually have to be <0.003
        Hope this helps
        Alex
        Attached Files

        Comment


        • #5
          Alex:

          It worked fine.

          Is there any difference between the BB study I have and the one you recommended.

          Bruce

          Comment


          • #6
            Bruce
            Not really except that the syntax used is different. Actually in some ways this one is better as all the parameters are adjustable through Edit Studies
            Alex

            Comment


            • #7
              Alex:

              Thanks, its great.

              Bruce

              BTW: I assume I have to figure out the value (300 vs 30) depending on the commodity I'm trading.

              Comment


              • #8
                Bruce
                Yes because that value is directly related to price.
                Alex

                Comment


                • #9
                  Hi,
                  would it be possible please, to have the original bandwidth script, but instead of a line plotted, a histogram where if the current bar is higher than the previous, being of a different color and updated in real intraday time.

                  I'm ready to pay a small fee for this if necessary.

                  Cordially,
                  Koros

                  Comment


                  • #10
                    Bandwidth with an ema

                    I'm wondering if it would be possible to come up with an efs of bollinger bandwidth with an 8 period ema. Ideally all parameters would be user adjustable but if not ,based on 20 period simple ma, 2.0 standard deviations and overlaid ema of 8 periods.
                    The idea of this would be to look for crosses of ema and indicator to act as filter, idea being that when bandwidth is below indicator, volatilty is decreasing and no new positions would be entered. Any advice or ideas would be much appreciated.
                    Thanks, Bill
                    Last edited by pwstreet; 04-23-2005, 08:43 AM.

                    Comment


                    • #11
                      Bill
                      If you are running version 7.8 or earlier then one solution is to use the MA-EMA-WMAof_template.efs that is available here and that will plot an average of any custom variable. You can either copy the Bollinger bandwith logic to the section indicated in the efs or use call() to retrieve the values of the Bollinger bandwidth efs (see also the example shown in this post in the same thread).

                      If instead you are using version 7.9 then you can take advantage of the new efs() function to easily create a study on study using any external efs. An example of the required command would be

                      var Bndwidth = efsExternal("/Bollinger/Bandwidth.efs");
                      var MAofBndwidth = ema(8,Bndwidth);


                      The first line calls the study and creates a series that can be used as a source by the builtin moving average study. The second line creates the moving average of the custom source. Then you would return both Bndwidth and MAofBndwidth.
                      The above commands assume that you have the Bandwith.efs in the Bollinger folder of Formulas. If not you will need to change the path.

                      For more information and examples on using the new efsExternal() function see this thread.
                      Alex

                      Comment


                      • #12
                        Ema of Bandwidth

                        Hi Alexis,
                        Thanks for the response. I've downloaded the new e-signal 7.9 and have spent over 3 hours trying to come up with an efs to do what I want. I don't have a clue how to program in e-signal language but I was trying to use one of your examples. After continually getting errors when loading the efs, the best I've been able to do is the one below that just comes up blank. I've been using Metastock for the last 5+ years, and all I have to do there is drag the ema function onto whatever indicator on the chart that I want an ema of, very simple. I was hoping this new efs(2) thing would make it a little more user friendly but it appears a knowledge of programming is still needed. Any further suggestions or links would be much appreciated.

                        Thanks again, Bill

                        function preMain() {

                        setStudyTitle("EMA of Bandwidth");
                        setCursorLabelName("Bandwidth", 0);
                        setCursorLabelName("EMA", 1);
                        setPlotType(PLOTTYPE_LINE, 0);
                        setDefaultBarFgColor(Color.blue, 0);
                        setDefaultBarFgColor(Color.red, 1);

                        }

                        function main(Length,Length2) {

                        var Bndwidth = efsExternal("/Bollinger/Bandwidth.efs");
                        var MAofBndwidth = ema(8,Bndwidth);

                        }
                        //this is the separate function that calculates the range
                        function range() {

                        return efsExternal("/Bollinger/Bandwidth.efs");
                        return ema(8,Bndwidth);
                        }

                        Comment


                        • #13
                          EFS2

                          Hello Bill,

                          You just reflected my thoughts on the EFS2. With all the hoopla before its release I thought that users with no programming skills will be able to use EFS2 to write code as they wish. I guess that is a state of sublimal bliss that we cannot attain as yet. At the very least I thought that they would enhance the Formula Wizard so that one can use formulas and files other than those in the builtin folder. Looks like we can get to Mars and be back before it happens.

                          Just another frustrated user

                          Sesh

                          Comment


                          • #14
                            Bill
                            Enclosed in the first box below is the corrected version of your script.
                            Note that the Bandwidth.efs that is being called does not have adjustable length so you can only make the length of the EMA adjustable.

                            PHP Code:
                            function preMain() {

                                
                            setStudyTitle("EMA of Bandwidth");
                                
                            setCursorLabelName("Bandwidth"0);
                                
                            setCursorLabelName("EMA"1);
                                
                            setDefaultBarFgColor(Color.blue0);
                                
                            setDefaultBarFgColor(Color.red1);
                            }

                            function 
                            main(MAlength) {

                                if(
                            MAlength==nullMAlength 8//default EMA length

                                
                            var Bndwidth efsExternal("/Bollinger/Bandwidth.efs");
                                var 
                            MAofBndwidth ema(MAlength,Bndwidth);

                                return new Array (
                            Bndwidth,MAofBndwidth);

                            The above example illustrates how easy it can be in EFS2 to create a study of an existing custom study. This can be very handy when the original study you want to use is difficult to rewrite.
                            In the specific case of the Bandwidth.efs it is a very simple study so it can be easily replicated as a separate function within the efs itself. Here below is how you would do it. In the example I am using EFS2 syntax all across the script and have added adjustable settings for the length and the standard deviation of the Bollinger study.
                            As to learning how to program in EFS you may want to read through the EFS KnowledgeBase and in particular the Help Guides section which will provide you with the fundamentals of EFS.
                            Alex

                            PHP Code:
                            function preMain() {

                                
                            setStudyTitle("EMA of Bandwidth");
                                
                            setCursorLabelName("Bandwidth"0);
                                
                            setCursorLabelName("EMA"1);
                                
                            setDefaultBarFgColor(Color.blue0);
                                
                            setDefaultBarFgColor(Color.red1);
                            }

                            function 
                            main(BBlength,BBstddev,MAlength) {

                                if (
                            BBlength==nullBBlength 20//default BB length
                                
                            if (BBstddev==nullBBstddev 2//default BB stddev
                                
                            if (MAlength==nullMAlength 8//default for EMA length

                                
                            var Bndwidth efsInternal("Bandwidth",BBlength,BBstddev);
                                var 
                            MAofBndwidth ema(MAlength,Bndwidth);

                                return new Array (
                            Bndwidth,MAofBndwidth);
                            }

                            function 
                            Bandwidth(length,stddev){

                                return (
                            upperBB(length,stddev)-lowerBB(length,stddev))/middleBB(length,stddev)*100;

                            Comment


                            • #15
                              Ema of Bandwidth

                              Hi Alexis,
                              Thank you for your help and suggestions. I downloaded your script and it's just what I wanted. You make it seem so easy. I guess I'll have to check out the links you provided to get an understanding of the process. I really liked Seshadri's idea in the previous post of allowing the formula wizard to access a greater range of formulas. That would be a big step in helping us non-programmers. I have done a few efs's using the wizard and although not the most intuitive, it still allows someone with no experience to create a custom efs.
                              Thanks again for all your effort. And thank you Seshadri for your response. Nice to know I'm not the only one.
                              Thanks, Bill

                              Comment

                              Working...
                              X