Announcement

Collapse
No announcement yet.

How can I pick up values of variables for previous bars?

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

  • How can I pick up values of variables for previous bars?

    When I have my own declared variable "output2" as in:
    var output2=xxxx+yyyy;
    How can I pick up values of output2 for previous bars?

  • #2
    I have re-phrased my original question as displayed here in this "reply".

    Please help.

    How can I pick up values of output2 for previous bars
    when I have declared my own variable "output2"?

    ...
    ...
    var output2=xxxx+yyyy;
    ...
    ...
    return new Array (output2,output5,output6);

    I have tried ref(), getvalue(), etc.

    Comment


    • #3
      Re: How can I pick up values of variables for previous bars?

      jcm21
      See the solutions provided in this thread on the same topic
      Alex


      Originally posted by jcm21
      When I have my own declared variable "output2" as in:
      var output2=xxxx+yyyy;
      How can I pick up values of output2 for previous bars?

      Comment


      • #4
        Thanks Alex- much appreciate

        Thanks Alex
        Much appreciated

        Comment


        • #5
          Re: Thanks Alex- much appreciate

          jcm21
          My pleasure
          Alex


          Originally posted by jcm21
          Thanks Alex
          Much appreciated

          Comment


          • #6
            output2 is not the only variable returned ?

            When output2 is not the only variable returned from the main program will the proposed solution still work?
            (i.e.)
            function main()
            {
            ...
            ...
            var output2=xxxx+yyyy;
            ...
            ...
            return new Array (output2,output5,output6);
            }

            Comment


            • #7
              Please ignore the last reply

              Please ignore the last reply (from me). I think I just verified that, yes, when output2 is not the only variable returned from the main program the proposed solution will work. So I think this is the end of this thread. Thanks again Alex for your help.

              Comment


              • #8
                ONE MORE QUESTION

                I take it back - the last reply was not the last.

                One more question:

                In summary, is it true that I can use the ref() function only if only one variable is returned from Main?
                (and therefore if multiple values are returned the method explained in this thread must be used ?)

                Comment


                • #9
                  Re: ONE MORE QUESTION

                  jcm21
                  You can use the ref() function also when you are returning an array of values. See this thread for an example
                  Alex


                  Originally posted by jcm21
                  I take it back - the last reply was not the last.

                  One more question:

                  In summary, is it true that I can use the ref() function only if only one variable is returned from Main?
                  (and therefore if multiple values are returned the method explained in this thread must be used ?)

                  Comment

                  Working...
                  X