I'm trying to figure out the syntax then draw a rectangle; for instance with a triple crossover that will cover the highs and lows of that entire crossover as in the screenshot.
What would I need for the startBarsAgo, startY, endBarsAgo, endY parameters to accomplish this?
Thanks for the assistance.
#region Variables
privatebool colorBars = true;
#endregion
protectedoverridevoid Initialize()
{
Overlay = false;
CalculateOnBarClose = false;
}
protectedoverridevoid OnBarUpdate()
{
double MA5 = EMA(Close,5)[0];
double MA10 = EMA(Close,10)[0];
double MA20 = EMA(Close,20)[0];
bool CrossUp = MA5 > MA10 && MA10 > MA20;
bool CrossDown = MA5 < MA10 && MA10 < MA20;
if ( CrossUp ) {
if (colorBars ) {
BarColor = Color.Cyan;
}
}
else if (CrossDown ) {
if (colorBars ) {
BarColor = Color.Violet;
}
}
else if (colorBars) {
BarColor = Color.DimGray;
}
DrawRectangle("Area"+ CurrentBar.ToString(), false, startBarsAgo, startY, endBarsAgo, endY, Color.Empty, Color.Blue, 2);
Comment