Announcement

Collapse
No announcement yet.

Daily Average Price Delta

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

  • Daily Average Price Delta

    On an Advance Chart, I would like to be able to add two lines similar to Bollinger Bands. These two lines would be based on Today's High and Today's Low, and one other variable. That other variable, called Daily Average Price Delta (DAPD), would be based upon a summation for each of the highs (hod) for the 21 days prior to today minus the summation for each of the lows (lod) for the last 21 days prior to today. The result of this calculation would then be divided by 21. The following formula represents this:

    DAPD = (Sum (21 hods) - Sum (21 lods))/21

    To produce these two lines that would work for any time interval, the DAPD would be added to Today's Low for one, and the DAPD would be subtracted from Today's High. The formulas would be as follows:

    Upper Line = today's low + DAPD
    Lower Line = today's high - DAPD

    For example, the DAPD for IBM, based on the prior 21 days (not including today) should be 2.25, and would cause the Upper Line value for today, 11/19/02, at 10:46 a.m. to be 77.84+2.25=80.09 and the Lower Line value would be 78.80-2.25=76.55. How would I go about calculating the DAPD? And, then how would I use a formula to place these two lines on a chart?

  • #2
    DAPD = (Sum (21 hods) - Sum (21 lods))/21

    and

    DAPD = Sum (21 hods)/21 - Sum (21 lods)/21

    and

    Sum (21 hods)/21 = 21maHigh

    so

    if you take the 21maHigh - 21maLow you should have your answer.

    Comment


    • #3
      Thank you for the quick response.

      I like the math!

      Is 21maHigh a variable that is available for use within a formula? Is it a global variable? How can I learn more about it?

      So, the statement in the formula would read:

      vDAPD = 21maHigh - 21maLow

      That seems way too easy a solution!

      Comment


      • #4
        Re: Reply to post 'Daily Average Price Delta'

        something like this should work

        var study1=new MAStudy(21,0,"High",MAStudy.SIMPLE);
        var study2=new MAStudy(21,0,"Low",MAStudy.SIMPLE);
        function main()

        ma21H=study1.getValue(MAStudy.MA,0);

        ma21L=study2.getValue(MAStudy.MA,0);

        var Davd=ma21H-ma21L;

        return Davd;
        ----- Original Message -----
        From: "eSignal Bulletin Board Mailer" <[email protected]>
        To: <[email protected]>
        Sent: Tuesday, November 19, 2002 1:06 PM
        Subject: Reply to post 'Daily Average Price Delta'


        > Hello dloomis,
        >
        > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        >

        Comment


        • #5
          That seems way too easy a solution!
          And it is. I think he was giving you a high level approach. Look at the builtin MA formula (in the builtin directory), you use that as a starting place to do this. Just define two builtin MA studies one that is a 21 day low and the other a 21 day high.

          If you have problems, let me know, but it should be pretty straight forward.
          Garth

          Comment


          • #6
            Re: Reply to post 'Daily Average Price Delta'

            var study1=new MAStudy(21,0,"High",MAStudy.SIMPLE);
            var study2=new MAStudy(21,0,"Low",MAStudy.SIMPLE);
            function main()
            {
            ma21H=study1.getValue(MAStudy.MA,0);

            ma21L=study2.getValue(MAStudy.MA,0);

            var Davd=ma21H-ma21L;

            return Davd;
            }

            ----- Original Message -----
            From: "eSignal Bulletin Board Mailer" <[email protected]>
            To: <[email protected]>
            Sent: Tuesday, November 19, 2002 1:15 PM
            Subject: Reply to post 'Daily Average Price Delta'


            > Hello dloomis,
            >
            > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            >

            Comment


            • #7
              MAStudy

              Which MAStudy are you using for:

              var study1=new MAStudy(21,0,"High",MAStudy.SIMPLE);

              and

              ma21H = study1.getValue(MAStudy.MA,0);

              I inserted a debugPrint for ma21H after the statement above to find out that it returned a null value.

              Please advise.

              Comment

              Working...
              X