Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Invalid stop-entry order in StrategyBuilder

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

    Invalid stop-entry order in StrategyBuilder

    I got an error an a stop-short-order using StrategyBuilder:

    Strategy 'XXXXX/-1': A SellShort order placed at 'XXXXXX' has been ignored since the stop price is greater than or equal to the close price of the current bar. This is an invalid order and subsequent orders may also be ignored. Please fix your strategy.

    How to avoid this order? I tried with

    Close[0] >= GetCurrentBid

    but that doesn't seem to work. I am using a CalculateOnBarClose strategy in NT8. It should be easy to reproduce this issue if you using as stop-entry-level yesterday close.

    #2
    Hello,

    Thank you for the post.

    I wanted to see if you could post an image of the condition and action you had created so I can see the specifics used for the order.

    The message is pretty specific, the price used was not valid and the order was ignored so we would need to address the price you are using in the order.


    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      As I mentioned above the error is very easy to reproduce. Please see attached screenshot.
      I tested in StrategyAnalyzer with FDAX on M5.

      Which statement do I need to insert to prevent the error?
      Attached Files

      Comment


        #4
        I found the error. PrevDayHigh was 0 for the first Bars, so the error occured.

        Comment


          #5
          I tried to use this code statement to prevent it

          if (CurrentBar < BarsRequiredToTrade)
          return;

          So I have to use another comparison to PrevDayHigh that works.

          But I still miss the BarsRequiredTrade variable in StrategyBuilder?
          Last edited by DarthTraderson; 08-16-2017, 11:37 PM.

          Comment


            #6
            Hello,

            Thank you for the post.

            I wanted to clarify, are you saying that the analyzer is not waiting for the amount of BarsRequiredToTrade that you are using?

            I look forward to being of further assistance.
            JesseNinjaTrader Customer Service

            Comment


              #7
              I mean StrategyBuilder. I corrected it, it was a typo. I miss the BarsRequiredVariable in StrategyBuilder to add a statement like

              if (CurrentBar < BarsRequiredToTrade)
              return;

              This statement is generated once, but if I change the BarsRequired number later in StrategyBuilder the statement did not change.

              I have often the error in OutputWindow that "...numberOfBars is less than BarsRequired to trade" and the only way to prevent it is, to add manually Currentbars < XY in StrategyBuilder. That should be, inmy opinion be done automatically, and in addition there should be a variable available ... BarsRequired.

              Comment


                #8
                Hello,

                Thank you for the reply and clarifying.

                I will put in a feature request to have the BarsRequiredToTrade as an option for the builder to add generated code.

                I look forward to being of further assistance.
                JesseNinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Blairski, Yesterday, 09:19 AM
                1 response
                9 views
                0 likes
                Last Post NinjaTrader_Jesse  
                Started by tonynt, Today, 09:33 AM
                1 response
                5 views
                0 likes
                Last Post NinjaTrader_Jesse  
                Started by minotti1, Today, 08:31 AM
                1 response
                13 views
                0 likes
                Last Post NinjaTrader_Jim  
                Started by SmartArtsStudio, 05-15-2021, 10:46 AM
                1 response
                15 views
                0 likes
                Last Post NinjaTrader_ChelseaB  
                Started by Airwave, Today, 06:02 AM
                2 responses
                23 views
                0 likes
                Last Post NinjaTrader_BrandonH  
                Working...
                X