Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

ATR Stop and Target using strategy builder (not ninjascript)

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

    ATR Stop and Target using strategy builder (not ninjascript)

    Dear all,

    I would like to create ATR profit target and stop loss using Strategy Builder.
    May u know how to do it?
    by the way, i dont know anything about coding.

    thanks,
    Polar

    #2
    Welcome to the forums Polar!

    If you have not already done so, please see the Strategy Builder 301 course as well as our Conditions and Actions examples.

    Strategy Builder 301 (publicly available resource) — https://www.youtube.com/watch?v=_KQF2Sv27oE

    Conditions examples —https://ninjatrader.com/support/help...on_builder.htm

    Actions examples — https://ninjatrader.com/support/help...us/actions.htm

    To create target/stop orders based off of an indicator plot, you will need to create logic in Conditions and Actions that place the limit order (ExitLongLimit) and stop order (ExitLongStopMarket) in association to the indicator plot when the strategy is in a long position. (See Conditions examples for how to check the strategy position.)

    We look forward to assisting.
    JimNinjaTrader Customer Service

    Comment


      #3
      Hello Jim,

      Thank you for replying.
      I tried with parabolic Sar and it works well.
      however I still can't figure out how to use ATR trailing stop.
      hope you can help me,

      thanks
      Polar

      Comment


        #4
        Hello Polar,

        A trailing stop involves moving the stop price in association to the current market price or to the price level of an indicator plot as the market moves in your favor.

        You could consider using variables to track the last time you changed the stop loss as well as the price level to be used for the stop loss:
        1. Create a variable "LastPriceMoved"
        2. Create another variable "StopPrice"
        3. When the strategy enters, set "StopPrice" to your initial stop level, and set "LastPriceMoved" to the current market price.
        4. When the current market price is greater than X number of ticks from "LastPriceMoved," update "StopPrice" to a price level offset from the current market price, or your indicator plot. You will also need to update "LastPriceMoved" so it reflects the current market price.
        5. When the strategy is in a long position, use ExitLongStopMarket to submit the stop loss to "StopPrice"
        Please let us know if you have any additional questions.
        JimNinjaTrader Customer Service

        Comment


          #5
          Hi Jim,

          Many thanks for advice. However it is too complicated for me this time. Do you mind help me simplify the steps?
          Thanks.
          Polar

          Comment


            #6
            Hello Polar,

            I have created a video explaining, how you can set up logic to build trailing stops using the ATRTrailing indicator from the User App Share.



            This is a conversion of the ATR Trailing Stop developed by Welles Wilder. Please contact the original author for any questions or comments. For more apps from this user check out the Renko Bar Type!


            The link above is publicly available.

            The NinjaTrader Ecosystem website is for educational and informational purposes only and should not be considered a solicitation to buy or sell a futures contract or make any other type of investment decision. The add-ons listed on this website are not to be considered a recommendation and it is the reader's responsibility to evaluate any product, service, or company. NinjaTrader Ecosystem LLC is not responsible for the accuracy or content of any product, service or company linked to on this website.


            We look forward to assisting.
            JimNinjaTrader Customer Service

            Comment


              #7
              How would one code where once the ATR switches long side or short side, it will either enter a long trade or short trade continuously. I have attached photo for reference.



              Click image for larger version

Name:	Screen Shot 2021-01-08 at 1.16.45 AM.png
Views:	2443
Size:	203.1 KB
ID:	1135723

              Comment


                #8
                Hello secrettrader,

                I would suggest first creating a simple strategy that prints out the plot values so you can see what the values of the plots are as the script processes them so you can identify what the plot values look like when the plot flips to the other side of the market. The video below demonstrates how prints can be used in the Strategy Builder.

                Debugging in the Strategy Builder - https://drive.google.com/file/d/1mTq...w?usp=drivesdk

                If we add a print for CurrentBar (Action > Print > Misc > CurrentBar,) in addition to Upper[0], Upper[1], Lower[0], and Lower[1], we can see what the current and previous plot values are for Upper and Lower and we can also reference the bar index so we can see it on the chart. The Data Box can be added to the chart, and if you right click and select Bar Indexes, you can see the current and previous plot values at the time that bar gets processed.

                Click image for larger version  Name:	2021-01-08_08-29-47.png Views:	0 Size:	100.8 KB ID:	1135772Click image for larger version  Name:	2021-01-08_08-30-28.png Views:	0 Size:	100.5 KB ID:	1135773

                As we can see, when the plot moved from Upper to Lower, Upper[0] is 0 and Lower[0] has a value, and Upper[1] (previous bar) has a value and Lower[1] (previous value) does not have a value.

                This can then be used to signal calling EnterLong/EnterShort. Similarly to SampleMACrossover, if you call EnterLong while in a short position, we will reverse from short to long and if we call EnterShort in a long position, we will reverse from long to short.

                We look forward to assisting.
                JimNinjaTrader Customer Service

                Comment


                  #9

                  I have download the ATR Trailing Indicator and I know it is working as it is showing on all my charts. However I am having some issues following the google drive video sent earlier in this thread. I am trying to get a lasting stop market order to be active at the most recent plotted value until the long position is closed (and vice versa for short). The stop market order just needs to follow the ATR Trailing plot depending on whether or not the strategy is short or long.


                  Comment


                    #10
                    hi, I'm wondering if you can set up for a 300 tik chart, thanks

                    Comment


                      #11
                      hi, I ask if anyone finds an atr stop, thanks

                      Comment


                        #12
                        Hello gigio,

                        Thanks for your note.

                        Yes, a 300-tick chart could be created in NinjaTrader. To open a 300 Tick chart, go to New > Chart, select the instrument you want to open a chart for, set the 'Type' property field to 'Tick', set the 'Value' property to '300', and click OK.

                        See this help guide page for more information about creating a chart: https://ninjatrader.com/support/help...ng_a_chart.htm

                        See this help guide page about editing the chart's data series: https://ninjatrader.com/support/help...riesParameters

                        In regard to your question about ATR Stops, see post # 6 in this forum thread for how to build trailing stops using the ATRTrailing indicator from the User App Share.

                        Let me know if I may assist further.
                        Brandon H.NinjaTrader Customer Service

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by TradeSaber, Today, 10:11 PM
                        0 responses
                        2 views
                        0 likes
                        Last Post TradeSaber  
                        Started by GreyKerns09, Today, 03:42 PM
                        1 response
                        12 views
                        0 likes
                        Last Post marco231  
                        Started by marco231, 05-15-2024, 11:32 PM
                        3 responses
                        20 views
                        0 likes
                        Last Post marco231  
                        Started by mrgreentrading, Today, 08:29 PM
                        0 responses
                        11 views
                        0 likes
                        Last Post mrgreentrading  
                        Started by rbendson, Today, 08:18 PM
                        0 responses
                        2 views
                        0 likes
                        Last Post rbendson  
                        Working...
                        X