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 RookieTrader, Today, 09:37 AM
            3 responses
            15 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by kulwinder73, Today, 10:31 AM
            0 responses
            5 views
            0 likes
            Last Post kulwinder73  
            Started by terofs, Yesterday, 04:18 PM
            1 response
            23 views
            0 likes
            Last Post terofs
            by terofs
             
            Started by CommonWhale, Today, 09:55 AM
            1 response
            4 views
            0 likes
            Last Post NinjaTrader_Erick  
            Started by Gerik, Today, 09:40 AM
            2 responses
            7 views
            0 likes
            Last Post Gerik
            by Gerik
             
            Working...
            X