Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

CalculateMode.Percent stop loss gets cancelled

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

    CalculateMode.Percent stop loss gets cancelled

    I'm using the simulator version of NT and when I try to use SetStopLoss(CalculateMode.Percent, 2) the stop gets cancelled. If I use one of the other modes the stop will trigger. Why is the percent mode always cancelling?

    #2
    Try passing in 0.02 for your percent.
    RayNinjaTrader Customer Service

    Comment


      #3
      Thanks. So will 0.02 be calculated as 0.02% or 2% ?

      Originally posted by NinjaTrader_Ray View Post
      Try passing in 0.02 for your percent.

      Comment


        #4
        That would be 2%.
        RayNinjaTrader Customer Service

        Comment


          #5
          Tried it and the stop orders still get cancelled.

          I just added it to the MAcrossover template:

          protectedoverridevoid Initialize()
          {
          SMA(Fast).Plots[
          0].Pen.Color = Color.Orange;
          SMA(Slow).Plots[
          0].Pen.Color = Color.Green;
          Add(SMA(Fast));
          Add(SMA(Slow));
          CalculateOnBarClose =
          true;
          SetStopLoss(CalculationMode.Percent,
          0.02);
          }
          ///<summary>
          /// Called on each bar update event (incoming tick).
          ///</summary>
          protectedoverridevoid OnBarUpdate()
          {
          if (CrossAbove(SMA(Fast), SMA(Slow), 1))
          {
          EnterLong(
          "CrossLong");

          }
          elseif (CrossBelow(SMA(Fast), SMA(Slow), 1))
          {
          EnterShort(
          "CrossShort");
          }
          }

          Comment


            #6
            Please check out the logs. In case you trade against a live account there should be some messages in indicating why your broker cancelled out the order.
            DierkNinjaTrader Customer Service

            Comment


              #7
              I'm using the simulator version of Ninja Trader

              Originally posted by NinjaTrader_Dierk View Post
              Please check out the logs. In case you trade against a live account there should be some messages in indicating why your broker cancelled out the order.

              Comment


                #8
                Are there any funny messages on the logs?
                DierkNinjaTrader Customer Service

                Comment


                  #9
                  Not that I can see.

                  There is a log entry stating Automated trading is disabled. But that shouldn't have affected the backtest since the other stop modes trigger.


                  Originally posted by NinjaTrader_Dierk View Post
                  Are there any funny messages on the logs?

                  Comment


                    #10
                    May be the stop gets cancelled as your strategy tries to enter on the other side and closes the opposite position plus cancels the associated stop order (expected).
                    DierkNinjaTrader Customer Service

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by Renejm, Today, 06:17 AM
                    0 responses
                    3 views
                    0 likes
                    Last Post Renejm
                    by Renejm
                     
                    Started by kazisl, Yesterday, 06:41 PM
                    2 responses
                    10 views
                    0 likes
                    Last Post NinjaTrader_PaulH  
                    Started by impactX, 05-04-2021, 01:07 AM
                    1 response
                    7 views
                    0 likes
                    Last Post Lancer
                    by Lancer
                     
                    Started by op1031, Yesterday, 05:51 PM
                    1 response
                    8 views
                    0 likes
                    Last Post NinjaTrader_PaulH  
                    Started by aaadetos, 05-04-2021, 09:28 AM
                    3 responses
                    13 views
                    0 likes
                    Last Post NinjaTrader_Heath  
                    Working...
                    X