================
...
double dblBarwidth;
//Cory add prevClose
double prevClose = 0;
for (int idx = fromIdx; idx <= toIdx; idx++)
{
//calc dynamic bar width
dblBarwidth = k * bars.GetVolume(idx) + m;
barWidth = (int)(Math.Round(dblBarwidth, 0));
barColor = chartControl.GetBarColor(bars, idx);
// barWidth = GetBarPaintWidth(barWidthValue);
closeValue = bars.GetClose(idx);
close = chartControl.GetYByValue(bars, closeValue);
high = chartControl.GetYByValue(bars, bars.GetHigh(idx));
low = chartControl.GetYByValue(bars, bars.GetLow(idx));
openValue = bars.GetOpen(idx);
open = chartControl.GetYByValue(bars, openValue);
x = chartControl.GetXByBarIdx(bars, idx);
//Cory load prevClose when idx < toIdx
if (idx > fromIdx && idx < toIdx) {
prevClose = close; }
......
//Cory -set color for doji bar
if (open == close && prevClose > 0 )
{
if (close < prevClose) {
Pen2.Color = Color.Red;}
if (close >= prevClose) {
Pen2.Color = Color.Green; }
}
if (high < Math.Min(open, close))
graphics.DrawLine(Pen2, x, high,x,Math.Min(open, close));
if (low > Math.Max(open, close))
graphics.DrawLine(Pen2, x, low, x,Math.Max(open, close));
......
Comment