Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Cannot exit with limit order.

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

    Cannot exit with limit order.

    Thats my entry order:

    if (Low[0] > SMA(200)[0] && ((RSI(3, 1)[0] + RSI (3, 1)[1]) <= 20))
    {

    EnterLongLimit(DefaultQuantity, Close[
    0], "EinstiegLong");
    double value = MAX(ATR(20), 900)[0];
    value = Close [
    0] - (value * 5);
    SetStopLoss(
    "EinstiegLong", CalculationMode.Price, value, false);
    }

    Thats my exit order:

    if (RSI(3, 1)[0] >= 75)

    {
    ExitLongLimit(Close [
    0], "EinstiegLong");
    }


    This does not work. If I replace the exit order, with a
    market order, it works. But the limit order does not work.

    Thank you.

    #2
    Hello Ironman9973,
    The internal order handling rules does not allows one to use the Set() method with the ExitLimit() methods. Please refer to our help guide to know more about it



    Please set the TraceOrder property to true so that you can get the exact error message in the Output Window which will let you to debug your code.

    JoydeepNinjaTrader Customer Service

    Comment


      #3
      How can I solve my problem? I want a stoploss order and I want to exit with a limit order. Is this somehow possible?

      Comment


        #4
        Hello Ironman9973,
        Unfortunately you cannot do it and there are no workarounds.

        You have to use a market order to do it (ExitLong or ExitShort).
        JoydeepNinjaTrader Customer Service

        Comment


          #5
          Originally posted by Ironman9973 View Post
          How can I solve my problem? I want a stoploss order and I want to exit with a limit order. Is this somehow possible?
          Will SetProfitTarget work?

          Comment


            #6
            Yes, but how can I exit, if the Rsi > 75, with this methode?

            Comment


              #7
              Hello Sledge,
              Yes, it will work. Thanks for the workaround.
              JoydeepNinjaTrader Customer Service

              Comment


                #8
                Originally posted by Ironman9973 View Post
                Yes, but how can I exit, if the Rsi > 75, with this methode?
                You check for your exit condition, then use the SetStopLoss() statement to move the StopLoss to the original target limit price.

                The actual advantage is that if the market shoots through your target and takes off because the Bernanke makes another stupid move, your stop actually is now sitting at your original profit target as the move pumps more dollari into your account because for once the market run away from your stop!

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by chbruno, Yesterday, 04:10 PM
                1 response
                43 views
                0 likes
                Last Post NinjaTrader_Gaby  
                Started by Max238, Today, 01:28 AM
                1 response
                23 views
                0 likes
                Last Post CactusMan  
                Started by giulyko00, Yesterday, 12:03 PM
                2 responses
                10 views
                0 likes
                Last Post giulyko00  
                Started by r68cervera, Today, 05:29 AM
                0 responses
                4 views
                0 likes
                Last Post r68cervera  
                Started by geddyisodin, Today, 05:20 AM
                0 responses
                7 views
                0 likes
                Last Post geddyisodin  
                Working...
                X