PDA

View Full Version : Catch the end of a minute bar on a tick by tick OnBarUpdate event


Fabrice
07-06-2007, 05:53 AM
I was wondering if there is a way to catch the end of a minute bar when updating a strategy on a tick per tick basis?

I explain:

protected override void Initialize()
{
....
Add(PeriodType.Minute,1);

CalculateOnBarClose = false;

}

NinjaTrader_Dierk
07-06-2007, 05:59 AM
No, since the end of the bar only would be determined as the first tick of the new bar was seen.

BTW: No need for
Add(PeriodType.Minute,1);
Just execute your strategy on a 1 minute series.

Fabrice
07-06-2007, 06:20 AM
No, since the end of the bar only would be determined as the first tick of the new bar was seen.

Although, we are using tick to fire the OnBarUpdate event I thought there could have been a special event, a time event that could indicate the end of a bar even when there is not a new coming tick, something like:

OnBarUpdate.UpdateType = NewTick

or

OnBarUpdate.UpdateType = EndBarContext(ContextNumber)

Sometimes like this.

Basically it would be nice to have different types of events that could trigger the OnBarUpdate event and then be able to check the type of events which triggered the OnBarUpdate event.

It would be very helpfull to write fast accurate trading strategies.

BTW: No need for
Add(PeriodType.Minute,1);
Just execute your strategy on a 1 minute series.


I cannot do that as my strategies have limit orders but I want those orders to become market after a small time has passed or few quotations have occured. So I need to track down at the tick level my entry limit in the market to check if it was quoted or not.

Knowing the end of the bar of a given context before the first tick of the next bar would be handy to update my entry or exit trigger one tick earlier.

Thanks,
Fabrice.

NinjaTrader_Dierk
07-06-2007, 06:52 AM
Thanks for your suggestion. We'll add it to the list.

ceesvh
07-06-2007, 11:25 AM
Fabrice,

Maybe is it possible to retrieve the time remaining from the indicator BarTimer. ( I do not know how to do it)

NinjaTrader_Ray
07-06-2007, 12:28 PM
This is not possible.

Maybe PercentComplete would work?

http://www.ninjatrader-support.com/HelpGuideV6/PercentComplete.html