I am using a strategy based on LineBreakBarsType
I face a number of problem due, apparently, to a different behavior applied to this kind of bars.
First thing is I want to test the first tick of a bar.
It will always return true even if the bar is here for minutes and has moved several points on the price scale.
Also, when testing bar number, it seems that the bar changes to the current bar, then to the previous, then to the current bar, then to the previous (thus making IsFirstTickofBar always true)
I can't see how to approach this problem:
protected override void OnBarUpdate()
{
if (CurrentBar < BarsRequiredToTrade)
return;
Print("CurrentBar = " + CurrentBar);
Print("IsFirstTickOfBar = " + IsFirstTickOfBar);
if (IsFirstTickOfBar == true)
{
// This is always true
...
CurrentBar = 1716
IsFirstTickOfBar = True
CurrentBar = 1717
IsFirstTickOfBar = True
CurrentBar = 1716
IsFirstTickOfBar = True
CurrentBar = 1717
IsFirstTickOfBar = True
CurrentBar = 1716
IsFirstTickOfBar = True
CurrentBar = 1717
IsFirstTickOfBar = True
CurrentBar = 1716
IsFirstTickOfBar = True

Comment