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

Strategy Builder: Add ATR-value as TakeProfit and StopLoss

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

    #31
    Cool, I'll keep hammering at this for a while more, and send a more assembled strat to you as I get frustrated by the obstructions.

    Comment


      #32
      Daryl do you have this doped out yet?? I looked at the strat you posted. I'm sure you realize that the ATR 14 is a number much smaller than the price of the commodity you are trading. I think that what you are after is the current price plus or minus the ATR. I would be interested in trading some ideas on using the Strategy builder as material available is limited and the narrator of the webinar will only address very superficial questions.
      I am also interested in trying to move the stop.
      Dean

      Comment


        #33
        If you are wondering how to implement an ATR trailing stop in the strategy builder, you need some kind of ATR trailing stop indicator. There are dozens available for free.

        What I do, is create the condition (the example is for a long entry):

        If Close[0] < TrailingStopIndicator[1]

        Then ExitLong.....etc. etc.

        If I am confused about the question being asked here, then ignore me.
        Last edited by liquid150; 12-29-2017, 09:47 AM.

        Comment


          #34
          If the question is setting a profit target to an ATR, say, the daily ATR, then I asked this question over here and it was satisfactorily answered:



          Note: I don't think you can take a multiple of the ATR without unlocking code to input the maths involved.

          Comment


            #35
            continuing quest

            okaaaaaaayyyyy .... I think I have it working now using the Framework of the mycustomstrategy2 strategy illustrated below I simply created a pair of variables named TSValueLong and TSValueShort, as doubles valued at 0. Then carried them forward attached to the two plots of the Volatility Stop indicator I think I picked up over at Futures.io .

            My question now is, it's kinda nerve wracking not knowing exactly where that trailing stop actually us while it's live. How do I have it's location displayed on either the chart or the super DOM or both so I can see how it is moving in a live trade while I'm walking forward my various entry and exit signal techniques? Is that done when I set the variable in set one? Is it done in the stops and targets window? I know it's done with the drawing tab, and obviously I'd tag it with "currentbar" But is there anything else I'm not smart enough to ask a question about that I should include?

            What, for example, is the difference between simulated and regular stop orders? I'm thinking one is hidden from the market so institutional traders don't know where it is, which one is that? What are the things missing here, that I should know?

            I'm including the indicator, in case anyone wants to try this out for themselves or needs it to test what I've described by including this indicator's values, instead of a fixed number in the mycustomstrategy2 strategy noted earlier in this same thread.
            Attached Files

            Comment


              #36
              Originally posted by Daryl Haaland View Post
              okaaaaaaayyyyy .... I think I have it working now using the Framework of the mycustomstrategy2 strategy illustrated below I simply created a pair of variables named TSValueLong and TSValueShort, as doubles valued at 0. Then carried them forward attached to the two plots of the Volatility Stop indicator I think I picked up over at Futures.io .

              My question now is, it's kinda nerve wracking not knowing exactly where that trailing stop actually us while it's live. How do I have it's location displayed on either the chart or the super DOM or both so I can see how it is moving in a live trade while I'm walking forward my various entry and exit signal techniques? Is that done when I set the variable in set one? Is it done in the stops and targets window? I know it's done with the drawing tab, and obviously I'd tag it with "currentbar" But is there anything else I'm not smart enough to ask a question about that I should include?

              What, for example, is the difference between simulated and regular stop orders? I'm thinking one is hidden from the market so institutional traders don't know where it is, which one is that? What are the things missing here, that I should know?

              I'm including the indicator, in case anyone wants to try this out for themselves or needs it to test what I've described by including this indicator's values, instead of a fixed number in the mycustomstrategy2 strategy noted earlier in this same thread.
              I coded my strategy to paint the indicator on the chart, and when I run the strategy I apply it on a chart. You need to have all relevant time frames on your chart for the strategy to function on the chart. I have all indicators used in the strategy painted, so I can see everything in real time.

              Are you using code or the strategy builder? In the latter case you need to click the box to show the indicator when building your conditions. The former case requires paint script and AddIndicator.

              Simulated stops are the ones held on the ninjatrader server and not delivered to the broker.

              I don't really use the DOM.

              Edit: Using an Indicator as a trailing stop will not show anything in the Stops and Targets windows because you are not using that feature as a stop. The value will show in the data box, however.
              Last edited by liquid150; 01-10-2018, 10:02 AM.

              Comment


                #37
                Originally posted by liquid150 View Post
                I coded my strategy to paint the indicator on the chart, and when I run the strategy I apply it on a chart. You need to have all relevant time frames on your chart for the strategy to function on the chart. I have all indicators used in the strategy painted, so I can see everything in real time.

                Are you using code or the strategy builder? In the latter case you need to click the box to show the indicator when building your conditions. The former case requires paint script and AddIndicator.

                Simulated stops are the ones held on the ninjatrader server and not delivered to the broker.

                I don't really use the DOM.

                Edit: Using an Indicator as a trailing stop will not show anything in the Stops and Targets windows because you are not using that feature as a stop. The value will show in the data box, however.
                Hmmm well the indicator I'm using does paint a dot where the trailing stop is supposed to be .... in theory. But I'm not entirely certain that is actually what was happening when I walked it forward a little bit late last night. I'm wondering since it seemed to be breaking it's rules for part of it. But also it wasn't letting me know where or when the trailing stop was advancing with either an audio cue or visual one.
                I chewed on the initial problem enough that it finally got working, I'll do some more experimentation with a simplified strategy so I can continue seeing how the trailing stop technique is working today. Basically walk forward with lots of entries and trailstop exits just to run it through it's paces. Then I'll add a structured exit later and more refined entry rules, as I figure out how this aspect of the code works.

                Comment


                  #38
                  Thanks by the way for the reminder /heads up about which stop is which. Simulated stops then, are the ones hidden from the market

                  Originally posted by liquid150 View Post
                  I coded my strategy to paint the indicator on the chart, and when I run the strategy I apply it on a chart. You need to have all relevant time frames on your chart for the strategy to function on the chart. I have all indicators used in the strategy painted, so I can see everything in real time.

                  Are you using code or the strategy builder? In the latter case you need to click the box to show the indicator when building your conditions. The former case requires paint script and AddIndicator.

                  Simulated stops are the ones held on the ninjatrader server and not delivered to the broker.

                  I don't really use the DOM.

                  Edit: Using an Indicator as a trailing stop will not show anything in the Stops and Targets windows because you are not using that feature as a stop. The value will show in the data box, however.
                  I've given up trying to include all of the indicators I use in a strategy on the chart itself instead limiting the visual clutter to just a few and leaving the rest off the chart. with all the thresholds and wide variety of cross referencing indicators looking at other indicators which are looking at other nested indicators it was just impossible to cram all of that into the builder and I'm not yet skilled enough in the editor to know where I'm screwing up yet. I'll get there, but I'm not there yet and representing some of those things aren't important. But I would still like to know where my trailing stop and other aspects of a live order are placed, while it's active at least. Once it's done simply only knowing entry and exit, and exit method (trailstop or structured exit) is fine.

                  Comment


                    #39
                    Hello Daryl Haaland,

                    If you’re running your strategy on live data, opening a superdom for that instrument or chart trader should show your working orders, even if that stop is a simulated stop, which will be displayed in yellow rather than pink. (See screen shot)

                    If you check your log tab, are you getting an error? You could also post your log/trace files along with the time you enabled the strategy.

                    To correct what Liquid150 said, simulated stops are not held on NinjaTraders server, they are held on your local PC. This is important because if you’re computer goes down this stop is not sent. Furthermore to say simulated stops are hidden from institutional traders would imply non simulated stops submitted to the exchange are exposed to these traders, which is absolutely not correct.



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

                    Comment


                      #40
                      drawing trailstop position dynamically

                      will this work? under conditions and actions create an additional drawing action upon entering long or short. in the case of a long position have a triangle up, with the Y coordinates being based on Strategy, average position price, who's property values are drawn from Volatility stop indicator's lower band offset by one tick so the arrow is actually pointing to the exact line where the sop should take place? everything set to ticks rather than arithmetic. or should this be done another way? (edited for spelling corrections due to typing with mitts on.)
                      Attached Files
                      Last edited by Daryl Haaland; 01-10-2018, 12:53 PM.

                      Comment


                        #41
                        Originally posted by NinjaTrader_AlanP;530024To correct what Liquid150 said, simulated stops are [U
                        not[/U] held on NinjaTraders server, they are held on your local PC.
                        Sorry about that. My brain has my personal Windows Server mapped as "Ninjatrader Server."

                        Comment


                          #42
                          Originally posted by Daryl Haaland View Post
                          will this work? under conditions and actions crate an additional drawing action upon entering long or short. in the case of a long position have a triangle up, with nthe Y coordinates being based on Strategy, average position price, who's property values are drawn from Volatility stop indicator's lower band offset by one tick so the arrow is actually pointing to the exact line where the sop should take place? everything set to ticks rather than arithmetic. or should this be done another way?
                          maybe this code makes more sense to show what I'm attempting?
                          Attached Files

                          Comment


                            #43
                            First thank you for the clarification concerning simulated stops. And as for the yellow displayed stops: Do I need to have chart trader turned on for that, because my charts aren't showing it that way? Maybe I've got my chart settings all screwy, it's certainly possible. While waiting for your replies (I know I'm chatty) I'll be poking around in this things brain with a marline spike to see what makes it kick, swear suddenly, or spontaneously write a check. (there's an image)

                            Originally posted by NinjaTrader_AlanP View Post
                            Hello Daryl Haaland,

                            If you’re running your strategy on live data, opening a superdom for that instrument or chart trader should show your working orders, even if that stop is a simulated stop, which will be displayed in yellow rather than pink. (See screen shot)

                            If you check your log tab, are you getting an error? You could also post your log/trace files along with the time you enabled the strategy.

                            To correct what Liquid150 said, simulated stops are not held on NinjaTraders server, they are held on your local PC. This is important because if you’re computer goes down this stop is not sent. Furthermore to say simulated stops are hidden from institutional traders would imply non simulated stops submitted to the exchange are exposed to these traders, which is absolutely not correct.



                            I look forward to your reply.

                            Comment


                              #44
                              Hello Daryl Haaland,

                              Yes, chart trader needs to be enabled to see working orders.

                              You could also pull up the orders tab on the Control Center and will see stops working.

                              From a risk management standpoint, simulated stops could be considered a very bad idea.

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

                              Comment


                                #45
                                What aspects would mitigate that risk? a DSL connection and your personal broker's phone number on speed dial?

                                Thank you lots for the clarification of chart trading activation. I normally don't have it active and instead had been entering trades through the DOM but for this I'll change a couple of my habits.

                                Originally posted by NinjaTrader_AlanP View Post
                                Hello Daryl Haaland,

                                Yes, chart trader needs to be enabled to see working orders.

                                You could also pull up the orders tab on the Control Center and will see stops working.

                                From a risk management standpoint, simulated stops could be considered a very bad idea.

                                Please let us know if you need further assistance.

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by helpwanted, Today, 03:06 AM
                                1 response
                                7 views
                                0 likes
                                Last Post sarafuenonly123  
                                Started by Brevo, Today, 01:45 AM
                                0 responses
                                7 views
                                0 likes
                                Last Post Brevo
                                by Brevo
                                 
                                Started by aussugardefender, Today, 01:07 AM
                                0 responses
                                5 views
                                0 likes
                                Last Post aussugardefender  
                                Started by pvincent, 06-23-2022, 12:53 PM
                                14 responses
                                242 views
                                0 likes
                                Last Post Nyman
                                by Nyman
                                 
                                Started by TraderG23, 12-08-2023, 07:56 AM
                                9 responses
                                385 views
                                1 like
                                Last Post Gavini
                                by Gavini
                                 
                                Working...
                                X