Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Order Handling

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

    Order Handling

    Good day

    I want to accomplish the following:

    1. Enter a limit order (based on the price of the close of the bar +/- an offset), and then check whether the order was filled upon the end of next bar. If not, cancel and replace the order based on the new price +/- offset. Repeat the process until the order is finally filled.

    2. Check for partial fills and update the order accordingly. Say, initial order was for 10 lots and only 2 were filled. Then, the updated order quantity should be 8.

    3. Have the order handling code running in a different BarInProgress than the rest of the code.


    I am not sure I should hire or develop? Please shed some light. Are there any samples in the public domain addressing this?


    Thanks

    #2
    Hello,

    Thanks for the forum post.

    This is actually not to bad to develop as this functionality is built into NinjaTrader EnterLongLimit() method.

    Please see this description. What happens is that the limit order is cancelled unless it is called on each bar. However if you make a modification to the limit price it will update each bar and also if it gets filled it will no longer submit limit orders since your already long.



    Let me know if I can be of further assistance.

    Comment


      #3
      Hi Brett

      I appreciate your feedback. I am not sure I understood correctly. This seems rather easy. Would you mind taking a look at the following and please let me know if those code lines below would behave as required, say:

      1. issues a buy limit order based on the current bid-offset and then, if not filled, cancels the order at the end of bar and issues another buy limit order based on the current bid-offset, until the position is totally filled.

      2. updates the order quantity based on any partial fills occurred in previous bars.


      private int myorder;
      myorder = DefaultQuantity - Position.Quantity;
      if (myorder > 0) EnterLongLimit (myorder,GetCurrentBid()-offset,"my limit order");



      Thanks for your support.

      Comment


        #4
        Hello,

        Yes this should behave as you suspect.

        Let me know if I can be of further assistance.

        Comment


          #5
          Thanks Brett

          Can you tell me whether this approach is realistically back-testable in NT Strategy Analyzer?

          Comment


            #6
            Hello,

            Yes should have no issue with backtest as the simulator will simulate this no problem.

            The only different I might expect is a different in part filles vs sim and live. However nothing will be 100% like live market conditions.

            Let me know if I can be of further assistance.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Belfortbucks, Today, 09:29 PM
            0 responses
            6 views
            0 likes
            Last Post Belfortbucks  
            Started by zstheorist, Today, 07:52 PM
            0 responses
            7 views
            0 likes
            Last Post zstheorist  
            Started by pmachiraju, 11-01-2023, 04:46 AM
            8 responses
            151 views
            0 likes
            Last Post rehmans
            by rehmans
             
            Started by mattbsea, Today, 05:44 PM
            0 responses
            6 views
            0 likes
            Last Post mattbsea  
            Started by RideMe, 04-07-2024, 04:54 PM
            6 responses
            33 views
            0 likes
            Last Post RideMe
            by RideMe
             
            Working...
            X