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 adeelshahzad, Today, 03:54 AM
                2 responses
                15 views
                0 likes
                Last Post adeelshahzad  
                Started by dappa, Today, 09:18 AM
                1 response
                4 views
                0 likes
                Last Post NinjaTrader_ChelseaB  
                Started by bill2023, Yesterday, 08:51 AM
                5 responses
                23 views
                0 likes
                Last Post bltdavid  
                Started by frankthearm, Today, 09:08 AM
                1 response
                2 views
                0 likes
                Last Post NinjaTrader_Clayton  
                Started by yertle, Today, 08:38 AM
                2 responses
                7 views
                0 likes
                Last Post yertle
                by yertle
                 
                Working...
                X