PDA

View Full Version : Minute Time Frame Indicators in a TickTime Frame strategy


Nathamus
04-10-2007, 01:02 AM
I would like to use a 1-minute indicator (for stop/limit values) in a tick timeframe strategy, both on the same instrument. The indicator values should only be updated once every minute.
e.g. FDAX, tick timeframe and a SMA(10) on a 1 minute period FDAX => SMA Value is updated only once a minute.

When I add a 2nd bar object to the strategy:
Add(PeriodType.Minute, 1);
Add(SMA(10));

This object will updated on every tick, even if I limit the OnBarUpdate() to the underling instrument on the ticktimeframe with
if (BarsInProgress != 0)
return;

It is the same with the example strategy:
When I add the SampleMultiTimeFrame strategy that is provided with NT 6.0.0.10 to a ticktimeframe chart two SMAs are plotted which are updated several times in a single minute. In the strategy code they a defined as a 5 minute SMA and a 50 minute SMA.

Did I misunderstood something? Why is the SMA updated on every tick?

NinjaTrader_Dierk
04-10-2007, 01:43 AM
Indicators in a strategy are updated according the CalculateOnBarClose property of the strategy holding the indicators.

a) if the strategy has CalculateOnBarClose=True, then the indicators will run with CalculateOnBarClose=True
a) if the strategy has CalculateOnBarClose=False, then the indicators will run with CalculateOnBarClose=False

Nathamus
04-10-2007, 02:01 AM
I tried both CalculateOnBarClose=true and CalculateOnBarClose=false on the SampleMultiTimeFrame strategy. It looks like there is no difference, the plots are the same.

The minute based SMA is updated on every bar close (= every tick) of the tick timeframe underlying and not on every bar close (which is every 10 minutes) of it´s own timeframe.

How can I create an indicator that is updated only on a certain time intervall?

NinjaTrader_Dierk
04-10-2007, 02:09 AM
Hmm, let's make sure we are on the same page: As you throw a strategy/indicator on a chart, it's executed once per bar for the historical part of the bars series. no matter what the CalculateOnBarClose property is set to. CalculateOnBarClose=False only is relevent for strategies/indicators running on incoming realtime data.

Reason: On historical bars data there are no ticks. One bar only triggers OnBarUpdate once.

Nathamus
04-10-2007, 03:25 AM
Sorry, maybe I did not point it out clearly.

I use a tick time chart and I have historical tick data, so every tick is a bar.

When I throw the strategy/indicator on this chart it is executed once per bar = once per tick. It obviosly does not matter if CalculateOnBarClose is set to true or false.

How can I add an indicator that is updated only once per minute, to a ticktime chart or a strategy running on a tick time chart?

NinjaTrader_Dierk
04-10-2007, 03:41 AM
I see. Sorry you can not visualize on chart an indicator running on a different timeframe than the chart.

But you can add an indicator running on a minute time frame to a strategy running on a tick timeframe. If the strategy then runs on CalculateOnBarClose=false, the indicator will only calculate once per per minute.

The docs (NinjaScript->Developing Custom Strategies->Multi Time Frame & Instrument) hold a sample on how to run indicators on different timeframe than the strategy.