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

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
      BertrandNinjaTrader Customer Service

      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 burtoninlondon, Today, 12:38 AM
          0 responses
          2 views
          0 likes
          Last Post burtoninlondon  
          Started by AaronKoRn, Yesterday, 09:49 PM
          0 responses
          11 views
          0 likes
          Last Post AaronKoRn  
          Started by carnitron, Yesterday, 08:42 PM
          0 responses
          11 views
          0 likes
          Last Post carnitron  
          Started by strategist007, Yesterday, 07:51 PM
          0 responses
          12 views
          0 likes
          Last Post strategist007  
          Started by StockTrader88, 03-06-2021, 08:58 AM
          44 responses
          3,982 views
          3 likes
          Last Post jhudas88  
          Working...
          X