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 Jonafare, 12-06-2012, 03:48 PM
              5 responses
              3,984 views
              0 likes
              Last Post rene69851  
              Started by Fitspressorest, Today, 01:38 PM
              0 responses
              2 views
              0 likes
              Last Post Fitspressorest  
              Started by Jonker, Today, 01:19 PM
              0 responses
              2 views
              0 likes
              Last Post Jonker
              by Jonker
               
              Started by futtrader, Today, 01:16 PM
              0 responses
              7 views
              0 likes
              Last Post futtrader  
              Started by Segwin, 05-07-2018, 02:15 PM
              14 responses
              1,791 views
              0 likes
              Last Post aligator  
              Working...
              X