I've got a bit of code that follows an indicator as it crosses a line. When the indicator crosses the line a dot is drawn. I'm finding that the 3rd and 4th dots are off a bar or two. Any suggestions as to why this would happen? Here is the code.
//"1,2,3,4" Setup
//This is the "reset" to start the "1"
if (CrossBelow(DM(10).DiPlus, DM(10).DiMinus, 1)
&& Falling(ADX(10)) == true)
{
reset1234 = true;
}
// "1"
dmCrossDown = MRO(delegate {return CrossBelow(DM(10).DiPlus, 25, 1);}, 1, 1);
if(dmCrossDown > -1 && reset1234 == true && CurrentBar - myConditionBar >=2)
{
myConditionBar = CurrentBar;
dm1stCrossDown = true;
DrawDot("dm1stCrossDown" + CurrentBar,true,0,Low[0] - 1,Color.Red);
reset1234 = false;
}
// "2"
dmCrossUp = MRO(delegate {return CrossAbove(DM(10).DiPlus, 25, 1);}, 1, 1);
if(dmCrossUp > -1 && dm1stCrossDown == true && CurrentBar - myConditionBar >=2)
{
myConditionBar = CurrentBar;
dm1stCrossUp = true;
DrawDot("dm1stCrossUp" + CurrentBar,true,0,Low[0] - 1,Color.Blue);
dm1stCrossDown = false;
}
// "3"
dmCrossDown = MRO(delegate {return CrossBelow(DM(10).DiPlus, 25, 1);}, 1, 1);
if(dmCrossDown > -1 && dm1stCrossUp == true && CurrentBar - myConditionBar >=2)
{
myConditionBar = CurrentBar;
DrawDot("dm2ndCrossDown" + CurrentBar,true,0,Low[0] - 1,Color.DarkRed);
dm1stCrossUp = false;
dm2ndCrossDown = true;
}
//"4"
dmCrossUp = MRO(delegate {return CrossAbove(DM(10).DiPlus, 25, 1);}, 1, 1);
if(dmCrossUp > -1 && dm2ndCrossDown == true && CurrentBar - myConditionBar >=2)
{
Also, how do you get those cool boxes that one can put code in that displays better in the post? Thanks

Comment