Bars.BarOpened called on each tick instead of each bar
Created at 06 Nov 2020, 10:50
Bars.BarOpened called on each tick instead of each bar
06 Nov 2020, 10:50
Hi, I'm trying to create indicator that calculates values on each bar, instead of each tick. I tried to write a simple indicator, which is making use of Bars.BarOpened event, but this event is called each tick, instead of each bar.
using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
using cAlgo.Indicators;
namespace cAlgo
{
[Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class awdwaa : Indicator
{
protected override void Initialize()
{
Bars.BarOpened += OnBarsBarOpened;
}
void OnBarsBarOpened(BarOpenedEventArgs obj)
{
Print("New bar created for " + obj.Bars.SymbolName + " at " + obj.Bars.Last(0).OpenTime);
}
public override void Calculate(int index)
{
}
}
}
As you can see, event is triggered on each tick, instead of each bar. How to solve this?