Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Calling functions from externally stored classes

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

    Calling functions from externally stored classes

    Hi

    I have noticed that some indicator scripts I have downloaded from this site often come as a package containing a number of files. The main dot-CS file and then several which are prefixed by an @ symbol.

    It looks very much like the authors are drawing upon functions from other scripts within their own. What I can not see in the code however is a Using declaration I thought would be required to attach another class to your script?

    Can someone please explain how external classes are used within your code, and what the @files do.

    Kind regards

    Duncan

    #2
    Hello,

    Thanks for writing in today.

    The files beginning with the symbol "@" are system indicators that have been included with the exported NinjaScript.

    Indicators can reference other indicators so long as the dependency is included at NinjaScript compile-time. No other reference is needed. NinjaTrader includes all dependencies with the exported indicator, so system indicators get bundled as well.

    Please let me know if you have any other questions.

    Comment


      #3
      Jim

      Your answer goes some way to my understanding but not completely.

      Here is an example. I downloaded the indicator dsFibConfuence, and along with the main CS came the file @ZigZag.cs.

      There is no Using Declaration in dsFibConfuence but there is a line of code which is clearly calling functions from within ZigZag.

      int highzz = ZigZag(Close, DeviationType.Percent, LargeDeviation, false).HighBar (0, 1, 150);
      Reading through ZigZag I can see DeviationType.Percentage is the function being called from within the ZigZag script.

      As ZigZag is not to my knowledge a system script, can you explain the connection between dsFibConfuence.cs and @ZigZag.cs

      Kind regards

      Duncan

      Comment


        #4
        Hello EastLondonKiwi,

        Thanks for writing back.

        ZigZag is in fact a bundled system indicator. You can observe all of the system indicators in the directory: "Documents\NinjaTrader 8\bin\Custom\Indicators"

        Bear in mind, some indicators from third parties have old indicators referenced in the import file. When NinjaTrader 8 asks about overwriting them, I would suggest clicking 'No', otherwise you could run into import errors.

        Please let me know if I may clear anything up.

        Comment


          #5
          Jim Ok I accept ZigZAG may be part of the system.

          Can you however explain what this syntax [QUOTE]]int highzz = ZigZag(Close, DeviationType.Percent, LargeDeviation, false).HighBar (0, 1, 150);[/QUOTE is doing and how the function call works, and why this author has not needed to use the Using Declaration?

          Kind regards

          Duncan

          Comment


            #6
            Hello EastLondonKiwi,

            int highzz = ZigZag(Close, DeviationType.Percent, LargeDeviation, false).HighBar (0, 1, 150);
            This line sets an integer value to higzz, returned from ZigZag().

            We may reference the help documentation on how ZigZag is used:


            Since we are calling ZigZag with 4 arguments and are providing barsAgo, instance, and lookBackPeriod, the following syntax will be used:

            ZigZag(ISeries<double> input, DeviationType deviationType, double deviationValue, bool useHighLow).HighBar(int barsAgo, int instance, int lookBackPeriod)
            ZigZag will return "Bars Ago" as outlined in the help documentation.

            Since all NinjaScripts are compiled when any NinjaScript is compiled, all external references are available for that indicator without the need of adding declarations.

            Comment


              #7
              Thanks Jim very helpful

              I'll take a look at the help guide for Zigzag, to see what else is useful for me.

              Kind regards

              Duncan

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
              0 responses
              558 views
              0 likes
              Last Post Geovanny Suaza  
              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
              0 responses
              324 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
              545 views
              1 like
              Last Post Geovanny Suaza  
              Started by RFrosty, 01-28-2026, 06:49 PM
              0 responses
              547 views
              1 like
              Last Post RFrosty
              by RFrosty
               
              Working...
              X