Announcement

Collapse
No announcement yet.

Standard deviation bands around a price oscillator

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

  • Standard deviation bands around a price oscillator

    I am trying to write an EFS to do the following:
    1) Take the difference between 2 exponential MA's and plot it.
    2) Calculate the standard deviation bands of step 1 and plot it.

    Essentially it is similar to Bolinger Bands except the basis line is the difference between 2 exponential MA's. Any help would be appreciated.

    Thanks
    Walid

  • #2
    Walid
    Click here and download BBof_template.efs which will calculate the Bollinger Bands of any user defined variable.
    Open the efs with the Editor and insert in the marked section the calculations for your variable. You will also need to set it to plot as a non price study (see setPriceStudy(true) in the preMain() section of the efs)
    Alex

    Comment


    • #3
      I'm trying to do something similar. I'm trying to take the difference of two stock symbols and plot bollinger bands around the result. For example:

      vIBM = getValue("Close", "IBM");
      vMSFT = getValue("Close", "MSFT");
      vSum = vIBM - vMSFT;

      where vSum is my 'user defined variable.'

      When I insert the vSum formula and result into the BBof_template.efs, it does not function.

      I think the problem may be that I need to change vSum into an array? If so, how would this be done using this example?
      Last edited by EllisWyatt; 01-29-2005, 03:18 PM.

      Comment


      • #4
        EllisWyatt and Walid
        I just realized that I had omitted to update the efs in my FileShare group.
        The more recent version of BBof_template.efs also includes an array so as to allow to the use of any variable.
        Please download it again from the File Share group or use the EFS Auto Update function.
        Alex

        Comment


        • #5
          Thanks Alexis for your help.

          Is it possible to use an EMA for the BB's instead of the SMA ?

          Walid

          Comment


          • #6
            Walid
            You would need to add the logic to calculate an EMA.
            Click here and download MA-EMA-WMAof_template.efs which you can use as a blueprint to do that. The EMA function can be easily applied to the BBof_template.efs with only some minor changes.
            Alex

            Comment


            • #7
              Thanks!!

              Alexis,

              It works great!

              Thank you so much.

              - Ellis

              Comment


              • #8
                Alex,

                I have used some of your EFS code with another which does an EMA BB. It compiles ok does not graph anything. I have attached it and would be greatful if you could have a look.

                Thanks
                Walid
                Attached Files

                Comment


                • #9
                  Walid
                  When you call function EMA in main() (in line 76) you are passing the array aValue but function EMA is expecting nClose. In function EMA you need to replace all instances of nClose with aValue. Also in the return statement of function EMA replace close() with aValue[0].
                  Lastly you have to do a null check before passing the array to function EMA.
                  Insert if(aValue[nLength-1]==null) return; just before line 76
                  The above changes should fix all the problems
                  Alex

                  Comment


                  • #10
                    Ellis
                    You are most welcome
                    Alex

                    Comment


                    • #11
                      Alex,

                      Thank you VERY much for your feedback. Your suggestions solved all my problems. It's a great little indicator if you know how to use it.

                      Walid

                      Comment


                      • #12
                        Walid
                        My pleasure
                        Alex

                        Comment

                        Working...
                        X