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 CarlTrading, 03-31-2026, 09:41 PM
    1 response
    72 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    39 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    63 views
    2 likes
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    63 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    53 views
    0 likes
    Last Post CarlTrading  
    Working...
    X