Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

orders filled outside of market

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

    orders filled outside of market

    Hi,

    I am learning to code in NinjaScript by coding simple strategies. I have a strategy that puts a sell limit order if the high of 1 bar ago is higher than the current high, and a buy limit order if low[1] < low[0].

    When I create the strategy for buy only and a seperate strat for sell only, it works fine, but when I create a strat that looks for buy and sell opps, it goes wrong. The code is attached along with a picture where you can see that the orders are being filled outside the price range of the bar.

    Any help would be much appreciated.

    Malcolm

    Attached Files

    #2
    Hi Malcolm,

    One of our NinjaScript trainees will respond later today. Thank you for your patience.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Hi malcolm,

      Thanks for your post.

      You see this display because you use limit orders in backtesting and this always creates some fill assumptions. Since the signal bar has already closed you can only submit your order on the next bar, but also since you are using Limit orders it is possible to get fills outside of the bar. If this behavior is not what you expect options for you would be to try changing your fill algorithm to 'Liberal'.

      Also you can code your own fill algorithm, please review this link for that purpose - http://www.ninjatrader-support.com/H...FillTypes.html

      Comment


        #4
        Thank you for your helpful answer. If I want to create my own fill type, the instructions are to open the code in my code editor, how do I access the code editor as this is not a strategy or an indicator?

        Comment


          #5
          You can open it with any editor file like Notepad or if you have Visual Studio you can open it from there.
          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
          580 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          335 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          102 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          554 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          552 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X