• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to say IF current price is higher than price since last X bars?

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

    How to say IF current price is higher than price since last X bars?

    Hi,


    Hopefully the title is pretty self explanatory. Trying to avoid taking trades in ranging conditions because it doesn't help the strat.

    Thanks

    #2
    Originally posted by demo166130 View Post
    Hopefully the title is pretty self explanatory.
    Actually, no.

    "higher than price of last X bars"

    Do you mean the highest High price of last X bars?
    Or the highest Close price of last X bars?

    Comment


      #3
      Thanks for your inquiry demo166130,

      HighestBar could be used to determine if the current price is the highest of the last X number of bars and can take any price series as input (Open, High, Low, Close.)

      HighestBar(Close, 4) would tell you how many bars ago the highest Close value was in the last 4 bars.

      if(HighestBar(Close, 4) == 0) would tell you that the current Close is the highest value from 4 bars ago.

      HighestBar() - https://ninjatrader.com/support/help...highestbar.htm

      HighestBar can be used in the Strategy Wizard in a Condition Builder under Misc > Highest bar.

      Please let us know if we can be of further assistance.
      JimNinjaTrader Customer Service

      Comment


        #4
        Originally posted by bltdavid View Post

        Actually, no.

        "higher than price of last X bars"

        Do you mean the highest High price of last X bars?
        Or the highest Close price of last X bars?
        Both. I mean I'm trying to ask IF current price is higher than the price of the last X number of bars, whether that be close or highest high. Where X exists I would define a value, obviously. Trying to avoid using C# where possible.

        Comment


          #5
          Originally posted by NinjaTrader_Jim View Post
          Thanks for your inquiry demo166130,

          HighestBar could be used to determine if the current price is the highest of the last X number of bars and can take any price series as input (Open, High, Low, Close.)

          HighestBar(Close, 4) would tell you how many bars ago the highest Close value was in the last 4 bars.

          if(HighestBar(Close, 4) == 0) would tell you that the current Close is the highest value from 4 bars ago.

          HighestBar() - https://ninjatrader.com/support/help...highestbar.htm

          HighestBar can be used in the Strategy Wizard in a Condition Builder under Misc > Highest bar.

          Please let us know if we can be of further assistance.
          Many thanks. That goes pretty much all the way to explaining.

          Peace, but never with truth as a compromise.

          Comment


            #6
            Having tried to do this using the Wizard I'm not entirely clear how it works. Lets say we want to make a stipulation for entering a trade 'If the current bar close is greater than the highs of the last X bars', is it the Period on the left or the Bars ago on the right that would define how many bars ago we're looking back?

            So on the left you have Misc > Lowest Bar ***Which values here**** 'less than' Price Data > 'Low' ****Which values here??***

            Comment


              #7
              And is 'if(HighestBar(Close, 4) == 0)' saying If since the last 4 bars the current close is highest?

              Comment


                #8
                Hello demo166130,

                Thanks for the reply.

                The BarsAgo property is the value that your script is going to read. If you specified 1 for the BarsAgo, then it would evaluate the Low of the bar 1 bar ago.

                If 'if(HighestBar(Close, 4) == 0)', that would mean the highest bar is the current close.

                Please let me know if I can assist further.
                Chris L.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by bdelorm73, Today, 07:04 PM
                2 responses
                15 views
                0 likes
                Last Post bdelorm
                by bdelorm
                 
                Started by bdelorm73, Today, 06:51 PM
                0 responses
                13 views
                0 likes
                Last Post bdelorm73  
                Started by einstein, Today, 06:41 PM
                0 responses
                2 views
                0 likes
                Last Post einstein  
                Started by memonic, Today, 03:57 PM
                0 responses
                8 views
                0 likes
                Last Post memonic
                by memonic
                 
                Started by demo166130, Today, 03:00 PM
                1 response
                6 views
                0 likes
                Last Post NinjaTrader_JoshG  
                Working...
                X