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

How to set a stop from a strategy already executed

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

    How to set a stop from a strategy already executed

    Hello,

    I want to set a Stop or Fill from an order that is already executed in my Strategy Builder, apart of the Stop Loss that is setted by 12 ticks in the strategy, I do want to put other stop when the price cross below the SAR indicator and the price has risen to take advantage of the movement.

    So, here is the Strategy: when the price cross below the SAR a buy order execution with Stop Loss of 12 ticks is executed, but I want to set other Stop Loss or Fill when the Price cross again the SAR below. No matter what the first thing that occurs, if the Stop Limit or the Fill when the price crosses below again.

    I hope you can help me, thanks

    #2
    Hello jeremy83846,

    Thanks for your post.

    You can create another couple of sets (one for long, one for short) that checks to see if you are in a specific position/direction, see the help guide for example: "How to create market position comparisons" https://ninjatrader.com/support/help...on_builder.htm
    You would check for the condition of interest for the exit. For the action of the set you would place an ExitLong() or ExitShort() as needed.

    Note 1: Something you will have to test for, that is shown in your exit condition screenshot, is how to detect that the the price has cross below the Psar because at that bar I see the Psar has actually changed sides and I am unsure (would have to test) if using a crossbelow/crossabove would fire in that situation. You may just want to check, in the case of a long, to see if the Low[0] is less than or equal to the Psar which in that screenshot would be true on that bar.

    Note 2: Risk: When you have a strategy that is using, in this case, a SetStopLoss() and are using other exits (ExitShort or ExitLong) it is possible that under some conditions you may actually hit both exits at once and may infact end up with additional unexpected orders because both exits (in the case of a long) are placing sell orders (which could leave you in an unexpected short position). To avoid this, you may want to use one or the other or place the SetStopLoss father away to avoid potential conflict.
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Ok in the Note 1, I need to say that I just want to fill the order in the close of that bar when the SAR change again the direction and the pearl turns above again.

      And in the Note 2 I don't really know how to avoid that, even how to set that in the Strategy Builder can you explain me please?

      And following your steps in the strategy, the Stop and Target isn't being honred, how can I fix that?

      Thank you for your patience

      Comment


        #4
        Hello jeremy83846,

        Thanks for your reply.

        Please keep in mind that you are developing a strategy according to your definitions and in the development process you will have to test things out to see what works and what does not. It is one thing to see on a chart what is happening, it is something else to create a strategy to reflect what is easily seen on a chart and that is one challenge of creating a strategy.

        For note 1, as advised, you would need to test for the conditions you describe, " when the SAR change again the direction and the pearl turns above again.".

        For note 2: "To avoid this, you may want to use one or the other or place the SetStopLoss father away to avoid potential conflict." Again testing will help you with this.

        "And following your steps in the strategy, the Stop and Target isn't being honred, how can I fix that?" When a strategy isn't working as expected you would need to investigate why this is and the process to do so is called debugging. We have tips on the debugging process which can be found here: https://ninjatrader.com/support/help...script_cod.htm As you are working within the limits of the strategy builder, I've created a short video that walks through using the print statements in the strategy builder: https://paul-ninjatrader.tinytake.co...NV8xMDk5MDc5Nw

        If you would like your strategy created for you, we can provide references to 3rd party providers of that kind of service. Please note that we do not provide coding or debugging services.
        Paul H.NinjaTrader Customer Service

        Comment


          #5
          Yes please give me the references of that 3rd party providers because I'm not programmer and is turning harder for me

          Comment


            #6

            Hello,

            Thank you for your interest in NinjaTrader.

            You can search our extensive library of NinjaScript consultants through the link below. Simply enter a consultant name or search by using our filter categories. Once you have identified your consultants of choice, please visit each consultant's site for more information or contact them directly to learn more:
            You can locate the contact information for the consultants on their direct websites for any additional questions you may have. Since these consultants are third-party services for NinjaTrader, all pricing and support information will need to be obtained through the consultant.

            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 companies and services 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.
            Christopher S.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by maybeimnotrader, Yesterday, 05:46 PM
            2 responses
            20 views
            0 likes
            Last Post maybeimnotrader  
            Started by adeelshahzad, Today, 03:54 AM
            5 responses
            32 views
            0 likes
            Last Post NinjaTrader_BrandonH  
            Started by stafe, 04-15-2024, 08:34 PM
            7 responses
            32 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by merzo, 06-25-2023, 02:19 AM
            10 responses
            823 views
            1 like
            Last Post NinjaTrader_ChristopherJ  
            Started by frankthearm, Today, 09:08 AM
            5 responses
            22 views
            0 likes
            Last Post NinjaTrader_Clayton  
            Working...
            X