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 Hwop38, 05-04-2026, 07:02 PM
          0 responses
          161 views
          0 likes
          Last Post Hwop38
          by Hwop38
           
          Started by CaptainJack, 04-24-2026, 11:07 PM
          0 responses
          308 views
          0 likes
          Last Post CaptainJack  
          Started by Mindset, 04-21-2026, 06:46 AM
          0 responses
          245 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by M4ndoo, 04-20-2026, 05:21 PM
          0 responses
          349 views
          0 likes
          Last Post M4ndoo
          by M4ndoo
           
          Started by M4ndoo, 04-19-2026, 05:54 PM
          0 responses
          179 views
          0 likes
          Last Post M4ndoo
          by M4ndoo
           
          Working...
          X