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 Hwop38, 05-04-2026, 07:02 PM
              0 responses
              161 views
              0 likes
              Last Post Hwop38
              by Hwop38
               
              Started by CaptainJack, 04-24-2026, 11:07 PM
              0 responses
              308 views
              0 likes
              Last Post CaptainJack  
              Started by Mindset, 04-21-2026, 06:46 AM
              0 responses
              245 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Started by M4ndoo, 04-20-2026, 05:21 PM
              0 responses
              349 views
              0 likes
              Last Post M4ndoo
              by M4ndoo
               
              Started by M4ndoo, 04-19-2026, 05:54 PM
              0 responses
              179 views
              0 likes
              Last Post M4ndoo
              by M4ndoo
               
              Working...
              X