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

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

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

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

            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];
                BertrandNinjaTrader Customer Service

                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 Barry Milan, Yesterday, 10:35 PM
                  5 responses
                  16 views
                  0 likes
                  Last Post NinjaTrader_Manfred  
                  Started by DanielSanMartin, Yesterday, 02:37 PM
                  2 responses
                  13 views
                  0 likes
                  Last Post DanielSanMartin  
                  Started by DJ888, 04-16-2024, 06:09 PM
                  4 responses
                  12 views
                  0 likes
                  Last Post DJ888
                  by DJ888
                   
                  Started by terofs, Today, 04:18 PM
                  0 responses
                  11 views
                  0 likes
                  Last Post terofs
                  by terofs
                   
                  Started by nandhumca, Today, 03:41 PM
                  0 responses
                  8 views
                  0 likes
                  Last Post nandhumca  
                  Working...
                  X