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 ZenCortexCLICK, Today, 04:58 AM
    0 responses
    5 views
    0 likes
    Last Post ZenCortexCLICK  
    Started by sidlercom80, 10-28-2023, 08:49 AM
    172 responses
    2,281 views
    0 likes
    Last Post sidlercom80  
    Started by Irukandji, Yesterday, 02:53 AM
    2 responses
    18 views
    0 likes
    Last Post Irukandji  
    Started by adeelshahzad, Today, 03:54 AM
    0 responses
    8 views
    0 likes
    Last Post adeelshahzad  
    Started by Barry Milan, Yesterday, 10:35 PM
    3 responses
    13 views
    0 likes
    Last Post NinjaTrader_Manfred  
    Working...
    X