• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

KeyReversal and MACD value

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

    KeyReversal and MACD value

    The keyreversal will evaluate the hi/lo of nbarsago. It will == 1 if a reversal is present.
    Is there a way to capyure how many bars ago that the prior hi/lo occurred?
    When ==1 I want to determine the stoch or macd value at the time of nbarsago to compare to the current value.
    Thank you,
    Duke

    #2
    Hello dukeb,

    You can use the MAX() and MIN() functions to be able to calculate the highest and lowest value over a specified period and return the number of bars ago.

    MAX: http://www.ninjatrader.com/support/h...aximum_max.htm

    MIN: http://www.ninjatrader.com/support/h...inimum_min.htm

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

    Comment


      #3
      Thank you... really appreciated..
      Duke

      Comment


        #4
        Code Syntax

        I have attached some code. Please see the screen shot for the eror codes.
        Thank you,
        Duke
        Attached Files

        Comment


          #5
          Hello dukeb,

          NinjaScript is case sensitive so MAX() function needs to be all capitalized as well as the MIN() function.


          Here is a link to our support forums that goes over how to debug your code which comes in handy if you run into a compiling errors when writing custom code as well.
          http://www.ninjatrader.com/support/f...ead.php?t=3418

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

          Comment


            #6
            Originally posted by NinjaTrader_JC View Post
            Hello dukeb,

            NinjaScript is case sensitive so MAX() function needs to be all capitalized as well as the MIN() function.


            Here is a link to our support forums that goes over how to debug your code which comes in handy if you run into a compiling errors when writing custom code as well.
            http://www.ninjatrader.com/support/f...ead.php?t=3418

            Let us know if we can be of further assistance.
            Thank you for your response. The attachment shows I have now capped MAX(). When I click on the first error it hightlights 'BarsArray' on the second line.
            When I click on the second error, it highlights '20' in the first line.
            It appears there is some kind of syntax issue that I am not seeing.
            Duke
            Attached Files

            Comment


              #7
              Hello dukeb,

              Could you remove the brackets after the 20, as the brackets will only be used for an array and 20 is only an integer. See the forum post below for more information using brackets [].

              http://www.ninjatrader.com/support/f...ad.php?t=19346

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

              Comment


                #8
                Originally posted by dukeb View Post
                Thank you for your response. The attachment shows I have now capped MAX(). When I click on the first error it hightlights 'BarsArray' on the second line.
                When I click on the second error, it highlights '20' in the first line.
                It appears there is some kind of syntax issue that I am not seeing.
                Duke
                "20" is an integer. 20[0] does not make sense to the compiler, (nor to a human ) You cannot index an integer.

                Comment


                  #9
                  Thank you .... in retrospect this seems rather obvious.

                  Comment


                    #10
                    I understand...
                    Thank you..

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by GMiller64, Today, 01:13 PM
                    3 responses
                    7 views
                    0 likes
                    Last Post GMiller64  
                    Started by itrader46, Today, 12:51 PM
                    4 responses
                    32 views
                    0 likes
                    Last Post itrader46  
                    Started by hemlock, Today, 11:45 AM
                    3 responses
                    9 views
                    0 likes
                    Last Post NinjaTrader_PatrickG  
                    Started by gbulle, Today, 11:31 AM
                    2 responses
                    7 views
                    0 likes
                    Last Post gbulle
                    by gbulle
                     
                    Started by JPPoulin, Today, 10:43 AM
                    6 responses
                    23 views
                    0 likes
                    Last Post JPPoulin  
                    Working...
                    X