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

Break even strategy to new trailing stop

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

    Break even strategy to new trailing stop

    Hello!

    I have a strategy that exits at a certain Profit/Loss but I don't want to cut the move short if it is still on a running move.

    It currently shuts off at the exact number but I want it to instead set the profit target as a new breakeven stop loss and create a new secondary tick trail stop. The original strategy has a stop loss as well.

    Example, I have a profit/loss set to +1000/-2000 I am in a move that is approaching $1000 assuming it is shooting through I want it to set the stop loss at $1,000 and create a new trailing stop loss stemming from the $1,000 I have locked in with the same move instead of exiting.

    Is there a way to achieve this in the strategy builder?


    #2
    Hello litamm89,

    Thanks for your post.

    You could use Exit order methods and add coding logic in the Strategy Builder to accomplish this goal.

    Please note that you would not be able to use the Exit methods and the Set methods in the Stop and Targets window as that creates a violation of the Managed Approach Internal Order Handling Rules, linked here: https://ninjatrader.com/support/help...d_approach.htm

    See the educational examples in the forum thread below that my colleague Chelsea has created regarding strategy builder breakeven and trailing stop in the Strategy Builder.
    https://ninjatrader.com/support/foru...der#post806596

    Please let us know if we may assist further.
    Brandon H.NinjaTrader Customer Service

    Comment


      #3
      NinjaTrader_BrandonH

      Thank you for your response.

      I did find that thread and have been using the templates plus another Multiple Break even Level template.

      Thank you for also confirming that I would need to use the custom trail builder. I was playing with it yesterday and did realize that the normal stop and targets trail stoop did not work.

      I am trying to incorporate the TotalPNL custom series I have integrated as well. Which has proven tricky in itself.

      I will let you know if I come upon anything that I truly cant figure out. Your colleague PaulH has been an immense help and I feel so much more comfortable navigating the Strategy Builder now.

      Comment


        #4
        NinjaTrader_BrandonH

        I came across a bit of an issue I was hoping you can help me solve.

        I correctly did the multilevel breakeven strategies correctly.

        However. I cant seem to figure out the Total PNL one.

        I want to set the breakeven point to TotalPNL - 43 ticks.

        I have it as ExitLongStopMarket)DefaultQuanitity,(Position.Aver agePrice + ((TotalPNL[0] + (-120 *TickSize)) * TickSize)) * TickSize)),"","");

        I keep getting the error message that Strategy " " submitted an order that generated the following error 'unable to change order'. Strategy has sent cancel requests, attempted to close the position and terminated itself

        Stop price can't be changed above the market. affected Order: sell 1 StopMarket @ ""

        I have it calculated to bar close.

        Please help I feel like I am so close.

        Afterwards I will set the Trail stop to the breakeven point.

        Comment


          #5
          Hello litamm89,

          Thanks for your note.

          Debugging steps would need to be taken to determine how your strategy is behaving and placing orders. This error message means that your strategy is attempting to place a stop order above the market. You would need to ensure that the stop order is being placed at a price that is at or below the market.

          To understand why the script is behaving as it is, such as placing orders or not placing orders when expected, it is necessary to add prints to the script that print the values used for the logic of the script to understand how the script is evaluating.

          In the strategy add prints (outside of any conditions) that print the values of every variable used in every condition that places an order along with the time of that bar. Prints will appear in the NinjaScript Output window (New > NinjaScript Output window).

          Below is a link to a forum post that demonstrates using prints to understand behavior and including a link to a video recorded using the Strategy Builder.
          https://ninjatrader.com/support/foru...121#post791121

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

          Comment


            #6
            Can anyone give me an idea how to use break; function so that post a condition to meet break even condition is met and stops are placed, the breakeven is no longer in a continuous loop and that post break even the stops can be moved manually and not replaced at update of a new bar.

            Comment


              #7
              Hello LoganJKTrader,

              Thanks for your note.

              Using the 'break;' statement would be considered C# education and in the support department at NinjaTrader it is against our policy to provide C# programming education services

              To understand how to use the C# 'break;' statement, you could do a quick Google search for something like 'C# break statement example'.

              That said, this forum thread will also be open for other community members to share their insight on the topic.

              Let us know if we may assist further.
              Brandon H.NinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by bmartz, 03-12-2024, 06:12 AM
              5 responses
              32 views
              0 likes
              Last Post NinjaTrader_Zachary  
              Started by Aviram Y, Today, 05:29 AM
              4 responses
              12 views
              0 likes
              Last Post Aviram Y  
              Started by algospoke, 04-17-2024, 06:40 PM
              3 responses
              28 views
              0 likes
              Last Post NinjaTrader_Jesse  
              Started by gentlebenthebear, Today, 01:30 AM
              1 response
              8 views
              0 likes
              Last Post NinjaTrader_Jesse  
              Started by cls71, Today, 04:45 AM
              1 response
              7 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Working...
              X