Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Ordering at every single tick error

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

    Ordering at every single tick error

    I made an example of what I am facing. I use ticks in my strategy along side minutes. But when the code is run, it buys at every single tick. Can someone tell me my error?

    This is an example code of when the error occurs. I attached a code example which I exported. Let me know if you can help!

    It has something to do with the ticks I assume. Just don't know how to get around it!

    This code for example buys 78 times in one place. When it should only buy once!
    Attached Files

    #2
    Hello,

    You have nothing filtering your order from trading every time one of your Bar Series is updated. You may also consider using the Managed approach as I'm not seeing anything right away that requires you to use the Unmanaged Approach.

    You'll want to read this for filtering the different series: http://www.ninjatrader.com/support/h...nstruments.htm

    For order methods: http://www.ninjatrader.com/support/h...er_methods.htm

    Your NinjaScript / C# Code will always be logically processed and evaluate according to your set logic – this can of course lead to unexpected results at times, thus we would suggest to simplify and debug your code to better understand the event sequence it would go through - unfortunately we cannot offer such debug or code modification services here, but please see the provided resources below to help you proceed productively :

    First of all you would want to use Print() statements to verify values are what you expect - Debugging your NinjaScript code.

    For strategies add TraceOrders = true to your Initialize() method and you can then view valuable output related to strategy submitted orders through Tools > Output window - TraceOrders

    It may also help to add drawing objects to your chart for signal and condition confirmation - Drawing Objects.

    If you would prefer the debug assist of a professional NinjaScript consultant, please check into the following listings - Click here for a list of certified NinjaScript Consultants
    LanceNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    634 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    364 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    105 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    567 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    568 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X