The "BarColor" indicator I wrote compiles with no errors, however I'm sure I'm missing an: If - Then, or If - Else, or the correct use of {}'s or some other problem with the Syntax of C+. I have tried several combination of Syntax and spent a lot of time trying to figure this out. My code in question is underlined below. When I load the indicator, the bars don't change colors.
The description of my desired 'logic' is show above each 'Condition'
#region Variables
// Wizard generated variables
privateint fastHMA = 40; // Default setting for FastHMA
privateint slowerEMA = 20; // Default setting for SlowerEMA
.... generic code not show ... etc
protectedoverridevoid OnBarUpdate()
{
if (CurrentBar == 0)
{
// Condition 1 Plots GREEN bars if HMA & EMA are both trending UP.
if ((Rising(HMA(fastHMA))) && (Rising(EMA(slowerEMA))));
BarColor = Color.Green;
// Condition 2 Plots RED bars if HMA & EMA are both trending DOWN.
if ((Falling(HMA(fastHMA))) && (Falling(EMA(slowerEMA))));
BarColor = Color.Red;
// Condition 3 Plots PaleGreen bars if HMA is Falling & EMA is trending UP.
if ((Falling(HMA(fastHMA))) && (Rising(EMA(slowerEMA))));
BarColor = Color.PaleGreen;
// Condition 4 Plots RosyBrown bars if HMA is Rising & EMA is trending DOWN.
if ((Rising(HMA(fastHMA))) && (Falling(EMA(slowerEMA))));
BarColor = Color.RosyBrown;}
}
Thank you for your help.
Comment