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 thumper57, Today, 04:30 PM
          0 responses
          3 views
          0 likes
          Last Post thumper57  
          Started by OllieFeraher, 05-09-2024, 11:14 AM
          5 responses
          16 views
          0 likes
          Last Post MisterTee  
          Started by jackiegils, Yesterday, 11:05 PM
          1 response
          11 views
          0 likes
          Last Post marcus2300  
          Started by Skifree, Today, 02:50 PM
          0 responses
          8 views
          0 likes
          Last Post Skifree
          by Skifree
           
          Started by owen5819, Today, 02:24 PM
          1 response
          12 views
          0 likes
          Last Post owen5819  
          Working...
          X