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

Second Higher Close after event

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

    Second Higher Close after event

    I'm testing for a second higher close after an EMA crossover. I've been trying to get this to work with the following with no success...
    PHP Code:
    Close[HighestBar(Close,5)] <= (Close[0] - 1*TickSize
    The "0" at approx. 9:59 on the screenshot indicates the first close at/after the crossover. The third candle (10:02) should then be able to indicate this higher close with a similar number. I've tested with a 1==1 in lieu of the code above to prove that the drawing works so the problem is in this code.
    It doesn't matter how soon I get the second higher close but I've used 5 for the lookback period. Am I missing something?

    Thanks for your help.

    Kirk
    Attached Files

    #2
    Okay,

    I've done some testing with "Print" and understand that the higher close will never be higher than the previous close using HighestBar since this doesn't hold the "previous" higher close but rather goes along with the higher close including the current bar. Now I need to know what code allows me to keep the previous high while the current bar is pushing beyond it.

    Hope that makes sense...

    kz

    Comment


      #3
      I might not fully understand but would this do what you want?

      MAX(Close, 5)[1] <= ....

      More information - http://www.ninjatrader-support.com/H...aximumMAX.html
      RayNinjaTrader Customer Service

      Comment


        #4
        Thanks, Ray,

        That did the trick!!

        Kirk

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by reynoldsn, Today, 02:34 PM
        0 responses
        6 views
        0 likes
        Last Post reynoldsn  
        Started by nightstalker, Today, 02:05 PM
        0 responses
        9 views
        0 likes
        Last Post nightstalker  
        Started by llanqui, Yesterday, 09:59 AM
        8 responses
        28 views
        0 likes
        Last Post llanqui
        by llanqui
         
        Started by quicksandatl, Today, 01:39 PM
        1 response
        6 views
        0 likes
        Last Post quicksandatl  
        Started by md4866, 05-01-2024, 08:15 PM
        2 responses
        18 views
        0 likes
        Last Post md4866
        by md4866
         
        Working...
        X