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

Rejected State

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

    Rejected State

    ​​​Hi Team,

    I want to use the Rejected State with an add-on based on a specific condition. I'm not able to do it and I'm forced to wait for the State Submitted and then Cancel the order. Looking at the accounts tab and the properties in the account I found few settings like max position size and were grateful surprised that I get the behavior that I'm trying to do. When max position size is 2 and I use more than 2, I get in the log the rejected state. Doesn't matter if I try it in the DOM, with a strategy, always is the same result. This is the result I get and want to copy:


    Click image for larger version

Name:	2020-10-31_19h44_38.png
Views:	178
Size:	12.6 KB
ID:	1125625

    Any example of how to accomplish this with an add-on?

    Thank you so much

    #2
    Hello Protech,

    From the addon approach you can assign a method handler to the <account>.OrderUpdate event, and see when the argument.OrderState is OrderState.Rejected.


    With the error message, do you have a risk template applied to the Sim101 account?
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hi NinjaTrader_ChelseaB

      Thank you for your answer. Let me explain it with an example. I don't need to create an Order, I want to use any order that can be placed using ATM or not. I mean any order with NinjaTrader. Let say a simple condition:

      if Trades >5 do something (in this case reject any new order)

      What I do actually, wait first for the submitted stated, and then I canceled the order. The error message showed in the previous comment is what I need to do, I mean based on this condition reject the order. I know with strategies this can be done, but with an add-on, I didn't find an example about it.

      Thank you for your time

      Comment


        #4
        Hello Protech,

        Adding an event handler method to the<account>.OrderUpdate event would not be creating a new order. This would assigning a method to the order update event that runs anytime an order changes states.

        Below is a link to an example addon that uses <account>.Cancel().
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by itrader46, Today, 09:04 AM
        1 response
        3 views
        0 likes
        Last Post NinjaTrader_Clayton  
        Started by timmbbo, Today, 08:59 AM
        0 responses
        1 view
        0 likes
        Last Post timmbbo
        by timmbbo
         
        Started by bmartz, 03-12-2024, 06:12 AM
        5 responses
        33 views
        0 likes
        Last Post NinjaTrader_Zachary  
        Started by Aviram Y, Today, 05:29 AM
        4 responses
        14 views
        0 likes
        Last Post Aviram Y  
        Started by algospoke, 04-17-2024, 06:40 PM
        3 responses
        28 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Working...
        X