Announcement

Collapse
No announcement yet.

weighted average within a bar

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

  • weighted average within a bar

    How do I calculate the weighted average within a bar ? I know there is the built in MAStudy, that will calculate a moving average, but that is an average across x-number of bars. Also in the arguments for MAStudy what is 'offset' ? and where can I find it's definition ?

    THANKS -
    Jennifer

  • #2
    Jennifer,

    Offset means to move the results of the Moving Average left or right (left is negative, right is positive.) The best way to understand it is to open an Advanced Chart and apply a Moving Average to it (from the Basic Study menu.) Then add another, but this time include an offset. For example, here's a 34 period EMA (blue) and a 34 period EMA with an offset of 3 (red).



    Regarding calculating an weighted average within a bar, perhaps others may be able to help with that. I'm not familar with that process.
    Regards,
    Jay F.
    Product Manager
    _____________________________________
    Have a suggestion to improve our products?
    Click Support --> Request a Feature in eSignal 11

    Comment


    • #3
      Re: Reply to post 'weighted average within a bar'

      Jennifer,

      I saw this request earlier today re weighted average in a bar - what is the
      average you are looking for - price?

      Can you describe how to calculate it?

      >

      Comment


      • #4
        Thanks for the responses. I am not real fluent in this arena yet, so please bear with me. I have a tick chart where each bar contains 233 ticks. As the ticks are coming into the bar I want to calculate the weighted average of the price as the bar is moving so that I can use it in another calculation...don't ask me why - I am converting another persons TradeStation indicator.

        I think I may have just had a thought...

        Is it feasible to use the existing MAStudy in following manner:

        MAStudy(0,0,close(),WEIGHTED);

        Will that give me the weighted average of the values in the bar while the bar is building ?

        Thanks -
        Jennifer

        Comment


        • #5
          Re: Reply to post 'weighted average within a bar'

          Jennifer

          You have to add up the sum of all the prices in a bar and then divide by the
          number of prices in the bar.

          This can be dome, not sure if an efs is out there that does something
          similar or not

          Comment


          • #6
            Wouldn't that be a plain old average, not a weighted average ?

            Comment


            • #7
              Hello Jennifer,

              You can do a weighted average using the built-in MAStudy() object.

              PHP Code:
              nStudy = new MAStudy100"Close"MAStudy.WEIGHTED );

              //or 

              nStudy = new MAStudy100"Close"MAStudy.VOLUMEWEIGHTED ); 
              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


              • #8
                Re: Reply to post 'weighted average within a bar'

                Jason

                I think Jennifer wants to do a weighted average of the price based on the
                distribution of trades within a bar.

                For example, if the only 4 prices recorded during a bar were 90, 95, 100 and
                95, Jennifer wants to calculate

                90+95+100+95/4=95

                Comment


                • #9
                  Jennifer
                  Are you referring to the "Update on every tick" option in TradeStation?
                  If that is the case then yes the moving average (irrespective of type ie simple, exp, weighted, etc) will update on every tick unless you specifically set it to compute at the close of the bar only.
                  FWIW this applies to virtually all the studies/indicators used in efs.
                  Alex

                  Comment

                  Working...
                  X