Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

The use of CurrentBar

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

    The use of CurrentBar

    Hello,

    How do you stop a loop with CurrentBar in OBU?

    Code:
    if(CurrentBar < 391) return;
    What if i want the loop to start at 391 and stop at 789? How do you write that?

    Code:
    if(CurrentBar < 391 & CurrentBar > 789 ) return;
    TY

    #2
    Hello frankduc,

    To stop a loop you would use break statement. https://docs.microsoft.com/en-us/dot...keywords/break

    If you wanted to use the CurrentBar you could use it like you have, I don't know how you are overall trying to use the CurrentBar to advise on that. CurrentBar is an int so you can use it in conditions like you have shown to check if its less equal or greater than a value.

    If you wanted to start at 391 and end at 789 in the loop you would need to use those values in your loop. To learn more about how to use loops please use Microsofts C# documentation: https://docs.microsoft.com/en-us/dot...h-the-for-loop

    Please let me know if I may be of further assistance.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    81 views
    1 like
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    41 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    64 views
    2 likes
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    66 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    54 views
    0 likes
    Last Post CarlTrading  
    Working...
    X