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 f.saeidi, Today, 08:01 PM
        0 responses
        1 view
        0 likes
        Last Post f.saeidi  
        Started by Rapine Heihei, Today, 07:51 PM
        0 responses
        3 views
        0 likes
        Last Post Rapine Heihei  
        Started by frslvr, 04-11-2024, 07:26 AM
        5 responses
        96 views
        1 like
        Last Post caryc123  
        Started by algospoke, 04-17-2024, 06:40 PM
        6 responses
        49 views
        0 likes
        Last Post algospoke  
        Started by arvidvanstaey, Today, 02:19 PM
        4 responses
        11 views
        0 likes
        Last Post arvidvanstaey  
        Working...
        X