Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Is there an easier way to say this

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

    Is there an easier way to say this

    I want to make a triangle appear on a crossup by +DMI of 25 but only if first there was no crossup of 20 on any of the prior 4 bars.

    The only way I can figure the restriction is like this, but is there a more concise way than stating the value needed to be above 20 the last 5 bars (in order to be sure it didnt crossup on that 4th bar back) by writing it for 1 bar back at a time like in red bold below?

    if (CrossAbove(DiPlus, 25,1)&& DiPlus[1]<=25 && DiPlus[0]>=DiMinus[0]
    && DiPlus[
    1]>20 && DiPlus[2]>20 && DiPlus[3]>20 && DiPlus[4]>20 && DiPlus[5]>20 )

    #2
    simpletrades, you could simplify this if needed with CountIf() - http://www.ninjatrader-support.com/H...6/CountIf.html

    Comment


      #3
      Originally posted by NinjaTrader_Bertrand View Post
      simpletrades, you could simplify this if needed with CountIf() - http://www.ninjatrader-support.com/H...6/CountIf.html
      thanks, but if i want to draw an ArrowUp instead of make an entry
      would it just read
      DrawTriangleUp("di+25up" + CurrentBar, false, 0, DiPlus[0]-(1*dist),Color.Lime);

      instead of EnterLong(); like in the example?
      Examples
      // If in the last 10 bars we have had 8 up bars then go long

      if(CountIf(delegate {return Close[0] > Open[0];}, 10) > 8) EnterLong();
      Last edited by simpletrades; 11-06-2009, 08:14 AM.

      Comment


        #4
        Sure, you could also draw your triangle as this returns true instead of submitting an entry order, this is just an example how to use the syntax.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        601 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        347 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        103 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        559 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        558 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X