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 timko, Today, 06:45 AM
        1 response
        7 views
        0 likes
        Last Post gaz0001
        by gaz0001
         
        Started by Waxavi, 04-19-2024, 02:10 AM
        3 responses
        41 views
        0 likes
        Last Post gaz0001
        by gaz0001
         
        Started by Max238, Today, 01:28 AM
        2 responses
        26 views
        0 likes
        Last Post NinjaTrader_ChristopherJ  
        Started by Shansen, 08-30-2019, 10:18 PM
        25 responses
        949 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Started by JonesJoker, 04-22-2024, 12:23 PM
        8 responses
        44 views
        0 likes
        Last Post JonesJoker  
        Working...
        X