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 DTSSTS, Today, 11:35 AM
              0 responses
              1 view
              0 likes
              Last Post DTSSTS
              by DTSSTS
               
              Started by op1031, Yesterday, 05:16 PM
              1 response
              8 views
              0 likes
              Last Post NT-Roland  
              Started by sinpeople, Today, 07:20 AM
              1 response
              3 views
              0 likes
              Last Post NT-Roland  
              Started by Frank1000, Today, 03:05 AM
              1 response
              8 views
              0 likes
              Last Post NT-Roland  
              Started by ntdev, Today, 01:14 AM
              4 responses
              16 views
              0 likes
              Last Post ntdev
              by ntdev
               
              Working...
              X