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

Making an update once per interval

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

    Making an update once per interval

    I have an algorithm that picks the value of a moving average for its entry point. It does great. As volatility swings the MA around during that bar, it submits a new order as the bar updates. I'm checking the log and seeing probably 20 or 30 order updates per second. While that's cool and how awesome algorithms should work, is there a way to make the order update process happen once per time interval? Like once per second.

    varInterval = 1 (second)

    Something like
    if time = time + varInterval
    enterlonglimit = moving average

    [syntax obviously not correct just laying out logic flow]

    The issue is that I'm having my algorithm and NT8 just "poop its pants" and starts to say there's an order but not. Then sync changes to false. The whole day is wasted because at Market Open + 30 seconds NT8 Desktop couldn't handle the order flow. I'm wondering if this will help at all or if NT8 has the capacity to handle this sort of load.

    #2
    Hello alphatango,

    Thank you for your post.

    OnOrderUpdate() is called every time an order changes state:


    If you currently have your order updating on each tick or each change of price, then it would be expected to have potentially frequent updates depending on the price action. With your example of varInterval, you could likely do something like create an int and use that in comparisons of ToTime(DateTime time):


    What type of data series are the orders being submitted on? Is it just the primary series or do you have a specific added series that they are submitted to? You could consider ToTime(Time[0]) to get the int value representing the timestamp of the current bar, but if you are using something like 1 minute bars than the timestamp would only change for each new 1 minute bar. If you are submitting orders to a more granular series, such as 1 tick, then using ToTime(Time[0]) could work to check if a specified minimum number of seconds has passed. Otherwise, you may need to consider using DateTime.Now which offers the current system time but wouldn't be useful in historical processing. Please provide a snippet of your code so I may better understand and assist you with a simple example.

    I look forward to your reply.
    Emily C.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by jxs_xrj, 01-12-2020, 09:49 AM
    5 responses
    3,290 views
    1 like
    Last Post jgualdronc  
    Started by Touch-Ups, Today, 10:36 AM
    0 responses
    7 views
    0 likes
    Last Post Touch-Ups  
    Started by geddyisodin, 04-25-2024, 05:20 AM
    8 responses
    61 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Started by Option Whisperer, Today, 09:55 AM
    0 responses
    8 views
    0 likes
    Last Post Option Whisperer  
    Started by halgo_boulder, 04-20-2024, 08:44 AM
    2 responses
    24 views
    0 likes
    Last Post halgo_boulder  
    Working...
    X