The indicator runs on range bars (6 range or 4 range), and once a certain condition is achieved, will print a dot in the bar. I will enter at the opening of the following bar. This is a pseudo code:
CUSTOM INDICATOR:
If (condition) and FirstTickOfBar
{
DrawDot ( bar[1]);
BullIndication.Set(true);
}
Then in my strategy I do the following:
Initialize()
{
CalculateOnBarClose = false;
CustomIndicator = customIndicator( parameters…);
Add(CustomIndicator);
}
OnBarUpdate()
{
If (CustomIndicator.BullIndication[0])
{
EnterLong(“LONG”);
}
}
The problem I’m having is that the strategy is entering 1 bar delayed. I was supposed to enter at the close of the bar with the DOT, and instead it’s sending the EnterLong signal a bar after that, which produces very wrong results to the entire scalping strategy since it’s too late.
Anybody knows how to solve this problem and oblige my strategy to issue the “EnterLong” at the close of the bar with the dot?
Thanks!
Comment