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 stoploss 1 tick below signal bar?

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

    How to set stoploss 1 tick below signal bar?

    Hello, I have the strategy conditions for the custom indicator as follows:
    If Indicator(10,4).Signal[0]= 2 do the following EnterLongStopMarket(DefaultQuantity, (High[0]+ (1* Ticksize))
    this allows me to enter 1 tick above signal bar. Signal 2 is a “BreakOut” in the indicator

    this is fine as I get my correct entries but

    how do I set the stop loss at level of one tick under the signal bar as shown in the images?
    it is currently set to take profits at 4 ticks and a stop at 40 ticks
    I have tried (Low[0] -(1*ticksize)) and it doesn’t work, as well as Low[1]

    I need this strategy to
    enter a long trade 1 tick above signal bar ✅
    when it enters the position there is a 1)take profit level of 4 ticks ✅
    2)set a stop loss at level 1 tick below signal bar ❌
    Attached Files

    #2
    Hello Brandon9821,

    To do that you would need to store the bar price at the time of the signal, are you currently manually coding this or using the strategy builder? The strategy builder would not be able to use the stops and targets page for this kind of use and would instead need to use a set and the appropriate order type.

    Also Is the indicator signal true for longer than 1 bar at a time?

    I look forward to being of further assistance.

    JesseNinjaTrader Customer Service

    Comment


      #3
      Thank you for the prompt reply! I am using the strategy builder and I did not develop the indicator myself so I don’t know if the signal lasts longer than one bar at a time

      Comment


        #4
        Hello Brandon9821,

        Thanks for clarifying those details.

        You can find a sample in the following link which would help with this concept in the builder.




        The changes you would need to make to the sample would be changing where the stop price is being set. Its currently in Set 3, waiting for the entry to have filled. Because you want to do the price from the signal bar you would move that action into Set 2 where the entry is. The stop price would be set based on the bar data during the entry condition and you could offset the price just like that sample is showing.

        The other change would be the break even, you can just remove that set along with the trigger price variable. That would be set 4, you would also need to remove the action using TriggerPrice from set 3 before you can remove that variable.

        The other sets would still be needed, set 3 would still be needed to set the TriggerState, that's to know when the entry had filled so the stop can be submitted.

        Set 5 is used to call the stop order on each bar so it does not expire and Set 1 is used to reset when flat.


        The other note is that if the indicator remains true for multiple bars you would not be getting the price from when it first became true but from the last bar that condition was true on. You would likely need to add that indicator to a chart to see how frequently the plot is equal to 2 and if it is true for multiple bars.




        I look forward to being of further assistance.
        JesseNinjaTrader Customer Service

        Comment


          #5
          I'm countless hours into trying to get this simple request accomplished of having a stop loss in a strategy placed 1 tick under the signal/entry bar and I'm completely surprised at how complicated this is. This template did not work as described.
          A few things not clear in the direction: set 2 looks like it takes an entry? A market at that. Why is there not an option for limit?

          Where do I place the entry criteria? Which set? Do I make my own?
          Why does the strategy continue to re-enter longs over and over no matter what?
          The stop setting for a long -1 tick under low of bar does not appear to be working for the stop criteria. What bar perimeters need to be set? Be specific here please. Too much gray area and hours upon wasted hours of testing to no avail.

          Thank you.

          Comment


            #6
            Hello Chompsky,

            The sample that was linked in post 4 is just a sample of one concept so it does not have any additional options. That is just a learning tool to show how to dynamically price a stop order while using the strategy builder. If you want to do different actions you would have to program those actions.

            The set 2 is where the entry condition is, that would be where to submit a market entry. This sample is not set up to submit a limit or other type of entry order that rests at a price. The purpose of this sample is to show the logic needed to keep a stop order active and how to price that order. The same concept would be needed if you wanted a limit entry so it does not expire before filling.

            The strategy continues to re enter because it has no means to stop, it shows how to enter and dynamically price a stop only.

            The sample is not set up to submit the order 1 tick under the low of the entry bar, it is set up to enter a stoploss based on a user input. If you wanted to enter 1 tick below the low of the entry bar you would have to make logic for that.





            JesseNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by SantoshXX, Today, 03:09 AM
            0 responses
            11 views
            0 likes
            Last Post SantoshXX  
            Started by DanielTynera, Today, 01:14 AM
            0 responses
            2 views
            0 likes
            Last Post DanielTynera  
            Started by yertle, 04-18-2024, 08:38 AM
            9 responses
            41 views
            0 likes
            Last Post yertle
            by yertle
             
            Started by techgetgame, Yesterday, 11:42 PM
            0 responses
            12 views
            0 likes
            Last Post techgetgame  
            Started by sephichapdson, Yesterday, 11:36 PM
            0 responses
            2 views
            0 likes
            Last Post sephichapdson  
            Working...
            X