Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

ExitLongStop not executed

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

    ExitLongStop not executed

    Hallo,

    I'm testing some simple strategies, does anybody see why the Enter works fine, but the ExitLongStop is never executed ?

    regards Ali

    Code:
                if (ADX(14)[0] > 25
                    && Close[0] < SMA(10)[0]
                    && Close[0] > EMA(30)[0]
                    && 1 == Swing(0).SwingLowBar(0, 1, 10))
                {
                    EnterLong(DefaultQuantity, "");
                }
    
                ExitLongStop(Swing(1).SwingLow[0], "StopExit", "");

    #2
    Code:
                if (ADX(14)[0] > 25
                    && Close[0] < SMA(10)[0]
                    && Close[0] > EMA(30)[0]
                    && 1 == Swing(0).SwingLowBar(0, 1, 10))
                {
                    EnterLong(DefaultQuantity, "");
                }
    
                if (Low[0] < Swing(1).SwingLow[0]){
                    ExitLong("Exit Long", "");
    	    }
    This excample works, buts not the same like an exitstoplong order.

    Comment


      #3
      ali321,

      When you submit stops or limit orders you need to keep them alive on every single sequential bar otherwise they will auto cancel. To keep them alive, you need to call ExitLongStop() again with the same quantity, price, and name and it will keep the order alive.
      Josh P.NinjaTrader Customer Service

      Comment


        #4
        Originally posted by NinjaTrader_Josh View Post
        ali321,

        When you submit stops or limit orders you need to keep them alive on every single sequential bar otherwise they will auto cancel. To keep them alive, you need to call ExitLongStop() again with the same quantity, price, and name and it will keep the order alive.
        Sorry, I don't understand how the code should look like.
        Do you have an excample ?

        Comment


          #5
          ali321,

          I have no code example I can provide you as it is highly dependent on what logic you want to put into place. All you need to do is decide when you want to cancel the order if it still doesn't fill. Then create an if-statement

          Code:
          if (Position.MarketPosition == MarketPosition.Long && some other conditions)
               ExitLongStop(...);
          As long as your other conditions are true you will try to keep the stop order alive. When it is false, you stop and then the order is cancelled.
          Josh P.NinjaTrader Customer Service

          Comment


            #6
            ExitLongStop

            Hallo,

            does anyone know a link or support thread where the handling of the ExitLongStop is explaint better then in the programming help system ?

            regards ali

            Comment


              #7
              Ali, another option would be to specify that these orders are live until cancelled. That way you won't have to keep re-submitting the orders.
              Code:
              //ExitLongStop(int barsInProgressIndex, bool liveUntilCancelled, int quantity, double stopPrice, string signalName, string fromEntrySignal)
              
              ExitLongStop(0, true, 1, Swing(1).SwingLow[0], "StopExit", "");
              AustinNinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by pel11, Today, 06:44 PM
              0 responses
              2 views
              0 likes
              Last Post pel11
              by pel11
               
              Started by traderbot, Today, 06:40 PM
              0 responses
              2 views
              0 likes
              Last Post traderbot  
              Started by CCLQMT, Today, 05:31 PM
              0 responses
              6 views
              0 likes
              Last Post CCLQMT
              by CCLQMT
               
              Started by yodaler, Today, 03:17 PM
              2 responses
              12 views
              0 likes
              Last Post yodaler
              by yodaler
               
              Started by tatir, Today, 03:09 PM
              2 responses
              18 views
              0 likes
              Last Post tatir
              by tatir
               
              Working...
              X