Skip to content
All library documents

Using a Moving Average to Color Candles by Market Bias

Article ProRealCode

Summary

This indicator colors candles according to whether the close is above or below a selected moving average. Candles above the average receive a bullish color, while those below receive a bearish color. A candle moving against the prevailing side of the average is colored gray, distinguishing a counter-direction candle from one that agrees with the broader bias. The author describes the tool as based on Raghee Horner’s GRaB indicator and illustrates it with a 200-period average, which can be changed.

The supplied indicator logic constructs candle bodies and wicks, then draws them with the assigned colors. It is a visual regime aid rather than a complete entry, exit, or position-sizing system; the document provides no backtest, performance evidence, or rules for choosing the average. Its bias classification depends on the chosen moving average, and the code’s treatment of candles exactly at the average is not specified. The rest of the page is privacy and profile information unrelated to trading.

Key ideas

  • The indicator classifies market bias by comparing each close with a selected moving average.
  • Candles aligned with the bias receive directional colors, while counter-direction candles are gray.
  • The example uses a 200-period average, but the average can be changed.
  • The tool visualizes direction and does not define a full trading or risk-management system.
  • The document provides no test results or method for selecting the moving-average period.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.