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

question about unmanaged

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

    question about unmanaged

    good day, please help, I'm trying to understand the unmanaged mode, I decided to do a little strategy with placing orders, but for some reason they don't open, could you please tell me what my error is? Below attached code.
    Attached Files

    #2
    Originally posted by Papercut110 View Post
    good day, please help, I'm trying to understand the unmanaged mode, I decided to do a little strategy with placing orders, but for some reason they don't open, could you please tell me what my error is? Below attached code.
    Have you first tried experimenting with market orders?
    These may be easier to get started with than the Limit entry
    orders you're trying to use.

    Another problem I see: your entryOrder never gets set back
    to null after the entry order is filled.

    Otherwise, your use of SubmitOrder() looks fine to me.

    On a possibly different note ...

    Your OnExecution is not robust enough.

    If DefaultQuantity > 1 expect problems with partial fills,
    since I see your OnExecution doesn't handle that.

    Partial fills for your protective stop and profit target will
    also fail for similar reasons.

    Why? OnExecution is called for every fill or partial fill of
    every order: whether entry, stop, or target.

    Consider this:
    Your stop order gets partial filled which invokes OnExecution
    where your code sets a new stop and target order (which
    is obviously not what you will be wanting).

    You will only see these major problems with DefaultQuantity > 1
    but never with strategy analyzer (which doesn't do partial fills).

    You can allow/deny partial fills in Sim101 via the Options dialog.

    Study this reference tutorial here for some ideas on a better
    and more robust OnExecution:

    The OnOrderUpdate() and OnExecution() methods are reserved for experienced programmers. Instead of using Set() methods to submit stop-loss and profit target orders, you can submit and update them manually through the use of IOrder and IExecution objects in the OnOrderUpdate() and OnExecution() methods. The OnOrderUpdate()

    Comment


      #3
      Hello Papercut110,

      Thank you for your post.

      bltdavid provides some good insight into what you are performing. I would also recommend implementing debugging techniques such as TraceOrders so that you can see what is happening with the orders. I would also recommend checking the Log tab of the Control Center for any messages on your orders.

      For information on TraceOrders please visit the following link: http://ninjatrader.com/support/forum...ead.php?t=3627

      Please let me know if you have any questions.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by aa731, Today, 02:54 AM
      0 responses
      4 views
      0 likes
      Last Post aa731
      by aa731
       
      Started by thanajo, 05-04-2021, 02:11 AM
      3 responses
      470 views
      0 likes
      Last Post tradingnasdaqprueba  
      Started by Christopher_R, Today, 12:29 AM
      0 responses
      10 views
      0 likes
      Last Post Christopher_R  
      Started by sidlercom80, 10-28-2023, 08:49 AM
      166 responses
      2,237 views
      0 likes
      Last Post sidlercom80  
      Started by thread, Yesterday, 11:58 PM
      0 responses
      5 views
      0 likes
      Last Post thread
      by thread
       
      Working...
      X