I use the following code to draw a rectangle from one candle to another.
bool drawRectangle(int candleInt,const double top,const double bottom, ENUM_TIMEFRAMES cDuration, color rectColor)
bool checkBarCount = true;
int useCurrDuration = PeriodSeconds(cDuration)/PeriodSeconds();
const datetime starts = iTime(_Symbol,cDuration,candleInt);
const datetime ends = starts - useCurrDuration*PeriodSeconds();
const string name=prefix+"_"+"_"+TimeToString(starts)+TimeToString(ends);
if(!ObjectCreate(0,name,OBJ_RECTANGLE,0,starts,top, ends, bottom))
Generally the code rectangle is drawn from a candle's high/low/open/close to it's high/low/open/close when the candle closes. How can I extend this method so that rectangle stretches to the latest drawn candle till price passes both the upper and lower values of the rectangle?
Here is an example. Say I am searching for a candle H1 bullish candle the that has the same close and high as one of its contained M30 bullish candles. So that's the pattern, H1 and M30 both bullish and having the same close and high. From the image below, the rectangle extends till a candle closes with it's high above the upper and lower values of the rectangle.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.