Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Triggering OnBarUpdate when their is no more bars

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

    Triggering OnBarUpdate when their is no more bars

    Hi,

    I use Kinetick real time data and I'm writing a strategy that use EOD data.
    Each morning I'm analyzing the data from yesterday close and produce a report.
    Every day is working correctly but on Saturday or Sunday when I want to analyze the data for Friday close I don't get the report, only on Monday morning I can view the data of Friday.
    Is there a way so call OnBarUpdate although their is no more data to trigger the call normally?

    Tx in advance!

    #2
    Hello freewind,
    Since I am not aware of the exact code you are using, I can give you a couple of directions.

    If you are using CalculateOnBarClose = true, then on Saturday and Sunday, make the same set to false, this will let the strategy to calculate on the last bar too.

    If your strategy works one bar behind (like Close[1] instead of Close[0], since you mentioned previous day), then you may put a check like this

    Code:
    if (DateTime.Now.DayOfWeek == DayOfWeek.Saturday || DateTime.Now.DayOfWeek == DayOfWeek.Sunday)
    {
            //COBC should be false, but i still write the additional check
    	if (CalculateOnBarClose = true)
    	{
    		if (BarsArray[0].Count - 2 == CurrentBar)
    		{
    			//print out strategy result
    		}
            }
    	else if (CalculateOnBarClose = false)
    	{
    		if (BarsArray[0].Count - 1 == CurrentBar)
    		{
    			//print out strategy result
    		}
    	}
    }
    This are just some basic ideas, so do build upon the same.

    Please do let me know if I can be of further help.

    Regards,
    Joydeep.
    JoydeepNinjaTrader Customer Service

    Comment


      #3
      Tx Joy,

      But I don't understand what will trigger my strategy on Sunday(before future market opens) to enter the OnBarUpdate().The strategy is running on real time data, not backtest.
      I'm working with Close[0], which on EOD data gives me the last close.

      Comment


        #4
        Hello freewind,
        have you set CalculateOnBarClose to true or false?

        Also you said you are analyzing the data on the weekends, right. Please provide me the details so that I can guide you any further.

        Regards,
        Joydeep.
        JoydeepNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        647 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        367 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        108 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        571 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        573 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X