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

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 ScottWalsh, 04-16-2024, 04:29 PM
                7 responses
                34 views
                0 likes
                Last Post NinjaTrader_Gaby  
                Started by cls71, Today, 04:45 AM
                0 responses
                3 views
                0 likes
                Last Post cls71
                by cls71
                 
                Started by mjairg, 07-20-2023, 11:57 PM
                3 responses
                214 views
                1 like
                Last Post PaulMohn  
                Started by TheWhiteDragon, 01-21-2019, 12:44 PM
                4 responses
                546 views
                0 likes
                Last Post PaulMohn  
                Started by GLFX005, Today, 03:23 AM
                0 responses
                3 views
                0 likes
                Last Post GLFX005
                by GLFX005
                 
                Working...
                X