I've developed a strategy that automatically draws an up/downarrow below/above a candle when certain long/short entry conditions are met. If the signal does not result in a confirmed entry (executed buy/sell order), the arrow is removed again once the candle has closed to avoid a cluttered chart.
What I'd like to achieve now is to integrate a bool flag that prevents two successive up/downarrows from being drawn immediately one after the other. There should be at least one red candle after the confirmed green candle that produced the uparrow before another uparrow is drawn again.
Example: an uparrow is drawn if certain criteria are met for a long entry and if the candle is green (up candle).The bool flag should then check if at least one red (down) candle has appeared on the chart after a confirmed uparrow before drawing another uparrow.
How should I go about it? This is what I've got so far:
if (my conditions here && Close[0] > Open[0])
{
DrawArrowUp("BlackArrowLong" + CurrentBar, false, 0, Low[0], Color.Black);
}
if (High[0] <= High[1]) //Removes the Arrow if no Higher High was made and the Signal thus wasn't executed
{
RemoveDrawObject("BlackArrowLong" + (CurrentBar -1));
}
Thanks a lot for your help.

Comment