Announcement

Collapse
No announcement yet.

Pop Quiz

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

  • Pop Quiz

    I need help understanding the following line of code:

    Code:
    var nC_1 = sma(1, ohlc4(), -1);
    I think it is asking for a 1 day simple moving average of yesterday's Open+High+Low+Close divided by 4.

    Am I close?
    Don

  • #2
    Re: Pop Quiz

    Don
    To be precise it is retreiving the value at the prior bar of a 1 period simple moving average of the Open+High+Low+Close divided by 4
    Alex


    Originally posted by schu7044
    I need help understanding the following line of code:

    Code:
    var nC_1 = sma(1, ohlc4(), -1);
    I think it is asking for a 1 day simple moving average of yesterday's Open+High+Low+Close divided by 4.

    Am I close?

    Comment


    • #3
      Re: Re: Pop Quiz

      Originally posted by Alexis C. Montenegro
      Don
      To be precise it is retreiving the value at the prior bar of a 1 period simple moving average of the Open+High+Low+Close divided by 4
      Alex
      Isn't that the same as saying you want the Open+High+Low+Close of the value of the prior bar divided by 4?

      Isn't a 1 period average the average of that one period?
      Don

      Comment


      • #4
        Re: Re: Re: Pop Quiz

        Don
        It is essentially the same. I was just being precise with the wording
        Alex


        Originally posted by schu7044
        Isn't that the same as saying you want the Open+High+Low+Close of the value of the prior bar divided by 4?

        Isn't a 1 period average the average of that one period?

        Comment


        • #5
          Re: Re: Re: Re: Pop Quiz

          Originally posted by Alexis C. Montenegro
          Don
          It is essentially the same. I was just being precise with the wording
          Alex
          No Please! I didn't mean it that way. I had moved on to the next question that hit my head. I need to test my thinking in order to make sure I know what I'm coding.

          The question was valid for either way it was said.

          Your precise answer was very helpful. It helped me to see that the 'day' I was referring to could be a 'week,' or even a 'minute.'
          Don

          Comment


          • #6
            So if I used this line of code:

            Code:
            var nC_1 = sma(1, ohlc4(), 0);
            I would be asking for the same calculation to be preformed on the current period?
            Don

            Comment


            • #7
              Re: Re: Re: Re: Re: Pop Quiz

              Don

              It helped me to see that the 'day' I was referring to could be a 'week,' or even a 'minute.'
              That is partly why I was being precise since in efs you can base your calculations on external intervals ie intervals that are different from the one being charted
              Alex


              Originally posted by schu7044
              No Please! I didn't mean it that way. I had moved on to the next question that hit my head. I need to test my thinking in order to make sure I know what I'm coding.

              The question was valid for either way it was said.

              Your precise answer was very helpful. It helped me to see that the 'day' I was referring to could be a 'week,' or even a 'minute.'

              Comment


              • #8
                Don
                That is correct
                Alex


                Originally posted by schu7044
                So if I used this line of code:

                Code:
                var nC_1 = sma(1, ohlc4(), 0);
                I would be asking for the same calculation to be preformed on the current period?

                Comment


                • #9
                  Thank you Alex. I appreciate all of your help.
                  Don

                  Comment


                  • #10
                    Don
                    You are most welcome
                    Alex


                    Originally posted by schu7044
                    Thank you Alex. I appreciate all of your help.

                    Comment

                    Working...
                    X