Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Slight Error in Condtional Statement Indicator, need help, Ninja trader 7

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

    Slight Error in Condtional Statement Indicator, need help, Ninja trader 7

    I have a slight error in my conditional statement indicator that I am inputting. The goal is to plot a Black Diamond above the price bars where all of the conditions are true, and have the diamonnd flash on and off of the screen as the conditions are being met on a tick by tick basis.

    So far I have a black diamond appearing over every single price bar....my basic conditions are these: High of current bar >= High of 3 bars ago and Close of current bar < Close of 3 bars ago.

    Here is the ninja script I am using:

    if(CurrentBar<2)return;if((High[0]>=High[-3])&&(Close[0]<Close[-3])); DrawDiamond("tag1" + CurrentBar,true,0,High[0]+(TickSize+.10),Color.Black);
    }

    Any help is much appreciated...for some reason the diamond is being plotted on every bar, so I guess my conditional statements are not being recognized.

    #2
    Originally posted by vern13 View Post
    I have a slight error in my conditional statement indicator that I am inputting. The goal is to plot a Black Diamond above the price bars where all of the conditions are true, and have the diamonnd flash on and off of the screen as the conditions are being met on a tick by tick basis.

    So far I have a black diamond appearing over every single price bar....my basic conditions are these: High of current bar >= High of 3 bars ago and Close of current bar < Close of 3 bars ago.

    Here is the ninja script I am using:

    if(CurrentBar<2)return;if((High[0]>=High[-3])&&(Close[0]<Close[-3])); DrawDiamond("tag1" + CurrentBar,true,0,High[0]+(TickSize+.10),Color.Black);
    }

    Any help is much appreciated...for some reason the diamond is being plotted on every bar, so I guess my conditional statements are not being recognized.
    Correct is:

    Code:
    if(CurrentBar<3) return;
    if((High[0]>=High[3])&&(Close[0]<Close[3])) DrawDiamond("tag1" + CurrentBar.ToString(),true,0,High[0]+(TickSize+.10),Color.Black);
    Your code has a semi-colon terminating the second if statement, turning it into a null statement, so your drawing code would be called on every bar.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Hwop38, 05-04-2026, 07:02 PM
    0 responses
    164 views
    0 likes
    Last Post Hwop38
    by Hwop38
     
    Started by CaptainJack, 04-24-2026, 11:07 PM
    0 responses
    319 views
    0 likes
    Last Post CaptainJack  
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    246 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    350 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