PDA

View Full Version : Cumulative indicator - re-setting the value


Day Trading Fool
03-30-2010, 06:19 AM
Hi - not at all sure if this is possible, but I am trying to put together a cumulative indicator (NewValue = SomeFunction + OldValue) and wondering if it is possible to override the OldValue based on the time of day. E.g., let's say at market open I want the OldValue to become zero.

Does this make sense? Is it possible?

Thanks for any help.

NinjaTrader_Tim
03-30-2010, 06:32 AM
Hi Day Trading Fool,

You can apply a time filter and declare the variable within it.
More info at - http://www.ninjatrader-support2.com/vb/showthread.php?t=3226

Day Trading Fool
03-30-2010, 07:49 AM
Thanks for the reply.

I think I need to be able to associate a bar with a specific time. Here is what I am using (but nothing happens at 6:30 on the chart):

if (ToTime(Time[0]) == 63000)
{
MultipleCalc = 0;
Multiple.Set(MultipleCalc);
}
else
{
MultipleCalc = (SomeFunction) + Multiple[1];

Multiple.Set(MultipleCalc);
}

NinjaTrader_Tim
03-30-2010, 08:02 AM
Hi Day Trading Fool,

What time interval are you using to chart this? Does it offer a bar with the 6:30am time stamp?

Then, you can add Print() statement to see if the condition and value is triggered.

Day Trading Fool
03-30-2010, 08:05 AM
Heh - That did the trick... Thanks!