Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Gap up order placement issue

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

    Gap up order placement issue

    Hello All,

    I have coded a strategy in the Ninja Trader editor. I have a condition that the trade should be entered 13 ticks above the signal candle, but when the next candle gaps up or down, the order is placed immediately instead of the desired level.

    is this a bug or am I doing something wrong, any help would be appreciated.

    #2
    Hello varun13,

    Welcome to the NinjaTrader forums!

    You may be using the wrong order type.

    A market order fills immediately at market.
    A buy limit is placed below the ask.
    A sell limit is placed above the bid.
    A buy stop is placed above the ask.
    A sell stop is placed below the bid.



    To understand why the script is behaving as it is, such as placing orders or not placing orders or drawing objects when expected, it is necessary to add prints to the script that print the values used for the logic of the script to understand how the script is evaluating.

    In the strategy add prints (outside of any conditions) that print the date time of the bar and all values compared in every condition that triggers the action.
    The prints should include the time of the bar and should print all values from all variables and all hard coded values in all conditions that must evaluate as true for this action to be triggered. It is very important to include a text label for each value and for each comparison operator in the print to understand what is being compared in the condition sets.
    The debugging print output should clearly show what the condition is, what time the conditions are being compared, all values being compared, and how they are being compared.

    Prints will appear in the NinjaScript Output window (New > NinjaScript Output window).

    Further, enable TraceOrders which will let us know if any orders are being ignored and not being submitted when the condition to place the orders is evaluating as true.
    After enabling TraceOrders remove the instance of the strategy from the Configured list in the Strategies window and add a new instance of the strategy from the Available list.
    Last, print the order.ToString() at the top of the OnOrderUpdate() override, as this will show us when orders become working and are being filled, and print the GetCurrentAsk() and GetCurrentBid() in OnOrderUpdate() as well so we can see what the market price is at the time of a fill.

    I am happy to assist you with analyzing the output from the output window.

    Run or backtest the script and when the output from the output window appears save this by right-clicking the output window and selecting Save As... -> give the output file a name and save -> then attach the output text file to your reply.

    Below is a link to a support article that demonstrates using informative prints to understand behavior and includes a link to a video recorded using the Strategy Builder to add prints.


    Let me know the date and time the behavior occurred or when you are expecting the behavior to occur.

    Please let me know if I may further assist with analyzing the output or if you need any assistance creating a print or enabling TraceOrders.​

    Comment


      #3
      I resolved the issue using limit orders. thank you, Chelsea.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by futurenow, 12-06-2021, 05:49 PM
      18 responses
      879 views
      0 likes
      Last Post dj0ntz
      by dj0ntz
       
      Started by nailz420, 05-14-2025, 09:14 AM
      1 response
      117 views
      0 likes
      Last Post NinjaTrader_ChristopherJ  
      Started by NinjaTrader_Brett, 05-12-2025, 03:19 PM
      0 responses
      525 views
      1 like
      Last Post NinjaTrader_Brett  
      Started by domjabs, 05-12-2025, 01:55 PM
      2 responses
      84 views
      0 likes
      Last Post domjabs
      by domjabs
       
      Started by Morning Cup Of Trades, 05-12-2025, 11:50 AM
      1 response
      123 views
      0 likes
      Last Post NinjaTrader_ChristopherJ  
      Working...
      X