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 TraderBCL, Today, 04:38 AM
        0 responses
        2 views
        0 likes
        Last Post TraderBCL  
        Started by Radano, 06-10-2021, 01:40 AM
        19 responses
        606 views
        0 likes
        Last Post Radano
        by Radano
         
        Started by KenneGaray, Today, 03:48 AM
        0 responses
        4 views
        0 likes
        Last Post KenneGaray  
        Started by thanajo, 05-04-2021, 02:11 AM
        4 responses
        470 views
        0 likes
        Last Post tradingnasdaqprueba  
        Started by aa731, Today, 02:54 AM
        0 responses
        5 views
        0 likes
        Last Post aa731
        by aa731
         
        Working...
        X