Doteki Heikin Ashi
Download scriptThis script is designed for MetaTrader 4 and 5 to generate a specialized type of candlestick chart known as the Heikin Ashi style. Unlike standard candlesticks, which show the exact price action of a period, Heikin Ashi candles use mathematical averaging to create smoother visual representations of price trends, making it easier for traders to identify the prevailing momentum without the "noise" of erratic price fluctuations.
Core Logic and Mechanics
The indicator functions by transforming raw market data (Open, High, Low, and Close prices) into smoothed values through several key processes:
1. Price Averaging (The Heikin Ashi Foundation) Instead of plotting the actual market prices, the script calculates a "synthetic" price for each candle:
- Close Price: It takes the average of the current period's Open, High, Low, and Close.
- Open Price: It uses the midpoint of the previous candle's values (the average of its Open and Close). This creates the signature "flat" look of Heikin Ashi candles during strong trends.
2. Dynamic Trend Smoothing The script offers different mathematical methods to calculate these averages, depending on your settings:
- Standard Averaging: Uses a basic calculation based on the user-defined period (default is 3.0).
- Zero-Lag Mode: If enabled, the script incorporates an "Exponential" and "Double Exponential" moving average logic. This is designed to reduce the delay typically found in lagging indicators, attempting to make the visual trend respond more quickly to sudden price shifts while still remaining smooth.
3. Visual Dynamics (Colors and Shapes) The indicator dynamically adjusts the visual appearance of the candles based on price movement:
- Bullish vs. Bearish: It detects if the price is moving up or down relative to the opening average and assigns colors accordingly (typically Lime Green for uptrends and Fire Brick for downtrends).
- Trend Visualization: In certain modes, it can adjust the "High" and "Low" boundaries of the candles to emphasize the direction of the trend, ensuring that the wicks (the thin lines on the candles) provide a clear signal of market sentiment.
User Customization Features
The script includes several built-in options to adapt to different trading styles:
- Averaging Period: Allows you to adjust how "smooth" the data appears; higher numbers result in smoother trends but more lag, while lower numbers are more responsive.
- Line Graph Mode: You can toggle between a traditional candlestick display and a simplified line graph, which focuses purely on the smoothed price path.
- Auto-Hide Features: Includes settings to hide specific visual elements (like the Close Line) when in Line Graph mode to provide a cleaner, less cluttered workspace.
Summary for the User
In short, this script acts as a visual filter. It takes the messy, jagged movement of the real market and translates it into smooth, colored bars that highlight the underlying trend. By using weighted averages (including optional "Zero-Lag" math), it helps you see where the price is "trying" to go, rather than just where it has been.
ÿþ/ / + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
# d e f i n e _ N A M E _ "