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

Stop Loss Offset

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

    #16
    Thanks Dierk, that works!

    I have one other problem, it seems to give me results as if I have moved my stop...I am testing an exit at 60 pips, I have not put any trailing stop code in, but it seems to give me profit results which are positive based on exiting at the stop, i.e. not 60 pips but a variety of amounts below 60 pips. Is there an inbuilt trailing stop at work?

    Comment


      #17
      >> Is there an inbuilt trailing stop at work?
      No, unless you coded it. I suggest tracing your strategy as per here to understand what's going on: http://www.ninjatrader-support.com/v...ead.php?t=3627

      Comment


        #18
        What I've found out is that it's reading the stop calculation as a moving stop - recalculating on every new bar update it so that it moves with price, similar to a trailing stop - I've looked at the charts and it stops out on a retracement, rather than continuing to the profit target. I guess this means a price action entry where you place stops one pip under/above the recent low or high is not possible to test for.

        Comment


          #19
          The reason your stop keeps moving while in the OnBarUpdate() is because it is constantly submitting modifications to your stop price. If this is not intended behavior you need to also have a limiting condition that only submits your stop once at given price for your entry.
          Josh P.NinjaTrader Customer Service

          Comment


            #20
            Yes Josh, that's what it looks like. What kind of limiting condition could I put in that "only submits your stop once at given price for your entry"? I only want the stop to do its calculations for the entry bar and stick there.

            Comment


              #21
              For one, you could throw it with the condition for entry.

              Code:
               if (some entry condition)
              {
                   if (Position.MarketPosition == MarketPosition.Flat)
                   {
                        SetStopLoss(...);
                        EnterLong();
                   }
              }
              Keep in mind that SetStopLoss line should be before the EnterLong line. This is untested code, but should work in theory.

              You may get some other ideas for other things you can do with this reference sample: http://www.ninjatrader-support.com/v...ead.php?t=3222
              Josh P.NinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by andrewtrades, Today, 04:57 PM
              1 response
              8 views
              0 likes
              Last Post NinjaTrader_Manfred  
              Started by chbruno, Today, 04:10 PM
              0 responses
              5 views
              0 likes
              Last Post chbruno
              by chbruno
               
              Started by josh18955, 03-25-2023, 11:16 AM
              6 responses
              436 views
              0 likes
              Last Post Delerium  
              Started by FAQtrader, Today, 03:35 PM
              0 responses
              7 views
              0 likes
              Last Post FAQtrader  
              Started by rocketman7, Today, 09:41 AM
              5 responses
              19 views
              0 likes
              Last Post NinjaTrader_Jesse  
              Working...
              X