I have written an indicator as follows -
protected override void OnBarUpdate()
{
if (CurrentBar<2)return;
if (FirstTickOfBar)
{
priorBarLongDIBS=false;
priorBarShortDIBS=false;
}
if (High[1]<=High[2] && Low[1]>=Low[2]&& Close[0]>CurrentDayOHL().CurrentOpen[0] && Close[0]>High[1] && priorBarLongDIBS==false)
{
priorBarLongDIBS=true;
DIBSLong[1]=Low[1]-10*TickSize;
}
if (High[1]<=High[2] && Low[1]>=Low[2] && Close[0]<CurrentDayOHL().CurrentOpen[0] && Close[0]<Low[1] && priorBarShortDIBS==false)
{
priorBarShortDIBS=true;
DIBSShort[1]=High[1]+10*TickSize;
}
}
I am trying to access the condition of break of the inside bar on the long side and trying to enter a long order as below..
protected override void Initialize()
{
CalculateOnBarClose = false;
SetTrailStop(CalculationMode.Ticks, 20);
}
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
bool orderPlaced=false;
if (CurrentBar<2)return;
if (FirstTickOfBar)
{
orderPlaced=false;
}
if (orderPlaced==false && DIBSBars(1).DIBSLong[1]<=Close[0])
{
orderPlaced=true;
//enter order
entryOrder=EnterLong(10000, "DIBSEntry");
}
}
The value DIBSBars(1).DIBSLong[1] seems to be equal to Close[1]. Please help me with where I am messing up..
Comment