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

Combining Automated Strat With ATM Exits

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

    Combining Automated Strat With ATM Exits

    I found a previous post (2008) which seems to address this but I'm hoping things have changed since then since the answer was akin to "yes, you can link your automated strategy and your ATM exit parameters but you have to have a phd. in programming", i.e., the code for initial stops and profit targets and trailing stops must be input directly into the automated trading strategy code itself. Is this still the case? I find it hard to believe ninja has not managed to link the two functions, automated trading and the ATM exits on the superDOM. Assuming this is still the case, how the hell does someone learn how to code these parameters into an automated strategy? Isn't this a very, very common requirement amongst ninja users/traders? I reviewed the SampleAtmStrategy code (per the "answer" to this question back in '08) and it is absolutely incomprehensible, reads as gibberish. Help would be greatly appreciated here.

    #2
    TakingStock12, I'm not sure I follow - are you talking generally here or for the realtime vs backtest difference you would experience using the SampleAtmStrategy (still our current sample code) for calling ATM templates for exit management from Ninja Script strategies.

    This will need to be implemented via custom coding directly and unfortunately it can't be achieved with the Strategy Wizard.

    For programming assistance, you can contact any 3rd party NinjaScript consultant from this link -

    BertrandNinjaTrader Customer Service

    Comment


      #3
      Bertrand ...

      I want to have an automated strategy which implements an initial stop-loss and, when profit level one is reached, shifts the stop-loss up to break even for profit level 2. Then, when profit level 2 is reached, I want the stop loss to move up again and trail the price upward to preserve gains. I don't see what is so complicated about my question that you really don't understand. Ninja coding is complicated. My question is not. How can I put these autmated exits into my automated strategy WITHOUT hiring a personal software engineer? I should NOT have to consult a "third party programmer" to accomplish something as simple as this.

      Comment


        #4
        TakingStock12, this will depend on your coding skill level and also on the effort you're willing to invest to learn the NinjaScript coding basics needed to achieve what you're looking for. What might seem like a big first step, is getting much easier with time as you're getting more comfortable in the custom coding environment we offer in NinjaTrader.

        For a smooth start we provide support here in the forums and via email and also put together many useful reference samples to help getting started.

        What you outlined needs indeed custom coding, but you don't have to call ATM's for this, as you could not backtest those (only use them in realtime).

        Please have a look at this reference sample below, showing how to protect a position with an exit bracket and then move those orders according to the trade's profit -

        BertrandNinjaTrader Customer Service

        Comment


          #5
          Bertrand ...

          While the example does shed a little light on the process involved, it is hardly self-explanatory -- there are quite a few lines which don't make sense to me or don't clearly explain what goes where, so to speak. With your permission, I would like to correspond with you via email to clarify how to go about this. For example, at the very top of the script it reads thus:
          // This namespace holds all strategies and is required. Do not change it.
          namespace NinjaTrader.Strategy
          {
          /// <summary>
          /// Sample strategy using StopLoss and ProfitTarget orders.
          /// </summary>
          [Description("Sample strategy using StopLoss and ProfitTarget orders.")]
          public class SamplePriceModification : Strategy
          {
          #region Variables
          private int stoplossticks = 20;
          private int profittargetticks = 100;
          #endregion
          I assume this means I have to have "namespace NinjaTrader.Strategy" at the beginning of all this then, yes? What is the need for ///<summary> line? What does "private int" mean? Why is there "stoplossticks" followed by unknown number of spaces and then "=20" up here in this section --- wouldn't the actual stop loss be placed after the words "SetStopLoss"?

          When I said the coding was incomprehensible, these are the kind of questions I meant -- there are a lot of unexplained aspects to the example code. Where do I get explanations so I don't have to bother you and the rest of the world with endless questions? Are you open to corresponding? I am willing to learn (as evidenced by the countless hours I have already wasted trying to figure all this out over the last year), but the text, so to speak, has to be understandable for me to garner the knowledge I need to code for myself and it simply isn't. Is there/are there videos which walk a person through the coding of stop losses and profit exits for automated strategies? I don't see any in the help guide. If you won't walk me through the process, can you point me to examples which ARE comprehensible and adequately self-explanatory (the one you pointed me to is NOT, obviously). Thanks for your patience and help. My patience, also obviously, is long gone. --david

          Comment


            #6
            TakingStock12, unfortunately I cannot take through each little step of the custom coding process involved - to forward for you I would suggest starting to work through those basic NinjaScript tutorials to get a better understanding of the core framework used -



            For strategies directly our Strategy Wizard is a powerful point and click based interface where you could start creating basic strategies without any custom programming need -



            You can view the underlying source code generated to develop a sense of what custom code looks like and what the correct formatting / syntax is, then at a later stage this can be 'unlocked' so you can work changes with custom coding in.
            BertrandNinjaTrader Customer Service

            Comment


              #7
              Bertrand ...

              ... understood. I must say I find this lack of clarity and functionality a fairly typical situation in the world of technology today. Common sense seems to be progressively displaced with the acquisition of knowledge -- the people designing the ninja capabilities have lost touch with the basic needs of the non-techy end-users of the product. Not isolated to Ninja but clearly evident on page after page of the so-called examples and explanations, not to mention the confusing use of descriptive vocabulary (ATM and Automated Trading -- "clearley defined line of usage between the two", to quote Ninja help page -- so why in heaven use such ridiculously similar terminology for two radically different functions?). In terms of simple business sense, I assure you, there are legions of folks "out there" who would like to use your product but who, because of this embedded confusion and lack of communicative skills, try and fail or simply don't try at all. It is something Ninja should consider if they want the business to grow.
              One more question please. I found a page which states that ATM strategies can be linked to automated trading strategies for stops and profit exits: http://www.ninjatrader-support.com/H...gASMStrategies Surprise, surprise, the language is not clear and there is no link to how to accomplish this. My question is, if insturctions for how to do this actually exist, would this solve the problem (I don't need backtesting and I have an automated strategy via the wizard all set to go) would I be able to implement the instructions to input stops/profit exit points/trails into my automated strategy?
              Excuse me now while I go bang my head against a non-etheric wall. Appreciating your quick if painfully unhelpful responses.

              Comment


                #8
                TakingStock12, thanks for your input and feedback. You can certainly call the ATM templates from the DOM / ChartTrader for exit management of your NinjaScript strategies, however you must step out of the wizard to accomplish this. For this the already mentioned 'SampleAtmStrategy' is the way to go to see the needed NinjaScript methods 'in action'. I know you've already reviewed this and were not convinced it would help you get going incorporating the techniques into your own strategy, so I would really suggest getting a consultant involved that work this in for you -

                BertrandNinjaTrader Customer Service

                Comment


                  #9
                  Bertrand ...

                  ... and I would suggest Ninja Trader stop advertising easily accessible automated trading. Clearly, the Ninja developers had the sense "way back when" to develop the Strategy Wizard to make it a usable function for non-programmers. They simply forgot that traders need stops and profit target exits as well which should obviously have been incorporated into the wizard long, long ago. I should not have to engage a contractor to use a basic function of the platform, it is absurd. As for me "not being convinced" to use the SampleATMStrategy --I would LOVE to use it as a cheat sheet but IT IS INCOMPREHENSIBLE!!! You yourself said you don't have the time to walk me through all the steps involved in explaining the damned coding. Enough. It is clear you are going to be of no help at all and in your view all I am is someone who doesn't try hard enough. Great job -- you're an inspiration.

                  Comment


                    #10
                    takingstock12, to clarify - you could for sure add basic stops and targets via the wizard interface to your strategy -

                    "The Stops and Targets Screen

                    This screen allows you to set stop loss, trail stop and profit target orders that are automatically submitted and managed once your strategy opens a position. Stops and targets are added by the Strategy Action window.

                    1. Displays stops and targets associated with your strategy

                    2. Adds or deletes a stop or target

                    3. Edits the selected stop or target"



                    Only for more complicated actions such as defining a custom trailing stop / profit target algorithm you would need to get into custom coding.
                    BertrandNinjaTrader Customer Service

                    Comment


                      #11
                      Thank you ...

                      ... I don't recall asking for help with algorithms but I'm glad we have put that nonsense to bed and are down to the issue at hand. Is there a tutorial on how to input the correct stop and profit target syntax within this wizard screen anywhere? In the example you show from the New Strategy screen, the two quotation marks within the parenthesis require some explanation. Does something need to be inserted between them? Idiots like myself need to know. Thanks for pointing out this function -- it may actually make automated trading possible once I figure out the exact syntax input needed. I'll give myself 6 months minimum based on previous efforts with the wonderously clear and self-explanatory Ninja interface.

                      Comment


                        #12
                        Hello TakingStock12,

                        You can see this help guide article on the wizard screens. This will discuss the screen where you can create stop losses and profit targets.

                        "" - This parameter here is looking for "FromEntrySignal". If you want profit targets or stop losses tied to a specific entry signal, you would type the name of that entry signal between the quotation marks.

                        If you keep it as just "", then it will apply those stop losses or profit targets to any entries created by the strategy.

                        You can see below for more detailed information regarding these methods:
                        SetProfitTarget()
                        SetStopLoss()
                        Ryan M.NinjaTrader Customer Service

                        Comment


                          #13
                          RyanM

                          ... many thanks. --david

                          Comment


                            #14
                            I have a question for this thread too. Is it possible to build a similar set of conditions for exiting a trade same as entering one based on the actions of indicators, and multiple actions of indicators. To prevent getting shaken out or impulsed out of a much larger trade potentially.

                            For example only exit a long trade when the RSI (set to certain parameters) Stoch K line (likewise) and CCI all Exit their over bought conditions, or in the case of the CCI it falls below 100 (numeric threshold limit). As well as having a live trailing stop set some distance below the breathing area of the trade to catch any catastrophes.

                            Likewise I'm interested in figuring out how to create an automated trailing stop based on a specific bar # of ago's range (not an average) of the ATR would a person just copypasta snippets from the ATR Trailing indicator to incorporate into the trailing stop portion of the Strategy? is that sort of thing supported in the builder itself, or would you have to open the editor, to code that baby by hand?

                            this is like the COOLEST VIDEO GAME EVERRRRRR!!!!!!!

                            Comment


                              #15
                              also for redrawing indicators such as Dynamic support resistance. Where as conditions change the state will change too. can such an indicator be reliably used as a potential "best 3 of 4" factors for exit conditions. and would a strategy written fibonacci retracement or extension (depending on context of course) percentile zone also be able to be used in the same manner to look for specific confluences of resistance or support to exit at a profit. is that programmable?

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by aa731, Today, 02:54 AM
                              0 responses
                              4 views
                              0 likes
                              Last Post aa731
                              by aa731
                               
                              Started by thanajo, 05-04-2021, 02:11 AM
                              3 responses
                              470 views
                              0 likes
                              Last Post tradingnasdaqprueba  
                              Started by Christopher_R, Today, 12:29 AM
                              0 responses
                              10 views
                              0 likes
                              Last Post Christopher_R  
                              Started by sidlercom80, 10-28-2023, 08:49 AM
                              166 responses
                              2,237 views
                              0 likes
                              Last Post sidlercom80  
                              Started by thread, Yesterday, 11:58 PM
                              0 responses
                              4 views
                              0 likes
                              Last Post thread
                              by thread
                               
                              Working...
                              X