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

Subscribing another class to BarUpdates

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

    Subscribing another class to BarUpdates

    Hey there.

    I've got a dependent class which needs to know about BarUpdate events.

    I found the _ninjaScriptBase.Bars.BarUpdate event

    and have subscribed to this event. The event fires for realtime updates but not during historical data processing.

    How can I get these updates for historical data too? I want this event to fire any time the indicators OnBarUpdate event is called; which includes historical data.

    I've attached a small indicator to demonstrate what I'm trying to do.

    Thanks

    Kevin.
    Attached Files

    #2
    Hello Kevin,

    Thank you for your post.

    Why not just call the function in OnBarUpdate()?

    To grab historical bars you use BarsRequest: http://ninjatrader.com/support/helpG...arsrequest.htm

    Please let me know if you have any questions.

    Comment


      #3
      Originally posted by NinjaTrader_PatrickH View Post
      Hello Kevin,

      Why not just call the function in OnBarUpdate()?
      In my job as Lead Solution Architect in a Financial Software house I've got a reputation for yelling "S.R.P" to my developers. Its the first principle of SOLID design and stands for Single Responsibility Principle. I'd rather not have everything lumped into the OnBarUpdate method, so as to practice what I preach: If they checked-in a class that had over 500 lines or methods that have over 50 lines I would reject it as an SRP violation and ask them to refactor it. To be honest I think lately they've started deliberately provoking me to see who can get me to say it first.

      Anyway.... I have many instances of my class that needs to know about bar updates so I'd rather they managed their own concerns when this happens. I will figure something out.

      thank you!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by bortz, 11-06-2023, 08:04 AM
      47 responses
      1,606 views
      0 likes
      Last Post aligator  
      Started by jaybedreamin, Today, 05:56 PM
      0 responses
      8 views
      0 likes
      Last Post jaybedreamin  
      Started by DJ888, 04-16-2024, 06:09 PM
      6 responses
      18 views
      0 likes
      Last Post DJ888
      by DJ888
       
      Started by Jon17, Today, 04:33 PM
      0 responses
      4 views
      0 likes
      Last Post Jon17
      by Jon17
       
      Started by Javierw.ok, Today, 04:12 PM
      0 responses
      13 views
      0 likes
      Last Post Javierw.ok  
      Working...
      X