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 mattbsea, Today, 05:44 PM
        0 responses
        3 views
        0 likes
        Last Post mattbsea  
        Started by RideMe, 04-07-2024, 04:54 PM
        6 responses
        31 views
        0 likes
        Last Post RideMe
        by RideMe
         
        Started by tkaboris, Today, 05:13 PM
        0 responses
        2 views
        0 likes
        Last Post tkaboris  
        Started by GussJ, 03-04-2020, 03:11 PM
        16 responses
        3,282 views
        0 likes
        Last Post Leafcutter  
        Started by WHICKED, Today, 12:45 PM
        2 responses
        20 views
        0 likes
        Last Post WHICKED
        by WHICKED
         
        Working...
        X