if (TFTrendTypes.Balanced == TFtrendType)
{
//b. Value area % at bottom
if (DrawObjects["VH"] != null&&Close[0]>lineValhigh1)
{
graphics.DrawRectangle(new Pen(Color.White), bounds.X +(bounds.Width/2), bounds.Bottom-50, 100, 40);
graphics.FillRectangle(new SolidBrush(Color.FromArgb(150,Color.Green.R,Color.Green.G,Color.Green.B)), bounds.X +(bounds.Width/2)+1, bounds.Bottom - 49, 99, 39);
graphics.DrawString(abovevalue.ToString("N0")+"%", textFontHuge, textBrushStrong, bounds.X +(bounds.Width/2)-3, bounds.Bottom - 50, stringFormatCenter);
}
else if (DrawObjects["VH"] != null&&Close[0]<lineVallow1)
{
graphics.DrawRectangle(new Pen(Color.White), bounds.X +(bounds.Width/2), bounds.Bottom-50, 100, 40);
graphics.FillRectangle(new SolidBrush(Color.FromArgb(150,Color.Red.R,Color.Red.G,Color.Red.B)), bounds.X +(bounds.Width/2)+1, bounds.Bottom - 49, 99, 39);
graphics.DrawString(belowvalue.ToString("N0")+"%", textFontHuge, textBrushWeak, bounds.X +(bounds.Width/2)-3, bounds.Bottom - 50, stringFormatCenter);
}
else if (DrawObjects["VH"] != null&&Close[0]>=lineVallow1 && Close[0]<=lineValhigh1)
{
graphics.DrawRectangle(new Pen(Color.White), bounds.X +(bounds.Width/2), bounds.Bottom-50, 100, 40);
graphics.FillRectangle(new SolidBrush(Color.FromArgb(250,Color.Yellow.R,Color.Yellow.G,Color.Yellow.B)), bounds.X +(bounds.Width/2)+1, bounds.Bottom - 49, 99, 39);
graphics.DrawString(balancedvalue.ToString("N0")+"%", textFontHuge, textBrushNormal, bounds.X +(bounds.Width/2)-3, bounds.Bottom - 50, stringFormatCenter);
}
}
if (ESTrendTypes.Balanced == EStrendType)
{
//b. Value area % at bottom
if (DrawObjects["VH"] != null&&Close[0]>lineValhigh1)
{
graphics.DrawRectangle(new Pen(Color.White), bounds.X +(bounds.Width/2), bounds.Bottom-50, 100, 40);
graphics.FillRectangle(new SolidBrush(Color.FromArgb(150,Color.Green.R,Color.Green.G,Color.Green.B)), bounds.X +(bounds.Width/2)+1, bounds.Bottom - 49, 99, 39);
graphics.DrawString(abovevalue.ToString("N0")+"%", textFontHuge, textBrushStrong, bounds.X +(bounds.Width/2)-3, bounds.Bottom - 50, stringFormatCenter);
}
else if (DrawObjects["VH"] != null&&Close[0]<lineVallow1)
{
graphics.DrawRectangle(new Pen(Color.White), bounds.X +(bounds.Width/2), bounds.Bottom-50, 100, 40);
graphics.FillRectangle(new SolidBrush(Color.FromArgb(150,Color.Red.R,Color.Red.G,Color.Red.B)), bounds.X +(bounds.Width/2)+1, bounds.Bottom - 49, 99, 39);
graphics.DrawString(belowvalue.ToString("N0")+"%", textFontHuge, textBrushWeak, bounds.X +(bounds.Width/2)-3, bounds.Bottom - 50, stringFormatCenter);
}
else if (DrawObjects["VH"] != null&&Close[0]>=lineVallow1 && Close[0]<=lineValhigh1)
{
graphics.DrawRectangle(new Pen(Color.White), bounds.X +(bounds.Width/2), bounds.Bottom-50, 100, 40);
graphics.FillRectangle(new SolidBrush(Color.FromArgb(250,Color.Yellow.R,Color.Yellow.G,Color.Yellow.B)), bounds.X +(bounds.Width/2)+1, bounds.Bottom - 49, 99, 39);
graphics.DrawString(balancedvalue.ToString("N0")+"%", textFontHuge, textBrushNormal, bounds.X +(bounds.Width/2)-3, bounds.Bottom - 50, stringFormatCenter);
}
}
if (TFTrendTypes.Balanced == TFtrendType)
reference that piece of code.
if (TFTrendTypes.Balanced == TFtrendType)
reference that same piece of code. So basically I only have the Value area % at bottom code put in once instead of 20 times and referenced each time. How would I do this?
Thanks
DJ
Comment