Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Value variable in Ninja C#

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

    Value variable in Ninja C#

    Dear All,

    I observed that in SMA system indicator script, there is a variable by the name of Value, which is populated using Set method.


    But this variable Value wasn't declared anywhere. This was SMA indicator of Ninja Trader


    So what am confused about is that how come this is Value variable is working when it hasn't been declared ?

    #2
    Which value would you see when you print the content then? The internal dummy Close[0] value if you didn't expicitly set a value? That would be expected then.

    Comment


      #3
      So what I want to know is that I couldn't see declaration of this variable Value

      Is it internally defined? And it available to use?

      Also another Series Array Input[ ] takes by default what and how is that default value passed to it.

      In the script of SMA, I saw that it is taking Closing price as the value

      Comment


        #4
        Correct, it would be internally defined and could not be changing. Typically best practice would be setting a value for each bar or checking for .ContainsValue - http://www.ninjatrader.com/support/h...sub=DataSeries

        Input would be per default the Close, but could be any NT pricetype from the UI if PriceTypeSupported is set to true - http://www.ninjatrader.com/support/h...lightsub=input

        Comment


          #5
          Ok! So although Input[ ] used Close as default, we can change it to High or Low by using PriceType?

          Because in the SMA I didn't see PriceType Statement, it would mean that Input[ ] never got explicitly defined as anything. So it took default as Closing Price.

          Correct?

          Comment


            #6
            Correct, if nothing is defined or changed it would be the Close.

            The SMA has two overloads you would call it by (just like any other indicator), one would be with the IDataSeries as input the other without...

            Comment


              #7
              Also I checked RSI function. It has calculated RSI from basics

              But what if I want to apply RSI on Volume or other things? Isn't there built in method of RSI?

              Like iRSI in MQL4

              Although I can probably put the RSI logic in the function and call it but though if there is one, it would be great

              Comment


                #8
                RSI is an indicator as well, just use the overload that would offer to get a IDataSeries of your choice passed in i.e.

                double testRSIVal = RSI(Volume, 10, 2)[0];

                Comment


                  #9
                  Man, you are too good :-)

                  Thanks a ton. I will ask more questions if required :-)

                  Thanks a ton again

                  Comment

                  Latest Posts

                  Collapse

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