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

Find the value most recent value

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

    Find the value most recent value

    I called in my program the zigzag indicator... (every so many points plots reversals)

    How do I find the value most 'recent excluding the current one?
    (the zigzag [1] is not correct because it gives me the same value of zigzag [0] because the plot is not always drawn)

    #2
    Originally posted by turbofib View Post
    I called in my program the zigzag indicator... (every so many points plots reversals)

    How do I find the value most 'recent excluding the current one?
    (the zigzag [1] is not correct because it gives me the same value of zigzag [0] because the plot is not always drawn)
    Do F1 search for MRO or Most Recent Occurance

    Comment


      #3
      Most Recent Occurance find the number of bar...not a value of bar..
      i want find value...
      i think MIN MAX is better for me

      thank you anyway

      Comment


        #4
        Hello Turbofib,

        Thank you for your post.

        Yes, MIN and MAX would be your best bet for this kind of calculation.
        Cal H.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by turbofib View Post
          Most Recent Occurance find the number of bar...not a value of bar..
          i want find value...
          i think MIN MAX is better for me

          thank you anyway
          No, MIN MAX will not do it, because you do not know your lookback length, a priori. Use MRO, and once you know the bar you are interested in, you can access its OHCL properties for whatever you want to do.

          Comment


            #6
            MRO=MRO(Condition condition, int instance, int lookBackPeriod)

            in this function you must put in lookbackperiod......then is similar MIN MAX function with the difference that this last give me the value directly

            Comment


              #7
              Originally posted by turbofib View Post
              MRO=MRO(Condition condition, int instance, int lookBackPeriod)

              in this function you must put in lookbackperiod......then is similar MIN MAX function with the difference that this last give me the value directly
              Yes, you must, but you can make it as long as the chart. It does not matter what lookback length one uses, because you will still always get the Most Recent Occurrence. That means that you just need to use a long enough lookback period to be sure that the event occurred at least once: you do not need an exact length.

              On the other hand, the values returned by MIN and MAX are entirely dependent on the lookback length, so that length must be known a priori.

              But do not let me put a wrench in your works. Code it as you wish: it is your code.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by wzgy0920, 04-20-2024, 06:09 PM
              2 responses
              26 views
              0 likes
              Last Post wzgy0920  
              Started by wzgy0920, 02-22-2024, 01:11 AM
              5 responses
              32 views
              0 likes
              Last Post wzgy0920  
              Started by wzgy0920, Yesterday, 09:53 PM
              2 responses
              49 views
              0 likes
              Last Post wzgy0920  
              Started by Kensonprib, 04-28-2021, 10:11 AM
              5 responses
              192 views
              0 likes
              Last Post Hasadafa  
              Started by GussJ, 03-04-2020, 03:11 PM
              11 responses
              3,234 views
              0 likes
              Last Post xiinteractive  
              Working...
              X