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 kujista, Today, 05:44 AM
                    0 responses
                    6 views
                    0 likes
                    Last Post kujista
                    by kujista
                     
                    Started by ZenCortexCLICK, Today, 04:58 AM
                    0 responses
                    8 views
                    0 likes
                    Last Post ZenCortexCLICK  
                    Started by sidlercom80, 10-28-2023, 08:49 AM
                    172 responses
                    2,281 views
                    0 likes
                    Last Post sidlercom80  
                    Started by Irukandji, Yesterday, 02:53 AM
                    2 responses
                    18 views
                    0 likes
                    Last Post Irukandji  
                    Started by adeelshahzad, Today, 03:54 AM
                    0 responses
                    10 views
                    0 likes
                    Last Post adeelshahzad  
                    Working...
                    X