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

Substituting Onbarupdate

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

    Substituting Onbarupdate

    Is it possible to delete :
    protected override void OnBarUpdate()

    Then from a timer in OnMarketdepth, run something, not a function but something that runs code, so I don't have to run every incoming tick for onbarupdate?

    Tinkerz

    protected override void OnMarketDepth(MarketDepthEventArgs e)
    {
    if (Timecounter<DateTime.Now.TimeOfDay.TotalMilliseco nds)
    {
    Timecounter= (DateTime.Now.AddMilliseconds(500).TimeOfDay.Total Milliseconds);

    TriggerUpdate
    }
    }


    protected override void TriggerUpdate()
    {
    ///was OnBarUpdate() now a timed loop
    }

    #2
    Hello Tinkerz,

    You will not be able to delete OnBarUpdate(), but can leave it empty if you don't want any processing during this event. The event will still happen even if there is no code to execute.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      ok thanks I have to leave it in,

      Can I still call another event like i suggested?

      Comment


        #4
        Yes, you can have custom events. See the reference sample below for help with this:
        Using custom events to output the current Level II data book
        Ryan M.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by philmg, Today, 12:55 PM
        0 responses
        3 views
        0 likes
        Last Post philmg
        by philmg
         
        Started by Russ Moreland, Today, 12:54 PM
        0 responses
        2 views
        0 likes
        Last Post Russ Moreland  
        Started by f.saeidi, Today, 12:14 PM
        2 responses
        6 views
        0 likes
        Last Post f.saeidi  
        Started by TradeForge, 04-19-2024, 02:09 AM
        2 responses
        30 views
        0 likes
        Last Post TradeForge  
        Started by aprilfool, 12-03-2022, 03:01 PM
        3 responses
        327 views
        0 likes
        Last Post NinjaTrader_Adrian  
        Working...
        X