Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Input and Value

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

    Input and Value

    The Value[0] and Input[0] are used in the SMA indicator. What is the Input[0] here? Is it the Close of that bar? Is the Value[0] the return value for SMA? Also, there is no Series declared in the SMA indicator. How does the previous SMA values are stored? If it is stored in Values, does that means other indicators can not use Values any more? Thanks!

    #2
    Hello atrader,

    Thank you for your post.

    Value[0] would be the plot, so assigning some value to that would be assigning a value to the plot for the currently processing bar. This stores the SMA values.



    Input[0] simply means use whatever data series is specified. The SMA can use a price series, or an indicator plot to calculate, so that's why you don't see "Close[0]" or another price series specified.



    Please let us know if we may be of further assistance to you.

    Comment


      #3
      Hello Kate,

      Thank you so much for the response. I am trying to create a series of data associate with each bar, just like the High, Low, Open, Close. But I could not find the code for those, such as High. Can you provide a link with that information or give some sample codes? or I have to use Indicators to develop this? I do not need to show them on chart. That is why I am thinking something like High, Low might be more close to what I need?

      Thank you again!

      Comment


        #4
        Hello atrader,

        Thank you for your reply.

        It sounds like a custom Series<t> is what you're looking for. A custom series is basically just a variable with slots for each bar in the data series. Price series like High, Low, Open and Close are a series that automatically is filled for you, but you can make a custom series to store whatever you like on each bar.





        For example, I could instantiate my series at the class level, set it up in State.DataLoaded, and then assign

        Code:
        // instantiate a series to hold double values
        private Series<double> MySeries;
        
        
        //in OnStateChange
        else if (State == State.DataLoaded)
        {
        MySeries = new Series<double>(this, MaximumBarsLookBack.TwoHundredFiftySix);
        }
        
        // in OnBarUpdate
        
        // assign a value for the current bar
        MySeries[0] = High[0] + Low[0] / 2;
        
        // we can refer to prior values in the Series using bars ago values
        if (MySeries[0] > MySeries[1])
        {
        // do something
        }
        A more full fledged example is available in our help guide here:



        Please let us know if we may be of further assistance to you.

        Comment


          #5
          Hello Kate,

          That is all I need.

          Thank you so much!

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          648 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          369 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          108 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          572 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