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 lightsun47, Today, 03:51 PM
                    0 responses
                    5 views
                    0 likes
                    Last Post lightsun47  
                    Started by 00nevest, Today, 02:27 PM
                    1 response
                    9 views
                    0 likes
                    Last Post 00nevest  
                    Started by futtrader, 04-21-2024, 01:50 AM
                    4 responses
                    45 views
                    0 likes
                    Last Post futtrader  
                    Started by Option Whisperer, Today, 09:55 AM
                    1 response
                    14 views
                    0 likes
                    Last Post bltdavid  
                    Started by port119, Today, 02:43 PM
                    0 responses
                    9 views
                    0 likes
                    Last Post port119
                    by port119
                     
                    Working...
                    X