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

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.


    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Great!
      Thanks!

      Topic can be closed.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by DynamicTest, Yesterday, 11:58 PM
      1 response
      7 views
      0 likes
      Last Post DynamicTest  
      Started by steve257, 12-20-2023, 05:32 AM
      5 responses
      436 views
      0 likes
      Last Post Nothinox  
      Started by javaburnaus, Today, 01:51 AM
      0 responses
      2 views
      0 likes
      Last Post javaburnaus  
      Started by XanderT, Today, 01:27 AM
      0 responses
      5 views
      0 likes
      Last Post XanderT
      by XanderT
       
      Started by anton_tymoshchuk, Today, 01:14 AM
      0 responses
      10 views
      0 likes
      Last Post anton_tymoshchuk  
      Working...
      X