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:	104
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.
    https://ninjatrader.com/support/help...rderupdate.htm

    With the error message, do you have a risk template applied to the Sim101 account?
    https://ninjatrader.com/support/help...TheAccountsTab
    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().
        https://ninjatrader.com/support/foru...720#post820720
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by trader3000a, Today, 06:16 AM
        1 response
        4 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by akwash72m, Today, 05:39 AM
        1 response
        12 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by Devside_Victor, Today, 06:32 AM
        1 response
        5 views
        0 likes
        Last Post NinjaTrader_Kate  
        Started by Doctor JR, Today, 06:57 AM
        1 response
        3 views
        0 likes
        Last Post NinjaTrader_PaulH  
        Started by athyssen, Yesterday, 08:21 PM
        1 response
        7 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Working...
        X