Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

initialize and onstarup

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

    initialize and onstarup

    I am using the indicator OHLC to get yesterdays values. On Initialize the strategy will not activate and if I call the OHLC on onstartup method i get zero values. It will work in on bar update. I just need to get the values once not every bar. what do I do?

    #2
    Hello ballboy, and thank you for your question. It sounds like you are trying to get at this indicator's data before it has data in it. You may need to tweak this code sample to fit your code, but I believe this will resolve your query.

    Code:
    [FONT=Courier New]
    protected override void OnBarUpdate()
    {
      foreach(int CurrentBarForSeries in CurrentBars)
      {
        if (CurrentBarForSeries < 1)
        {
          return;
        }
      }
    
      // the rest of your OnBarUpdate code goes here
    }[/FONT]
    Please let us know if it does not, or if there are any other ways we can help.
    Jessica P.NinjaTrader Customer Service

    Comment


      #3
      Thank you it works perfectly

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Mindset, 04-21-2026, 06:46 AM
      0 responses
      117 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      166 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      85 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by cmoran13, 04-16-2026, 01:02 PM
      0 responses
      130 views
      0 likes
      Last Post cmoran13  
      Started by PaulMohn, 04-10-2026, 11:11 AM
      0 responses
      88 views
      0 likes
      Last Post PaulMohn  
      Working...
      X