Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Newbie basic q: Why does not OnBarUpdate execute?

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

    Newbie basic q: Why does not OnBarUpdate execute?

    Newbie basic question: Why does not OnBarUpdate execute on each data event of the bar and not just at the close of the bar when CalculateOnBarClose = false ?

    The following code prints that it is entering the OnBarUpdate routine each 5 minute interval (the time frame selected).....


    namespace NinjaTrader.Strategy
    {
    [Description("")]
    public class BlueCrows3 : Strategy
    {
    #region Variables
    // Wizard generated variables
    private int trailStop = 5; // Default setting for TrailStop
    private int crows = 1; // Default setting for Crows
    private int offsetEntry = 7; // Default setting for OffsetEntry
    // User defined variables (add any user defined variables below)
    #endregion


    protected override void Initialize()
    {
    Add(NBarsDown(3, false, false, false));
    Add(NBarsUp(3, false, false, false));
    CalculateOnBarClose = false;

    }


    protected override void OnBarUpdate()
    {

    Print("OnBarUpdate: "+ ToTime(Time[0]) + " Variable0: " + Variable0 + " GetCurrentBid: "+ GetCurrentBid() + " MarketPosition: "+ Position.MarketPosition);

    }

    #2
    Ok answered my own question ...

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    650 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    370 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    109 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    574 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    577 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X