As some are volume based.
Questions
1) OnBarupdate is triggered every new trade?
2) if I have 3 indicators per chart and 5 charts, I will be updateing alot
3) Which of the 2 codes I use to stall the OnbarUpdates works best, most efficient.
Has anybody any code design to make NT run better if you dont want calc on bar close.
protected override void OnBarUpdate()
{
if (Historical == true)
{
// Data and code here
}
if (Historical == false && runonce==false)
{
// Initiate our Timer object with an interval of 1000ms (1 second)
myTimer.Tick += new EventHandler(TimerEventProcessor);
myTimer.Interval = 500;
myTimer.Start();
runonce=true;
}
}
// Timer's tick event handler. Called at every tick of 1000ms.
private void TimerEventProcessor(Object myObject, EventArgs myEventArgs)
{
TriggerCustomEvent(MyCustomHandler, 0, myTimer.Interval);
}
private void MyCustomHandler(object state)
{
// simpler timing code
if (DateTime.Now.TimeOfDay.TotalMilliseconds>=timerdelay &&(Historical)==false)
{
timerdelay=(DateTime.Now.AddMilliseconds(500).TimeOfDay.TotalMilliseconds);
}
else if((Historical)==true)
{
//code here
}

Comment