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 RaddiFX, Today, 10:15 AM
            2 responses
            14 views
            0 likes
            Last Post RaddiFX
            by RaddiFX
             
            Started by patrickmlee007, Today, 09:33 AM
            2 responses
            17 views
            0 likes
            Last Post patrickmlee007  
            Started by magnatauren, 08-15-2020, 02:12 PM
            5 responses
            206 views
            0 likes
            Last Post RaddiFX
            by RaddiFX
             
            Started by rene69851, 05-02-2024, 03:25 PM
            1 response
            22 views
            0 likes
            Last Post rene69851  
            Started by ETFVoyageur, Yesterday, 07:05 PM
            5 responses
            45 views
            0 likes
            Last Post ETFVoyageur  
            Working...
            X