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

Market order submitted as Limit?

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

    Market order submitted as Limit?

    Hello,

    I have a strange error message indicating that a Limit order errored out, but I submitted the order using EnterLong or EnterShort which is supposed to be a Market order.

    What am I doing wrong?

    Many Thanks, Caesar.

    The order entry code is as follows:
    Code:
    EnterLong(ContractQuantity, "EnterLongMarket");
    The error messages are as follows:
    Click image for larger version  Name:	Screenshot 2023-06-19 162036.png Views:	3 Size:	22.2 KB ID:	1256679
    Last edited by Skechers; 06-19-2023, 03:39 PM.

    #2

    Deleted.​​​
    Last edited by Skechers; 06-19-2023, 02:51 PM.

    Comment


      #3
      Hello, thanks for writing in. Im unable to guess at what code you have in your strategy. Can you post the contents of the strategy?
      Chris L.NinjaTrader Customer Service

      Comment


        #4
        Here it is:
        Code:
                            if (CrossTrigger == 1)
                            {    // Plot Long
                                CrossTrigger = 0;
                                if (TradingEnabled && ClearToSubmit && StrategyEnabled)
                                {    
                                    if(TradingEnabled && ShowOtherPlots)
                                    {
                                        Trigger[0] = (Low[0] - (SecondaryPlotGap * 4) - SecondaryPlotOffset - PrimaryPlotOffset);
                                        PlotBrushes[7][0] = Brushes.SkyBlue;
                                    }
                                    ClearToSubmit = false;
                                    if (Limit_1_Market_2 == 1)
                                    {
                                        PrintLog(1, "Strategy: Submitting Long Limit Order " + (High[0] + Low[0]).ToString(format) + " Qty: " + ContractQuantity);
                                        EnterLongLimit(ContractQuantity, (High[0] + Low[0]) / 2, "EnterLongLimit");
                                    }
                                    else
                                    {
                                        PrintLog(1, "Strategy: Submitting Long Market Order" + " Qty: " + ContractQuantity );
                                        EnterLong(ContractQuantity, "EnterLongMarket");
                                    }
                                }
                            }​

        Comment


          #5
          Hello Caesar,

          To confirm, there is no stop loss or profit target being submitted with SetProfitTarget and/or SetStopLoss(), is this correct?
          Chelsea B.NinjaTrader Customer Service

          Comment


            #6
            Hi Chelsea, yes, the strategy makes use of SetProfitTarget and SetStopLoss. If those are causing the issue, what alternatives are there?

            Many Thanks, Caesar.

            Comment


              #7
              Hi, It is the stop loss order that is causing the error for you. You are placing this order above the market price at the time of submission. To avoid this, make sure the price you are going to submit the order at a legal price level (below GetCurrentBid()).
              Chris L.NinjaTrader Customer Service

              Comment


                #8
                Many Thanks!

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Patlpp, 08-16-2021, 03:10 PM
                10 responses
                498 views
                0 likes
                Last Post Joerg
                by Joerg
                 
                Started by AdamDJ8, 05-07-2024, 09:18 PM
                2 responses
                17 views
                0 likes
                Last Post -=Edge=-  
                Started by StockTrader88, 03-06-2021, 08:58 AM
                46 responses
                4,101 views
                3 likes
                Last Post tradgrad  
                Started by usasugardefender, Today, 01:42 AM
                0 responses
                1 view
                0 likes
                Last Post usasugardefender  
                Started by haas88, 03-21-2024, 02:22 AM
                15 responses
                182 views
                0 likes
                Last Post haas88
                by haas88
                 
                Working...
                X