protected override void OnBarUpdate()
{
// if(CurrentBar < 2)return; //Make sure there are at least 2 bars printed before processin
Print(" ");
Print(instName + " MyBackgroundHAHMA: " + Time[0].ToString());
Print(instName + " BarsInProgress: " + BarsInProgress);
if (BarsInProgress == 1) // process Min Chart
{
if (CurrentBar == 0)
{
HA_C.Set(Close[0]);
HA_O.Set(Open[0]);
HA2_C.Set(Close[0]);
HA2_O.Set(Open[0]);
return;
}
// HA Thma (yellow)
HA2_O.Set((((Open[1] + High[1] + Low[1] + Close[1]) / 4) + HA2_O[1]) / 2);
HA2_C.Set((((Open[0] + High[0] + Low[0] + Close[0]) / 4) + HA2_O[0] + Math.Max(High[0], HA2_O[0]) + Math.Min(Low[0], HA2_O[0])) / 4);
MyHeiken = (3 * hma1[0] - 3 * hma2[0] + hma3[0]);
// Price Thma (red)
MyThma = (3 * hma1t[0] - 3 * hma2t[0] + hma3t[0]);
}
if (BarsInProgress == 0) // process current instrument
{
Print(instName + " MyThma: " + MyThma + " MyHeiken: " + MyHeiken);
if (MyThma >= MyHeiken) BackColorSeries[0] = risingColor;
else BackColorSeries[0] = fallingColor;
}
Comment