Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Bewilderment with EnterShortLimit .. Limit price can 't be smaller than current bid

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

    Bewilderment with EnterShortLimit .. Limit price can 't be smaller than current bid

    Guys,

    I don't know why the error is triggered.

    Code:

    if(SomeCondition) {
    EnterShortLimit(50000, GetCurrentBid(), "shortBreakOut");
    SetProfitTarget("shortBreakOut", CalculationMode.Price, Open[barsAgo] - profitThreshold);
    SetStopLoss(CalculationMode.Price, Open[barsAgo]);
    }

    I get the error: "Limit price can't be smaller than current bid. Affected Order: SellShort 50000 Limit @ 1.4371"

    Isn't the current bid returned by GetCurrentBid()?

    #2
    crmcwi, yes it would return the Bid, in backtesting this would be substituted with the close then...are you running this on CalculateOnBarClose false or true?

    Comment


      #3
      Hi Bertrand,

      Yes, I've got CalculateOnBarClose = true;

      so, if GetCurrentBid() is returning the bid, and that's being used for my limit price, then why am I getting the error?

      Comment


        #4
        Thanks, because this will give you then the bid of the last on bar update (Calculate On Bar Close = true), so by the time it's placed the order is invalid.

        Comment


          #5
          Originally posted by NinjaTrader_Bertrand View Post
          Thanks, because this will give you then the bid of the last on bar update (Calculate On Bar Close = true), so by the time it's placed the order is invalid.

          I should have thought of that. This is a simple crossunder entry. What is the solution in this case?

          Comment


            #6
            You can switch CalculateOnBarClose to false. This would be effective during real-time only.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              Originally posted by NinjaTrader_Josh View Post
              You can switch CalculateOnBarClose to false. This would be effective during real-time only.
              ok, and just to be sure, as i'm comparing Close[0] to something in my conditional statement, bar[0] must close before the Enter() is processed?

              if (Close[0] < somevalue) {
              Enter();
              }

              Comment


                #8
                Not when you are using CalculateOnBarClose = false. It will process the tick it is submitted on.
                Josh P.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                0 responses
                652 views
                0 likes
                Last Post Geovanny Suaza  
                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                0 responses
                370 views
                1 like
                Last Post Geovanny Suaza  
                Started by Mindset, 02-09-2026, 11:44 AM
                0 responses
                109 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                0 responses
                574 views
                1 like
                Last Post Geovanny Suaza  
                Started by RFrosty, 01-28-2026, 06:49 PM
                0 responses
                577 views
                1 like
                Last Post RFrosty
                by RFrosty
                 
                Working...
                X