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

MIN and MAX

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

    MIN and MAX

    I am using MIN(3)[0] and MAX(3)[0] in my Strategy and it seems it is not placing them in the right spot. If 0 is the bar that just opened and 1 was the bar that just closed and on which the calculation was done then I do not see the stops being placed at high/low of Bar 3.
    Thank you.
    Attached Files

    #2
    Hello Trader17.

    Thanks for the post.

    I would advise confirming that the MIN and MAX methods are outputting the correct value. I have attached a script that demonstrates simple debugging of this.

    You might want to evaluate the maximum high in the High series and the minimum low in the Low series. You can do that like so:

    Code:
    Print("The maximum price 3 bars ago was " + MAX(High,3)[0]);
    Print("");
    Print("The minimum price 3 bars ago was " + MIN(Low,3)[0]);
    Please let me know if you have any questions.
    Attached Files
    Last edited by NinjaTrader_ChrisL; 10-25-2018, 02:10 PM.
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      Maybe I am using the wrong indicator. I do not want to the minimum 3 bars ago, rather I want the highest high or lowest low of the last X bars. So MIN and MAX look for a specific number bar ho or lo, correct? I want the highest or lowest in a series of bars.
      Thank you.

      Comment


        #4
        Hello Trader17,

        I added that as an addendum to my last post. You can pass in the Low or High series into the Min or Max functions.

        Code:
        Print("The maximum price 3 bars ago was " + MAX(High,3)[0]);
        Print("");
        Print("The minimum price 3 bars ago was " + MIN(Low,3)[0]);
        Please let me know if I can assist further.
        Chris L.NinjaTrader Customer Service

        Comment


          #5
          Thank you very much. And I just realized that I could also probably use the Donchian Channel in the stop as an indicator because it achieves similar outcome. Am I right? Either I pass the Low or High series in the MIN or MAX functions or use the Donchian Channel.
          Thank you.
          Last edited by Trader17; 10-25-2018, 06:31 PM.

          Comment


            #6
            Hello Trader17,

            Thank you for the reply.

            You could use the Donchain Channel since it gives the highest highs and lowest lows of a selected period.

            Please let me know if I can assist further.
            Chris L.NinjaTrader Customer Service

            Comment


              #7
              Got it. Thank you very much.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by andrewtrades, Today, 04:57 PM
              1 response
              8 views
              0 likes
              Last Post NinjaTrader_Manfred  
              Started by chbruno, Today, 04:10 PM
              0 responses
              5 views
              0 likes
              Last Post chbruno
              by chbruno
               
              Started by josh18955, 03-25-2023, 11:16 AM
              6 responses
              436 views
              0 likes
              Last Post Delerium  
              Started by FAQtrader, Today, 03:35 PM
              0 responses
              7 views
              0 likes
              Last Post FAQtrader  
              Started by rocketman7, Today, 09:41 AM
              5 responses
              19 views
              0 likes
              Last Post NinjaTrader_Jesse  
              Working...
              X