Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

syntax for 1 of ...

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

    syntax for 1 of ...

    Hello,

    I tried to find syntax and parameters to add to a code (in words) "if one of last 5 bars was a downbar" &&...

    But I couldn´t find it.

    Thank you
    Tony

    #2
    Hello tonyt, and thank you for your question.

    The code you are describing looks like this :

    Code:
    [FONT=Courier New]// if one of the last 5 bars was a downbar
    bool oneOfTheLast5BarsWasADownBar = false;
    for (int i = 0; i < 5; i++) // loop through the last 5 bars
    {
      if (Open[i] > Close[i]) // for down bars, open is higher than close
      {
        [/FONT][FONT=Courier New][FONT=Courier New]oneOfTheLast5BarsWasADownBar = true;
      [/FONT]}
    }
    [/FONT]
    Please let us know if there are any other ways we can help.
    Jessica P.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    77 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    45 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    27 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    32 views
    0 likes
    Last Post TheRealMorford  
    Started by Mindset, 02-28-2026, 06:16 AM
    0 responses
    62 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Working...
    X