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 Mindset, 04-21-2026, 06:46 AM
    0 responses
    101 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    144 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    71 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    125 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    79 views
    0 likes
    Last Post PaulMohn  
    Working...
    X