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 judysamnt7, 03-13-2023, 09:11 AM
      4 responses
      59 views
      0 likes
      Last Post DynamicTest  
      Started by ScottWalsh, Today, 06:52 PM
      4 responses
      36 views
      0 likes
      Last Post ScottWalsh  
      Started by olisav57, Today, 07:39 PM
      0 responses
      7 views
      0 likes
      Last Post olisav57  
      Started by trilliantrader, Today, 03:01 PM
      2 responses
      21 views
      0 likes
      Last Post helpwanted  
      Started by cre8able, Today, 07:24 PM
      0 responses
      10 views
      0 likes
      Last Post cre8able  
      Working...
      X