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

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.
    BertrandNinjaTrader Customer Service

    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?
        BertrandNinjaTrader Customer Service

        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.
            BertrandNinjaTrader Customer Service

            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 cmtjoancolmenero, Yesterday, 03:58 PM
              1 response
              17 views
              0 likes
              Last Post NinjaTrader_Gaby  
              Started by benmarkal, Yesterday, 12:52 PM
              3 responses
              23 views
              0 likes
              Last Post NinjaTrader_Gaby  
              Started by helpwanted, Today, 03:06 AM
              1 response
              19 views
              0 likes
              Last Post sarafuenonly123  
              Started by Brevo, Today, 01:45 AM
              0 responses
              11 views
              0 likes
              Last Post Brevo
              by Brevo
               
              Started by pvincent, 06-23-2022, 12:53 PM
              14 responses
              244 views
              0 likes
              Last Post Nyman
              by Nyman
               
              Working...
              X