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

Targets and stops based on ATR

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

    Targets and stops based on ATR

    Looking for any info on how to create within my strategy targets and stops based on the current a ATR. Any help would be great. Example: current ATR is 1, Target 1, 1.5X ATR T2, 2.5X current ATR, Initial stop 2.5X current ATR. Thx

    #2
    Hi JTizz,

    I learned a lot from example code in the link, doing something similar to what you describe. The example code sets initial stops and targets, and adjust the stop to break even once a certain profit is hit.

    Maybe adjust some of the code as follows:

    stopOrder = ExitLongStopMarket(0, true, execution.Order.Filled, (Instrument.MasterInstrument.RoundToTickSize(Close[0 ] - 2.5 * ATR[0])), "MyStop", "MyEntry");
    targetOrder = ExitLongLimit(0, true, execution.Order.Filled, (Instrument.MasterInstrument.RoundToTickSize(Close[0] + 1.5 * ATR[0])), "MyTarget", "MyEntry");


    Comment


      #3
      Hello JTizz, thanks for your question.

      There is this ATRTrailing indicator:

      https://ninjatraderecosystem.com/user-app-share-download/atrtrailing/

      medge
      's suggestion is also agreeable. The order entry methods have a Price parameter that you would target with the ATR value.

      Please let me know if I can assist any further.
      Chris L.NinjaTrader Customer Service

      Comment


        #4
        Looking for some info/input to place a atr non trailing stop. When order is placed i want to have to atr stop calculation from low of entry candle on short entry the art stop from high of entry candle?

        Comment


          #5
          Above question
          Attached Files

          Comment


            #6
            better view
            Attached Files

            Comment


              #7
              Hello JTizz, thanks for your post.

              If you want to set a stop loss on a value and leave it there, call SetStopLoss once with the desired ATR value, or call one of the Exit methods once with the desired ATR value.

              Here is related documentation and an example:

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

              Please let me know if I can assist any further.
              Chris L.NinjaTrader Customer Service

              Comment


                #8
                How do you build this on Strategy Builder?

                stopOrder = ExitLongStopMarket(0, true, execution.Order.Filled, (Instrument.MasterInstrument.RoundToTickSize(Close[0 ] - 2.5 * ATR[0])), "MyStop", "MyEntry");
                targetOrder = ExitLongLimit(0, true, execution.Order.Filled, (Instrument.MasterInstrument.RoundToTickSize(Close[0] + 1.5 * ATR[0])), "MyTarget", "MyEntry");

                Comment


                  #9
                  Hello JTizz, thanks for your reply.

                  I apologize, but I will not be able to spend time creating custom conditions or actions in the strategy builder. We have a related example here that uses Exit order to submit a stop loss, the same concept can be applied here.

                  Attached Files
                  Chris L.NinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by BarzTrading, Today, 07:25 AM
                  2 responses
                  15 views
                  1 like
                  Last Post BarzTrading  
                  Started by devatechnologies, 04-14-2024, 02:58 PM
                  3 responses
                  19 views
                  0 likes
                  Last Post NinjaTrader_BrandonH  
                  Started by tkaboris, Today, 08:01 AM
                  0 responses
                  3 views
                  0 likes
                  Last Post tkaboris  
                  Started by EB Worx, 04-04-2023, 02:34 AM
                  7 responses
                  162 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