Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Crossover Filtering

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

    Crossover Filtering

    Having a problem adding a 'filter' condition to DrawDownArrow.

    I have been able to program a simple DrawDownArrow and it works fine.

    if
    (CrossBelow(Leader, 0, 1);
    {
    DrawArrow("MyDownArrow1"+CurrentBar, 0, High[0]+4* TickSize, Color.Black);
    }

    Everything works fine with that.

    But, have not been able to add a simple filter. Have been able to get it to compile various ways, but the result is always the same (see attached)

    if ((Diff[0] < .2) && CrossBelow(Leader, 0, 1)); //then Draw
    if (Diff[0] < .2 && CrossBelow(Leader, 0, 1)); //then Draw

    The output seems to ignore the second condition, ie CrossBelow.

    Thanks in advance for any and all help.

    phoenix
    Attached Files

    #2
    Hi phoenix,

    Thank you for your post.

    I suggest nesting the if statements to organize the code.
    Something like...

    if (Diff[0] < .2)
    {
    if (CrossBelow(Leader, 0, 1))
    {
    DrawArrowDown()
    }
    }
    TimNinjaTrader Customer Service

    Comment


      #3
      Tim,

      Thanks for you reply.

      I did that one also, but will give it another go this weekend ...maybe I had the brackets wrong.

      phoenx

      Comment


        #4
        You can also try

        if ((Diff[0] < .2) && CrossBelow(Leader, 0, 1))
        {
        "Do something"
        }

        Notice the curly braces and lack of semi colon, ;, after if statement.
        TimNinjaTrader Customer Service

        Comment


          #5
          Hey Tim,

          Doing...

          if ((Diff[0] < .2) && CrossBelow(Leader, 0, 1))
          {
          "Do something"
          }

          ...worked.

          Must have been at it tooooo long last night...knew there was something simple I was missing.

          Thanks for the help.

          phoenix

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          576 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          334 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          101 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          553 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          551 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X