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

What is the best way to manage several positions exit criteria and price?

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

    What is the best way to manage several positions exit criteria and price?

    Hi,

    When I use chart trader to establish a position I have a simple atm that will manage for example 5 contracts. To use and example the ATM will exit 1 contract on $100 or 10 tick profit, exit another on $200 profit, then moving the stops to beak even on the remaining with either trailing stop, limit exit orders or indicator value stop prices.

    Leaving aside the indicator based exit price for now what is the easiest way to implement this logic as I'm not an experiences csharp but have written some code.?

    If I wanted to exit on an indicator based value what is the easiest way for this to be done?

    If seen where entry names are given and used for exiting in the strategy builder is this one way of doing this?

    I've also seen the SampleAtm strategy it actually looks a bit complicated.

    I'm looking for the easiest way to include this logic that will work with the strategy analyzer and Playback mode.

    Thank you very much for the help.

    glen


    #2

    Hello Glen, thanks for your post.

    See the example here titled "Referencing indicator methods" on accessing indicator data properly:

    https://ninjatrader.com/support/help...tm#Performance

    The SampleATMStrategy example would be the best example we have demonstrating how to use ATM strategy templates in a NinjaScript strategy. Otherwise the ATM logic needs to be programmed "by hand" in the NInjaScript Editor, which is arguably more complex than launching an ATM through code. One example we have demonstrating advanced order management is here:

    https://ninjatrader.com/support/help...and_onexec.htm

    Kind regards,
    -ChrisL
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by demarcog View Post
      I'm looking for the easiest way to include this logic that will work with the strategy analyzer and Playback mode.
      Using ATM strategies in a Strategy requires the use of AtmStrategyCreate,
      which includes this caveat,

      "This method is NOT backtestable and will NOT execute on historical data"

      To wit, even the sample strategy "@SampleAtmStrategy.cs" uses that method,
      and therefore cannot be tested with Strategy Analyzer.

      Comment


        #4
        In addition, the Using ATM Strategies page has this caveat,

        "ATM Strategies operate in real-time only and will not execute
        on historical data thus they can't be backtested"

        "can't be backtested" == "takes no trades in Strategy Analyzer"

        Comment


          #5
          Hi Bltdavid, thanks for the follow up.

          Yes, that is correct. ATM strategies can only be launched after State.RealTime has been reached. The best way to "backtest" strategies that use ATM templates would be the Playback connection.

          Kind regards.
          Chris L.NinjaTrader Customer Service

          Comment


            #6
            bltdavid,

            Thank you very much I appreciate your response.

            Playback mode is better then nothing but for some reason only two weeks of data is available and for 25 contracts that is a cumbersome and error prone process.

            IN addition when the contract rolls over the data is no longer useful.

            Rather then the ATM would this be a case where I've seen orders being tagged with an identifier to be paired off with a closing position.

            I'm looking for simple limit orders with fixed tick levels?

            Thank you,

            Glen

            Comment


              #7
              Hi
              I have noticed several times that when i trade using SuperDOM, when the limit order buy/sell is touched the order doesnt close instantly as there is a bit of lag , is this a known problem? or is there is a solution ?
              thanks

              Comment


                #8
                Hello honest-trader,

                Limit orders are not guaranteed to be filled if they are touched.

                Please see the resource below to learn more about limit orders.



                @demacrog, you can use Set methods to place targets at individual levels for separate entries, and the same can be done with Exit methods. If you are using Exit methods, You could consider using Position.AveragePrice add/subtract someValue * TickSize to place orders a number of ticks from the entry price. I have attached an example that shows how you can differentiate exits with individual entries.

                We look forward to assisting.
                Attached Files
                JimNinjaTrader Customer Service

                Comment


                  #9
                  Thanks Jim. Only if i use the simulated data feed i can place stop/buy limit orders above or below the market. eg. 4080 is the current tick, i want to place a buy limit order at 4085 and sell limit at 4090?

                  Comment


                    #10
                    Hello honest-trader,

                    You can place a Sell Limit order above the current market price but if a Buy Limit order is submitted/moved above the current market price, the current market price will be better than the buy limit price and the order will be filled immediately.

                    Additionally, you cannot place two orders to make a bracketed Buy/Sell entry with the Managed Approach or with the Strategy Builder. (The Strategy Builder generates Managed Approach code.) You will need to use the Unmanaged Approach to accomplish this.

                    Internal rules of the Managed Approach - https://ninjatrader.com/support/help...antedPositions
                    JimNinjaTrader Customer Service

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by andrewtrades, Today, 04:57 PM
                    1 response
                    8 views
                    0 likes
                    Last Post NinjaTrader_Manfred  
                    Started by chbruno, Today, 04:10 PM
                    0 responses
                    6 views
                    0 likes
                    Last Post chbruno
                    by chbruno
                     
                    Started by josh18955, 03-25-2023, 11:16 AM
                    6 responses
                    436 views
                    0 likes
                    Last Post Delerium  
                    Started by FAQtrader, Today, 03:35 PM
                    0 responses
                    7 views
                    0 likes
                    Last Post FAQtrader  
                    Started by rocketman7, Today, 09:41 AM
                    5 responses
                    19 views
                    0 likes
                    Last Post NinjaTrader_Jesse  
                    Working...
                    X