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

Another Internal Order Handling Rules that Reduce Unwanted Positions Question

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

    Another Internal Order Handling Rules that Reduce Unwanted Positions Question

    Hello,

    I looked at the rules for "Internal Order Handling Rules that Reduce Unwanted Positions", but was not able to explain the error I received.

    I entered my position with: EnterLongLimit(LotSize, Bars.GetClose(CurrentBar), "Long");

    and when I tried to exit my position with: ExitLongLimit(Bars.GetClose(CurrentBar), "ExitLong", "Long");

    I get the errors: "2/8/2023 8:19:32 AM Strategy 'AGG6BarDailyMonthlyDrawdownLive3001Test/89041889': Ignored SubmitOrderManaged() method at 2/8/2023 8:19:32 AM: BarsInProgress=0 Action=Sell OrderType=Limit Quantity=0 LimitPrice=4153.00 StopPrice=0 SignalName='ExitLong' FromEntrySignal='Long' Reason='An Exit() method to submit an exit order has been ignored. Please search on the term 'Internal Order Handling Rules that Reduce Unwanted Positions' in the Help Guide for detailed explanation.'
    Strategy 'AGG6BarDailyMonthlyDrawdownLive3001Test/89041889': An Exit() method to submit an exit order at '2/8/2023 8:19:31 AM' has been ignored. Please search on the term 'Internal Order Handling Rules that Reduce Unwanted Positions' in the Help Guide for detailed explanation.​"

    In addition, I set both the profit target and stop loss only ONCE in the OnStateChange(), see below:

    else if (State == State.Configure)
    {
    SetProfitTarget(CalculationMode.Ticks, profitTarget);
    SetStopLoss(CalculationMode.Ticks, hardDeck);
    }

    Kindly advise what rule did I violate to have caused the error?

    Best regards,

    Billy

    #2
    You are not allowed to use Exit methods along with Set methods.

    Comment


      #3
      Hello Billy,

      KonstantinosNT is correct. From the help guide:
      "Methods that generate orders to exit a position will be ignored if:
      ...
      • A position is open and an order submitted by a set method (SetStopLoss() for example) is active"


      Choose one or the other. You can submit your own stop order with ExitLongStopMarket() to go with your ExitLongLimit().
      Below are links to examples.

      Chelsea B.NinjaTrader Customer Service

      Comment


        #4
        Thank you Chelsea and Konstantinos, for the explanation.

        Comment


          #5
          Just a point of clarification for those landing on this page. The help guide on "Rules that Reduce Unwanted Positions" says

          Click image for larger version

Name:	image.png
Views:	106
Size:	2.7 KB
ID:	1282435

          So you can use ExitLong() or ExitShort() along with Set methods.
          Steve L
          NinjaTrader Ecosystem Vendor - Ninja Mastery

          Comment


            #6
            Hello Steve L,

            That is the case. The user billythekid72, however, is using ExitLongLimit().
            Chelsea B.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Klaus Hengher, Yesterday, 03:13 AM
            2 responses
            15 views
            0 likes
            Last Post Klaus Hengher  
            Started by Sebastian - TwinPeaks, Yesterday, 01:31 PM
            2 responses
            13 views
            0 likes
            Last Post Sebastian - TwinPeaks  
            Started by wbennettjr, 07-15-2017, 05:07 PM
            16 responses
            2,531 views
            1 like
            Last Post eladlevi  
            Started by Human#102, Yesterday, 09:54 AM
            2 responses
            8 views
            0 likes
            Last Post Human#102  
            Started by Patlpp, 08-16-2021, 03:10 PM
            10 responses
            500 views
            0 likes
            Last Post Joerg
            by Joerg
             
            Working...
            X