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.

            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?

                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).

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by cls71, Today, 04:45 AM
                    1 response
                    7 views
                    0 likes
                    Last Post NinjaTrader_ChelseaB  
                    Started by TradeForge, Today, 02:09 AM
                    1 response
                    22 views
                    0 likes
                    Last Post NinjaTrader_ChelseaB  
                    Started by elirion, Today, 01:36 AM
                    2 responses
                    14 views
                    0 likes
                    Last Post elirion
                    by elirion
                     
                    Started by DJ888, 04-16-2024, 06:09 PM
                    5 responses
                    14 views
                    0 likes
                    Last Post NinjaTrader_Erick  
                    Started by samish18, Yesterday, 08:31 AM
                    4 responses
                    14 views
                    0 likes
                    Last Post elirion
                    by elirion
                     
                    Working...
                    X