Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

BarsUpdate event question

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

    BarsUpdate event question

    I'm trying to create a general purpose class that will allow me to pre-process a bunch of analyzes prior to the OnBarUpdate method being called (analyzes don't fit well as indicators as the results are not aligned with a Series<T> object). What is the best method of doing this?

    Sample of what I am trying to do.

    public class HelperClass
    {
    private NinjaScriptBase ninjaScriptBase;

    public HelperClass(NinjaScriptBase nsb)
    {
    ninjaScriptBase = nsb;
    ninjaScriptBase.Bars.BarsUpdate += Bars_BarsUpdate;
    }

    private void Bars_BarsUpdate(object sender, BarsUpdateEventArgs e)
    {
    /*** RUN MY ANALYSIS ***/
    }
    }

    Does the NinjaScriptBase class just loop through all the historical data ( i.e. calls the OnBarUpdate override method )? Then when the historical data is processed it cuts over to the realtime data and fires off the BarsUpdate? Should I do the same for my class?

    #2
    It appears to work as you suspect. Although there can be an active data subscription while processing realtime bars, BarsUpdate does not appear to be called while isRealTime is false. Your idea of iterating through historical bars before relying on BarsUpdate in your code sounds like the right way to go.
    Dave I.NinjaTrader Product Management

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by cre8able, Today, 01:16 PM
    1 response
    4 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Started by chbruno, 04-24-2024, 04:10 PM
    3 responses
    48 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Started by samish18, Today, 01:01 PM
    1 response
    6 views
    0 likes
    Last Post NinjaTrader_LuisH  
    Started by WHICKED, Today, 12:56 PM
    1 response
    8 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Started by WHICKED, Today, 12:45 PM
    1 response
    11 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Working...
    X