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 DannyP96, 05-18-2026, 02:38 PM
    1 response
    26 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 05-11-2026, 05:56 AM
    0 responses
    115 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 05-10-2026, 08:12 PM
    0 responses
    69 views
    0 likes
    Last Post CarlTrading  
    Started by Hwop38, 05-04-2026, 07:02 PM
    0 responses
    226 views
    0 likes
    Last Post Hwop38
    by Hwop38
     
    Started by CaptainJack, 04-24-2026, 11:07 PM
    0 responses
    412 views
    0 likes
    Last Post CaptainJack  
    Working...
    X