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 Jonafare, 12-06-2012, 03:48 PM
                    5 responses
                    3,986 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
                    8 views
                    0 likes
                    Last Post futtrader  
                    Started by Segwin, 05-07-2018, 02:15 PM
                    14 responses
                    1,792 views
                    0 likes
                    Last Post aligator  
                    Working...
                    X