Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Question on embedding an indicator

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

    Question on embedding an indicator

    Hello,


    I have an indicator that tallies a score based on certain pricing conditions. Every bar gets a score, which I display in a histogram. I decided to test the indicator by changing it's "Input series" from ES 06-13 (100 Tick) to the SMA indicator ... SMA(ES 06-13 (100 Tick),14) to be exact. The outcome was that my scores were averaged, giving me better results. Now I am trying to figure out how to code my indicator so I can effectively achieve the same results from within NinjaScript.

    In my program my scoring is stored in a DataSeries object, which I call "netScore". I don't know how to run netScore through the SMA within NinjaScript to generate an averaged netScore. I've tried several structures, including netScore(SMA(14)[0] but I cannot get it to work.



    And direction/advice is greatly appreciated!

    #2
    pman777, what exact issue do you get then? A compile error?

    Your indicator would expect a series input, so netScore(SMA(14)) should work compiling.

    Comment


      #3
      thanks for reply ... I get a compiler error "'netScore' is a 'field' but is used like a 'method'"

      Comment


        #4
        Which exact call are you attempting to use here? What would Intellisense expect as parameters passed in?

        Comment


          #5
          Here's my code:

          netHistoScores.Set (netScore);
          avgScore = (netHistoScores(SMA(14))[0]);

          Comment


            #6
            I would not expect that to work, as you're just setting a custom series with values here in your indicator. To pass another base series into the indicator you would need to call the indicator itself and not the internal series.

            Comment


              #7
              Originally posted by pman777 View Post
              Here's my code:

              netHistoScores.Set (netScore);
              avgScore = (netHistoScores(SMA(14))[0]);
              If you are looking for the average score, your syntax is incorrect.
              Code:
               
              double avgScore = SMA(netHistoScores, 14)[0];

              Comment

              Latest Posts

              Collapse

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