Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Simple SMA of a custom indicator not working

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

    Simple SMA of a custom indicator not working

    Hi, I am trying to take a SMA of a custom indicator while creating a second cusom indicator. I am using the following statement in ninja script sma_compare = SMA(Zcustom(),Length), where Zcustom is a custom indicator. But it is not working. Please help.

    #2
    Hello stratfreak,

    If you print Zcustom() is this showing a value?

    Print(Zcustom()[0]);

    Are you seeing errors on the Log tab of the Control Center?
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hi,
      The log does not show anything (see attachment). I have attached a chart excerpt that shows the custom indicator is getting drawn correctly. The name of the custom indicator is test. But for some reason I cannot access to create its SMA in another custom indicator.

      Regards,
      Attached Files

      Comment


        #4
        Hello stratfreak,

        I'm not certain I'm fully understanding.

        You have shown an error in the log that would completely this script from running.
        However you are stating the log does not show anything.

        The script is called test, and the fatal error occurred with test.

        Is this a new blank test script that just prints the value of Zcustom() with no other code?
        May I confirm this script does not call AddDataSeries() anywhere in the code?

        If you make a second test script and once again only print the value of Zcustom() is the new test script also affected?

        Does Zcustom() call AddDataSeries()?
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Yes, I am adding two statements with add data series in zcustom() . Zcustom word was just used as an example. The actual name is test.

          Comment


            #6
            Hello stratfreak,

            Do you see the error in the log about AddDataSeries()?

            'test' tried to load additional data. All data must first be loaded by the hosting NinjaScript in its configure state.

            This a fatal error that will prevent the script from running.

            Have you followed the directions in the error?

            From the help guide:
            "Should your script be the host for other scripts that are creating indicators and series dependent resources in State.DataLoaded, please make sure that the host is doing the same AddDataSeries() calls as those hosted scripts would. For further reference, please also review the 2nd example below and the 'Adding additional Bars Objects to NinjaScript' section in Multi-Time Frame & Instruments"


            Is the host scripts adding the same data series?
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              I did as you suggested and it worked! Thanks!

              Comment

              Latest Posts

              Collapse

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