Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

High of x bars back

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

    High of x bars back

    Is it possible to achieve following in strategy builder in Ninja8?. I have tried but could not come up with correct sequence on what i want to do , not a programmer so rely on strategy builder.

    Long = buy when price is one tick above high of last 5 bars
    Short = sellshort when price is one tick lower than low of 5 bars

    I want to enter as stop order dont want to wait until bar closes. Also want to use an input for bar back from 5-40 so i can optimize it. Help is appreciated. Thx

    #2
    Hello trader333,

    Thanks for your post.

    To enter an order intrabar you will need to run your strategy with Calculate.OnPriceChange (or Calculate.OnEachTick).

    To obtain the highest high of the last 5 bars you can use the MAX() indicator where you would select the High price series as the input and use a bars ago of 1 and check to see if the close price (which will be the current price in either of the Calculate modes used) is Greater than or equal to the MAX indicator results.

    To obtain the lowest low of the last 5 bars you can use the MIN() indicator where you would select the Low price series as the input and use a bars ago of 1 and check to see if the close price (which will be the current price in either of the Calculate modes used) is Less than or equal to the MIN indicator results.

    To use a stop order for entry you would have to place the order above the current price for long or below the current price for short.

    You would not be able to place a longstop and a shortstop order at the same time as this would violate the internal order handling rules, these can found here: " Internal Order Handling Rules that Reduce Unwanted Positions" https://ninjatrader.com/support/help...d_approach.htm

    An approach might be to use some additional criteria which would determine which order to submit (long or short) to not violate the internal rules.
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Thanks Paul, I was wondering if it could be done in strategy builder, if yes how

      Comment


        #4
        Hello trader333,

        Thanks for your reply.

        My response was based on the strategy builder.

        You'll need to create this yourself as we do not provide custom strategy work.

        If you would like it created for you we can provide references to 3rd party programmers.
        Paul H.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by frankthearm, Yesterday, 09:08 AM
        12 responses
        43 views
        0 likes
        Last Post NinjaTrader_Clayton  
        Started by junkone, Today, 11:37 AM
        2 responses
        12 views
        0 likes
        Last Post junkone
        by junkone
         
        Started by quantismo, 04-17-2024, 05:13 PM
        5 responses
        35 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by proptrade13, Today, 11:06 AM
        1 response
        6 views
        0 likes
        Last Post NinjaTrader_Clayton  
        Started by love2code2trade, 04-17-2024, 01:45 PM
        4 responses
        35 views
        0 likes
        Last Post love2code2trade  
        Working...
        X