Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Custom indicator not working

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

    Custom indicator not working

    Hi,

    I have designed the attached indicator and it doesn't work on main candles type, loaded by number of previous days. It works only if I load data by number of bars.
    And It doesn't work for the daily, weekly or monthly bars. I haven't tryed another types of date.

    Noob question: what to add in the code to work on daily, weekly, montly charts? And on the normal way of loading charts, by days, not by number of bars.


    Thanks for your help!
    Attached Files

    #2
    Hello nailui,

    Thanks for your post.

    When you apply an indicator to a chart and you do not see the expected results, the first check should be of the "Log" tab of the NinjaTrader Control Center. If an indicator generates a run time error, typically an error message will be sent to the Log tab but the indicator will not show in the chart.

    Looking at your coding, you will probably get "error on Calling OnBarUpdsate() on bar 0 "(zero). This will happen because your condition accesses the prior bar value [1] however when the script is applied it starts on the first bar (bar 0) and on the first bar there is no barsago of [1]. You can fix that by adding code to check if the CurrentBar is less than 1. CurrentBar is the systems bar counter and it holds the bar number of the bar being processed.
    Reference: https://ninjatrader.com/support/help...currentbar.htm

    When your current bars check is added I expect your script will work on all bars, regardless of bars or days to load.

    The indicator also add an indicator panel which if you do not need it you would turn off by setting IsOverLay = true in state.SetDefaults.


    Comment


      #3
      Great!
      Thanks!

      Topic can be closed.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      637 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      366 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      107 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      569 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      571 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X