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

Set indicator value of previous bar

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

    Set indicator value of previous bar

    When ploting on a chart the value of the primary plot, I use the command:

    Values[0].Set("somevalue");

    to plot the value "somevalue" at the current bar. How can I modify the value of the indicator one bar ago? I tried something like the logic applied to other commands where first is the plot reference and then the bar number:

    Values[0][1].Set("somevalue");

    But the compiler says this command is wrong.
    Sometimes I want to change the value plot of the indicator some bars ago. It is not always the same bar ago. Sometimes it is one bar ago and sometimes two bars ago. How can I change the plotted value?

    Thank you

    #2
    Hello bonnies,

    Below is a link to the help guide on the DataSeries class.


    DataSeries.Set(int barsAgo, double value)
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thank you for your answer Chelsea. I know that with the DataSeries class I can alter the value of it at any bar number. But, how can I plot it too? I mean I alter the value of the new dataseries 10 bars ago. How can I plot this new value of the indicator in the chart?

      Thank you.

      Comment


        #4
        Hello bonnies,

        A plot (Value) is a dataseries.

        Set the plot and this will be how it appears on the chart.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          I am sorry but I don't understand how to do it. I have read the "SampleSyncSecondarySeries" and "SampleBoolSeries" but any of these examples change the value plotted previously on the chart.
          Could you provide some example, please?

          Comment


            #6
            Hello bonnies,

            To set a plot 5 bars ago to the value of 100.

            Value.Set(5, 100);
            Chelsea B.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by ZenCortexCLICK, Today, 04:58 AM
            0 responses
            2 views
            0 likes
            Last Post ZenCortexCLICK  
            Started by sidlercom80, 10-28-2023, 08:49 AM
            172 responses
            2,280 views
            0 likes
            Last Post sidlercom80  
            Started by Irukandji, Yesterday, 02:53 AM
            2 responses
            17 views
            0 likes
            Last Post Irukandji  
            Started by adeelshahzad, Today, 03:54 AM
            0 responses
            4 views
            0 likes
            Last Post adeelshahzad  
            Started by Barry Milan, Yesterday, 10:35 PM
            3 responses
            13 views
            0 likes
            Last Post NinjaTrader_Manfred  
            Working...
            X