Announcement

Collapse
No announcement yet.

How can I check if Startegy.islong() on a previous bar.

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

  • How can I check if Startegy.islong() on a previous bar.

    if (!Strategy.isLong(-1)..... has no parameter to check previous bars. (-1) doesn't work.

    also: How can you check the condition of a boolean variable on previous bar ?
    myVar(-5) == x, myVar(lastBar) == x , myVar 2 bars ago == x

    Thanks
    Last edited by huntergatherer; 08-29-2012, 10:06 AM.

  • #2
    How do I find the value assigned to a Variable on previous bar...

    That is not a study or function.

    myVar = null;

    Main()

    if ( close() == x) {
    myVar = 1;
    }

    if( myVar.getValue(-1)....returns error myVar has no properties. myVar works for code on the current bar such as

    if(myVar == 1( {.....but I can't figure out how to access it's value on a previous bar.

    Comment


    • #3
      huntergatherer
      With regards to your first question you will need to keep track of it yourself using global variables
      As to your second question depending on your needs there are various ways to store and/or retrieve historical values of custom variables [ref(), arrays, etc]. If you search the forums [eg for previous values] you will find several examples as this topic has been covered before
      Alex


      Originally posted by huntergatherer View Post
      That is not a study or function.

      myVar = null;

      Main()

      if ( close() == x) {
      myVar = 1;
      }

      if( myVar.getValue(-1)....returns error myVar has no properties. myVar works for code on the current bar such as

      if(myVar == 1( {.....but I can't figure out how to access it's value on a previous bar.

      Originally posted by huntergatherer View Post
      if (!Strategy.isLong(-1)..... has no parameter to check previous bars. (-1) doesn't work.

      also: How can you check the condition of a boolean variable on previous bar ?
      myVar(-5) == x, myVar(lastBar) == x , myVar 2 bars ago == x

      Thanks

      Comment


      • #4
        Having difficulty using the search for the forums because of the jumbled letter verification window.

        Can't tell if it's a 9 or lower case g. Is it a capital letter or small case. O there's 2 letters on top of
        each other which one goes first. There's one I missed in the same colored clouds it didn't matter
        anyway because just a portion of the letter was visible. I Refresh the window 10 times with the
        same problem. Then when I finally get in it says your search term was to common and
        no results returned or when I searched for "ref()" it said no match was found. Another Day Wasted.

        Comment

        Working...
        X