Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Submit and cancel orders

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

    Submit and cancel orders

    Hi,
    First time poster, so I hope I'm not asking something obvious. I search but couldn't find a solution to thank you for the time.

    This is what I'm trying to do:
    I would like to identify the bar which was just closed, let's say it's an inside bar.
    If the the last bar was an inside bar, then I would like to submit a bracket order: Buy X shares when the prices goes above that bar + stoploss at some price.

    But, if during the next bar, the price goes below the inside bar, then cancel all orders that were submitted.

    How can I do that?
    What I'm having trouble with is:
    1. How to know that a bar was just close [I want to check the inside bar only on bar close]
    2. How do I check the prices on bar update [not wait for the second bar to close]
    3. how to I submit bracket orders and how do I cancel all orders.

    Thank you!

    #2
    Hello benharper,
    Welcome to the forum and I am happy to assist you.

    1 & 2 - please refer to this sample code which demonstrates how to separate the logic to calculate tick by tick and on the end of the bar.



    3. To submit a bracket order you have to use the Unmanaged approach. Please refer to out help guide to know more about it
    JoydeepNinjaTrader Customer Service

    Comment


      #3
      Thanks, I read the links and they are very helpful. In the second link, the Unmanaged approach, I still don't see a way to create a bracket order. Can you help me with that? The idea is to send long+stoploss together, but the stoploss will take effect only after the long is filled. Is it possible? I simply don't want a stoploss order to exist if I'm not in a position - potentially creating an unintended short order.
      Hope I make sense. Thanks again.

      Comment


        #4
        Hello benharper,
        To clarify further, are you trying to place a bracket order (placing a long and a shot order at the same time) or simply trying to place an entry order (buy OR sell order) and want to place a stop order when your entry order gets filled.
        JoydeepNinjaTrader Customer Service

        Comment


          #5
          Hi, sorry it took me some time to reply.
          "simply trying to place an entry order (buy OR sell order) and want to place a stop order when your entry order gets filled." - that one.

          Comment


            #6
            Hello gogetit,

            Thank you for your response.

            This will require conditions that check your position to make sure it is filled before submitting the Stop Loss.

            For this you will need to understand OnPositionUpdate(): http://www.ninjatrader.com/support/h...tionupdate.htm

            And you will need to understand IPosition parameters: http://www.ninjatrader.com/support/h.../iposition.htm

            Please let me know if you have any questions.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by kujista, Today, 05:44 AM
            0 responses
            5 views
            0 likes
            Last Post kujista
            by kujista
             
            Started by ZenCortexCLICK, Today, 04:58 AM
            0 responses
            5 views
            0 likes
            Last Post ZenCortexCLICK  
            Started by sidlercom80, 10-28-2023, 08:49 AM
            172 responses
            2,281 views
            0 likes
            Last Post sidlercom80  
            Started by Irukandji, Yesterday, 02:53 AM
            2 responses
            18 views
            0 likes
            Last Post Irukandji  
            Started by adeelshahzad, Today, 03:54 AM
            0 responses
            8 views
            0 likes
            Last Post adeelshahzad  
            Working...
            X