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 usazencort, Today, 01:16 AM
              0 responses
              1 view
              0 likes
              Last Post usazencort  
              Started by kaywai, 09-01-2023, 08:44 PM
              5 responses
              602 views
              0 likes
              Last Post NinjaTrader_Jason  
              Started by xiinteractive, 04-09-2024, 08:08 AM
              6 responses
              22 views
              0 likes
              Last Post xiinteractive  
              Started by Pattontje, Yesterday, 02:10 PM
              2 responses
              20 views
              0 likes
              Last Post Pattontje  
              Started by flybuzz, 04-21-2024, 04:07 PM
              17 responses
              230 views
              0 likes
              Last Post TradingLoss  
              Working...
              X