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

OnMarketData - Get current bar indicator value in stategy

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

    OnMarketData - Get current bar indicator value in stategy

    I am trying to get the changing value for an indicator in the OnMarketData event. It appears the [0] returns the previous bars value and not the bar being built. Is there a method to retrieve the current bars value of an indicator as the bar is being built?

    protected
    overridevoid OnMarketData(MarketDataEventArgs e)
    {
    ShowMsg("OnMarketUpdate " + ":" + Aroon(10).Up[0].ToString());

    I am using the MarketReplaceConnection when trying to retrieve the indicator value.



    #2
    Hello,

    This depends on the indicators CalculateOnBarClose setting.

    OnMarketData is not bound to the CalculateOnBarClose setting where the [0] BarsAgo would be.

    Using True, the Prior bars value would be used because that is the Current Close according to the COBC setting.

    Using False, the Building bars Last close price would be used instead.

    Just changing this you should see a difference, if your logic relies on COBC = true, you may need to look into FirstTickOfBar http://www.ninjatrader.com/support/h...=FirsTickOfBar

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Thank you, I had my CalculateOnBarClose logic set incorrectly. I changed it to: CalculateOnBarClose = false; and it works. I did not understand this setting.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Gerik, Today, 09:40 AM
      1 response
      6 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Started by RookieTrader, Today, 09:37 AM
      1 response
      10 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by alifarahani, Today, 09:40 AM
      0 responses
      5 views
      0 likes
      Last Post alifarahani  
      Started by KennyK, 05-29-2017, 02:02 AM
      3 responses
      1,284 views
      0 likes
      Last Post NinjaTrader_Clayton  
      Started by AttiM, 02-14-2024, 05:20 PM
      11 responses
      186 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Working...
      X