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 fx.practic, 10-15-2013, 12:53 AM
        5 responses
        5,404 views
        0 likes
        Last Post Bidder
        by Bidder
         
        Started by Shai Samuel, 07-02-2022, 02:46 PM
        4 responses
        95 views
        0 likes
        Last Post Bidder
        by Bidder
         
        Started by DJ888, Yesterday, 10:57 PM
        0 responses
        8 views
        0 likes
        Last Post DJ888
        by DJ888
         
        Started by MacDad, 02-25-2024, 11:48 PM
        7 responses
        159 views
        0 likes
        Last Post loganjarosz123  
        Started by Belfortbucks, Yesterday, 09:29 PM
        0 responses
        8 views
        0 likes
        Last Post Belfortbucks  
        Working...
        X