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

Reset StopLoss with ATM

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

    Reset StopLoss with ATM

    I have not coded a Strategy so I don't know if this is possible.

    I am currently using an ATM that was setup using the Custom Strategy Parameters window. I trade the ES (e-mini) futures.

    When my Limit Order is executed, both a Target and a Stop Order is initiated. My Target is 8 ticks away from the Entry Price, and my Stop Loss is 10 ticks away.

    I would like my system to automatically reposition my Stop Loss to 2 ticks of profit when the ES price is 4 or more ticks profitable. As the market price continues to move in a profitable direction, I would like the Stop Loss to trail the price by 2 ticks until my Target is reached or the price turns and hits my Stop Loss.

    Can this be done in the Custom Strategy Parameters window, or will I need to code a Strategy? If the latter, is there sample code that I can use to code this?

    Thanks for your help,
    Ron
    Last edited by ronhb107; 01-06-2017, 05:39 AM.

    #2
    Hello ronhb107

    Thank you for your post,

    This will be possible with an ATM Strategy, I've attached some screen shots of your desired settings.

    I set the auto trail to trigger at 6-ticks in profit because I didn't see that specified in your post, but you can change it if needed.

    How this will work is after 4 ticks in profit, the initial Stop Loss will move to 2-ticks above entry. From there, at 6 ticks in profit, the stop will trail the market price by 2-ticks until the target or stop are hit.

    I've linked below the section of our help guide that covers ATMs.

    http://ninjatrader.com/support/helpG...gement_atm.htm

    In addition, our ATM 201 webinar covers these in depth, we don't have a recorded version using NinjaTrader 8 on our YouTube channel yet (Help > YouTube) but you can attend a live event if you would like, feel free to ask questions.

    http://ninjatrader.com/PlatformTraining


    We look forward to assisting further.
    Attached Files
    Eric B.NinjaTrader Customer Service

    Comment


      #3
      Hi Eric:

      I entered the values for a Trailing Stop (see attached). Then I tested in Playback.

      However, when the Stop Loss is adjusted at a 4-tick profit/trigger level (which is set to 2-ticks away from the trigger level), it gets immediately filled at the 2-tick level even tho the ES did not pull back to that level.

      Am I doing something wrong?

      Thanks,
      Ron
      Attached Files

      Comment


        #4
        Ok, I got it to work by setting the Profit Trigger Plus to zero.

        Now, if the market goes against me I will add to my position (doubling down) 4 more contracts.

        The system will average the two and place a breakeven marker for 5 contracts close to my second order entry point (using the same ATM Strategy).

        When the price reaches the 4-tick profit level, nothing happens (the Stop Loss of 5 contracts does not move).

        How can I get the Stop Loss to be adjusted like the first entry? Alternatively, how can I get the profit Target to be adjusted 2-ticks from the averaged breakeven point?

        Thanks,
        Ron

        Comment


          #5
          Thank you for your post,

          The reason the stop isn't moving is because in your recent post, you mentioned having changed the profit trigger settings to 0. This is what would have had the stop move when 4 ticks in profit are reached.

          I suggest testing out the different values how and how they will affect the stop losses by using the Simulated data feed in the Connection menu. With this feed, you are able to control the trend of the simulated data so you can fully test.

          There isn't a method to alter Profit targets via the ATM Strategy settings, though they can be manually modified by clicking and clicking.

          I suggest reviewing our ATM 201 webinar, linked below, as it will cover how these items function.

          https://www.youtube.com/watch?v=0eXP_-cfR2Q&t=6s
          Eric B.NinjaTrader Customer Service

          Comment


            #6
            Hi Eric:

            I tried various values and it did not make a difference.

            Eric set up an ATM that will trigger on 4-ticks from the entry point with a 2-tick trailing stop.

            Next, try placing a Long one-contract trade and have this get filled. Next, place another Long 4-contract trade below the first position and have the simulator trend down and hit this position. You now have 5 active contracts at an average price position.

            Now, have the simulator trend up and hit 4-ticks above the averaged position.

            Do you see the trailing stop adjust once the 4-tick position above the averaged price is touched?

            If so, send a pic of your ATM.

            Thanks,
            Ron
            Last edited by ronhb107; 01-09-2017, 10:09 PM.

            Comment


              #7
              Any luck Eric on the above test?

              Ron

              Comment


                #8
                Hello ronhb107,

                Thank you for you reply,

                I will test these items and follow up with my findings.

                In the meantime, could you please also let me know if you only see this with Playback or also with the Simulated data feed in use?

                Please also post a screen shot of your current settings.

                We look forward to assisting further.
                Eric B.NinjaTrader Customer Service

                Comment


                  #9
                  Hi Eric:

                  This occurs in both Playback and Simulated modes.

                  Attached is a pic of my ATM.

                  Ron
                  Attached Files

                  Comment


                    #10
                    Hello ronhb107,

                    Thank you for your post,

                    When attempting to test this, I notice you mention "Do you see the trailing stop adjust once the 4-tick position above the averaged price is touched?"

                    To clarify, orders will be filled when they reach the last traded price (by default set to have a Yellow background), not the average entry price (set by default to brown/Sienna background).

                    If you had been referencing the entry price, then this would be expected for orders not to fill when this is reached..

                    We look forward to assisting
                    Eric B.NinjaTrader Customer Service

                    Comment


                      #11
                      Hi Eric:

                      I am not sure we are on the same page.

                      If both orders are filled and we now have 5 active contracts, NT will display where the breakeven point is on the chart.

                      I would like the system to reference the breakeven point in a manner similar to an entry point since movement above this point becomes profitable.

                      Now, if ATM cannot perform this then I should be looking to program this behavior in ninja script. If this is the case, do you have any code that could help me with this if ATM cannot?

                      Thanks,
                      Ron

                      Comment


                        #12
                        Hello ronhb107,

                        I would suggest not having your auto breaken and auto trail stop conflict. In the screen shot uploaded at this post,

                        Support for the development of custom automated trading strategies using NinjaScript.


                        From the screen shot above, At 4 ticks in profit your trailing stop will engage and trail the current market price by 2 ticks. However, at 4 ticks in profit your breakeven will be set to 1 above entry. What do you want to happen at 4 ticks in profit; your stop to be 1 tick better than breakeven or trail the market by 2 ticks?

                        To answer your question about having stop losses adjusted like the first entry, you should not submit new order to an active ATM.

                        You will want to right click on your SuperDOM>Properties. Change ATM Strategy selection mode to KeepSeelectedAtmStrategyTemplateOnOrderSubmission. Under this selection every time you enter a new position at a new price it will default back to the ATM strategy parameters rather than grouping targets/stops all at one price level.

                        See ATM Selection Mode section of our Helpguide:


                        I look forward to your reply.
                        Alan P.NinjaTrader Customer Service

                        Comment


                          #13
                          Eric:

                          First, I prefer to group the strategies as a continuous series of entries. This way it will adjust the stops and targets for the number of contracts.

                          My suggestion is that the ATM strategy looks at the Breakeven on every trade until closed. Thus an initial entry would be the same as breakeven, but as other positions are added, the ATM will always refer to the breakeven level, not the new entry level, for determining where the trailing stop is triggered. This is an averaging technique that works well for me.

                          So either ATM can handle this approach or is modified to allow using breakeven (with a checkbox). If this is not possible, then let's focus on coding a Strategy that will do this.

                          Thanks,
                          Ron

                          PS. see attached pic for revised ATM
                          Attached Files

                          Comment


                            #14
                            Hello ronhb107,

                            To have the initial entry remain at breakeven, even for contracts scaled in, then you should disregard my previous suggestion about KeepSelectedAtmStrategyTemplateOnOrderSubmission.

                            Thus, with the setting SelectActiveAtmStrategyOnOrderSubmission, and scaling into a position with the Active ATM selected, once the profit trigger set in your trailing stop is hit, a trailing stop with an order quantity equal to your initial entry order plus additional scaled in orders will be grouped and trail the market.

                            The breakeven line displayed in the chart has no reference to how the ATM strategy operates, its just visual.

                            I would suggest testing your ATM using the simulated data feed and a SuperDom to understand its behavior.

                            Please let us know if you need further assistance.
                            Alan P.NinjaTrader Customer Service

                            Comment


                              #15
                              Hi Alan:

                              It is apparent that the ATM will not operate as I need if it ignores the Breakeven point.

                              Therefore, I suggest we concentrate on coding a Strategy that will operate using the Breakeven point.

                              Can you provide examples that will help me code the Strategy I need?

                              The requirement is that the coded strategy can be accessed from the ATM Strategy dropdown. I want to manually enter the trade, then have the coded strategy manage the trailing stop. It should show up on the chart.

                              Thanks,
                              Ron
                              Last edited by ronhb107; 01-12-2017, 06:07 AM.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by BarzTrading, Today, 07:25 AM
                              2 responses
                              24 views
                              1 like
                              Last Post BarzTrading  
                              Started by devatechnologies, 04-14-2024, 02:58 PM
                              3 responses
                              20 views
                              0 likes
                              Last Post NinjaTrader_BrandonH  
                              Started by tkaboris, Today, 08:01 AM
                              0 responses
                              4 views
                              0 likes
                              Last Post tkaboris  
                              Started by EB Worx, 04-04-2023, 02:34 AM
                              7 responses
                              163 views
                              0 likes
                              Last Post VFI26
                              by VFI26
                               
                              Started by Mizzouman1, Today, 07:35 AM
                              1 response
                              10 views
                              0 likes
                              Last Post NinjaTrader_Gaby  
                              Working...
                              X