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

ATM Behavior: MIT order with pre-set Stop behavior

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

    ATM Behavior: MIT order with pre-set Stop behavior

    Hey,
    I in the process of making a NinjaScript strategy that makes executions and passes them to an ATM Strategy to be managed further.
    What I try to achieve is the following:
    I enter the market right away when the strategy meets its condition and set a pending MIT order.
    Like in 'pendingMIT.jpg'.


    As you can see from the screenshot I already calculated the desired Stop for the MIT order.
    The thing is that when the MIT order gets executed, the pre-set Stop is not being taken in consideration, still the stop is being set on the distance that's being set in the ATM (i.e. 5 ticks).
    Why the previously set Stop is being ignored and howcome this is acceptable behavior?

    You can see the outcome of MIT order on hitMIT.jpg

    Note: I intentionally moved the Limit price up for the purpose of showing the outcome of entering a MIT order with set Stop.


    TLDR:
    I want to set MIT order that has it's Stop already calculated, then to be passed in an ATM strategy and waiting for it's (eventual) execution.
    Is there an official way of doing so or I have to go for a work-around?
    Attached Files

    #2
    Hello AsterixBT,

    Thanks for your post.

    If I understand correctly you have a strategy that is using these methods: https://ninjatrader.com/support/help...gy_methods.htm to connect with an existing ATM strategy template?

    If so, I am not sure I understand why you are wanting to place additional stop orders as the ATM should be taking control after the strategies entry order is filled.

    If you are not using the ATM strategy methods then I recommend that your review the strategy SampleATMStrategy on your NinjaTrader for an example of a strategy that places an entry order and then the ATM takes control of the profit/stop orders.
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Paul View Post
      If I understand correctly you have a strategy that is using these methods: https://ninjatrader.com/support/help...gy_methods.htm to connect with an existing ATM strategy template?

      If so, I am not sure I understand why you are wanting to place additional stop orders as the ATM should be taking control after the strategies entry order is filled.
      Note: I want to place additional orders, not additional stops.

      That is correct, I am using those methods.
      I create the order using
      Code:
                      AtmStrategyCreate(OrderAction.Sell, OrderType.MIT, limitPrice, stopPrice, TimeInForce.Gtc, EntryStrategy.ShortMITOrderID, ATMStrategyName, EntryStrategy.ShortMITStrategyID, (atmCallbackErrorCode, atmCallBackId) => {
                          //check that the atm strategy create did not result in error, and that the requested atm strategy matches the id in callback
                          if (atmCallbackErrorCode == ErrorCode.NoError && atmCallBackId == EntryStrategy.ShortMITStrategyID)
                          {
                              //isAtmStrategyCreated = true;
                          }
                      });
      Where EntryStrategy is custom class holding values for strategyID, orderID, etc.
      The point is that it creates the order, but after executing it, the stopPrice is being overwritten by the ATM Strategy value. My stop price for my additional entries is being calculated dynamically, that's why using a 'flat' value from the ATM is not an option for me.

      Yesterday I tried using AtmStrategyChangeStopTarget, but without success. Even tried hardcoding the order name I see in orders' tab, but still it was telling me that there is no such order. Setting the name of an order on creation could be helpful for me to change it's stop afterwards.

      When I try to attach myself to OnOrderUpdate and/or OnExecutionUpdate I dont get any events from there.

      Comment


        #4
        Hello AsterixBT,

        Thanks for your reply.

        We are not clear what it is you are trying to do. Here are some of the questions we have:

        While you have an active order is place that is being controlled by an ATM:
        Are you trying to enter a 2nd entry order, which also uses the same ATM template?
        Are you trying to enter a 2nd entry order, which uses another ATM template?
        Are you trying to enter a 2nd entry order, which does not use an ATM?
        Of these questions, are you trying to place this on the same instrument?
        Are you coding a multi instrument or multi time frame strategy?

        Can you post a working example of your strategy to demonstrate the issue and provide the steps to replicate? If you do not wish to post your code in public you can always write into PlatformSupport[at]NinjaTradaer[dot]Com, mark the e-mail Atten:Paul and please include a link to this thread.
        Paul H.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by CortexZenUSA, Today, 12:53 AM
        0 responses
        1 view
        0 likes
        Last Post CortexZenUSA  
        Started by CortexZenUSA, Today, 12:46 AM
        0 responses
        1 view
        0 likes
        Last Post CortexZenUSA  
        Started by usazencortex, Today, 12:43 AM
        0 responses
        5 views
        0 likes
        Last Post usazencortex  
        Started by sidlercom80, 10-28-2023, 08:49 AM
        168 responses
        2,265 views
        0 likes
        Last Post sidlercom80  
        Started by Barry Milan, Yesterday, 10:35 PM
        3 responses
        12 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Working...
        X