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

Comparing Plot Values

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

    Comparing Plot Values

    Hi,

    Suppose I wish to compare the current plot value to the value of the plot 1 bar ago. This is easy to do. My question is: Is there a default value that can be used on the very first bar so we don't need a workaround?

    So I want to use:

    myPlot.Set (Math.Max(Value[1], High[0]));

    #2
    Hello Zeos6,

    I am not quite sure what it is that you are trying to accomplish here. I believe you are trying to find the Highest High value since the beginning of the Data Series. If so, then you can use the HighestBar() method to return this value. You may see our Help Guide below for more information and an example on this.
    JCNinjaTrader Customer Service

    Comment


      #3
      Hi JC,

      No I am not. I thought I was very clear. I want to know if there is a default value for Value that can be used for comparison purposes when comparing a current plot value to the previous plot value. Clearly on the very first bar there is no previous plot value.

      Comment


        #4
        Hello Zeos6,

        Value[1] or myPlot[1] would be the best way to reference the previous value to use for comparison.

        If you do not want to check the value on the bar, you may check the CurrentBar to not have to calculate this. For Example:

        Code:
        if (CurrentBar < 1)
            return;
        Here is a link to our Help Guide that goes over CurrentBar in detail and gives another example that you may view.



        Let us know if we can be of further assistance.
        JCNinjaTrader Customer Service

        Comment


          #5
          I figured this but I wanted to see if there is a default value, say double.MinValue etc automatically provided. Thanks for your answer.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by DJ888, Yesterday, 10:57 PM
          0 responses
          6 views
          0 likes
          Last Post DJ888
          by DJ888
           
          Started by MacDad, 02-25-2024, 11:48 PM
          7 responses
          158 views
          0 likes
          Last Post loganjarosz123  
          Started by Belfortbucks, Yesterday, 09:29 PM
          0 responses
          7 views
          0 likes
          Last Post Belfortbucks  
          Started by zstheorist, Yesterday, 07:52 PM
          0 responses
          7 views
          0 likes
          Last Post zstheorist  
          Started by pmachiraju, 11-01-2023, 04:46 AM
          8 responses
          151 views
          0 likes
          Last Post rehmans
          by rehmans
           
          Working...
          X