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

Know the SMA value of a new time

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

    Know the SMA value of a new time

    Hello friends.

    In a 5 minute chart....


    I declare the new time in Initialize() method as it:

    protected override void Initialize(){
    Add(PeriodType.Minute, 10);
    }


    Now i want to now the SMA(14) value. In normal way i get as it:

    double myValue= SMA(14);


    I want to know the value of SMA(14) in 10 minutes time, How can i get?

    Thank you

    #2
    Hello marynja,

    You would want to use the BarsArray to be able to tell the SMA which Data Series you would like to get the value of the SMA. For example:

    Code:
    Print("SMA of 5 Min = "+SMA(BarsArray[0], 14)[0]);
    Print("SMA of 10 Min = "+SMA(BarsArray[1], 14)[0]);
    You may also read more about this at the following link to our Help Guide.
    JCNinjaTrader Customer Service

    Comment


      #3
      Thank you so much.

      And, its possible to draw a indicator value in original chart time?

      I draw the SMA of 5 minute as it:

      Add(SMA(100));

      How could i draw the SMA for 10 minutes?

      I tried this, but dont work:

      protected override void Initialize(){
      Add(PeriodType.Minute, 10);
      Add(SMA(100));
      Add(SMA(BarsArray[1], 100));
      }

      Comment


        #4
        Hello marynja,

        You would only be able to do that if you are working with a Strategy. Inside of another Indicator, you would have to set the value of a plot to the Indicators values manually.
        Example:
        Code:
        Plot2.Set(SMA(BarsArray[1], 14)[0]);
        JCNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Jonafare, 12-06-2012, 03:48 PM
        5 responses
        3,986 views
        0 likes
        Last Post rene69851  
        Started by Fitspressorest, Today, 01:38 PM
        0 responses
        2 views
        0 likes
        Last Post Fitspressorest  
        Started by Jonker, Today, 01:19 PM
        0 responses
        2 views
        0 likes
        Last Post Jonker
        by Jonker
         
        Started by futtrader, Today, 01:16 PM
        0 responses
        8 views
        0 likes
        Last Post futtrader  
        Started by Segwin, 05-07-2018, 02:15 PM
        14 responses
        1,792 views
        0 likes
        Last Post aligator  
        Working...
        X