Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Condition builder help

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

    Condition builder help

    Does anyone have pointers on how I can achieve this? I've looked at Help/Videos.

    Buy at market opening 1st minute bar price +20 pts and simultaneously have a one cancels other order(OCO) to sell at 1st minute opening bar -20pts?

    #2
    Condition builder help

    I've managed this:

    Set Variable0 to Open Price of Opening Time bar + Price 20
    Set Enter Long with Stop/Limit when bar Close Price == Variable0

    Set Variable1 to Open Price of Opening Time bar - Price 20
    Set Enter Short with Stop/Limit when bar Close Price == Variable1


    How do I get one trade to cancel the other when it triggers?
    I'm looking at 'Order methods' in Help File.

    Comment


      #3
      Condition builder help

      This might work I'm thinking(need to test):

      When Variable0 matches price and Long position is triggered then set Variable1 to 0 so it can never match Price on future bars until it moves to next day and resets/initialises again at Opening Time.

      Comment


        #4
        Hello Shambo,

        Welcome to our forums.

        The main difficulty here is that you'll be running into NinjaTrader's internal order handling rules.



        Methods that generate orders (excluding market orders) to enter a position will be ignored if:
        • A position is open and an order submitted by an exit method (ExitLongLimit() for example) is active and the order is used to open a position in the opposite direction
        • A position is open and an order submitted by a set method (SetStopLoss() for example) is active and the order is used to open a position in the opposite direction
        • The strategy position is flat and an order submitted by an enter method (EnterLongLimit() for example) is active and the order is used to open a position in the opposite direction
        These rules can be turned off in our next version 7 but right now this is the main thing preventing your idea. A common workaround is monitoring the marketprice and placing then one order only at breakout time.

        OCO functionality can be achieved by working with IOrder objects and checking order states.
        Ryan M.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        61 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        39 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        21 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        23 views
        0 likes
        Last Post TheRealMorford  
        Started by Mindset, 02-28-2026, 06:16 AM
        0 responses
        51 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Working...
        X