OPEN-SOURCE SCRIPT

Heikin Ashi Candle Time Frame @tradingbauhaus

Heikin Ashi Strategy with Moving Average Crossovers tradingbauhaus

This strategy is based on the interpretation of Heikin Ashi charts combined with the crossover of Exponential Moving Averages (EMA) to identify buy and sell signals. Additionally, an optional MACD filter is used to improve the accuracy of the signals.

What are Heikin Ashi Candles?

Heikin Ashi candles are a type of candlestick chart that smooths out market noise and makes trends easier to spot. The key difference between Heikin Ashi and regular candlesticks is that Heikin Ashi calculates open, close, high, and low differently, which helps identify trends more clearly.

How the Strategy Works:
Heikin Ashi Calculation:

Close (ha_close): It is calculated as the average of the open, high, low, and close of the regular candlestick.

ha_close = (open + high + low + close) / 4
Open (ha_open): It is calculated using the average of the previous Heikin Ashi open and close values, which smooths the series and better reflects trends:


ha_open := na(ha_open[1]) ? (open + close) / 2 : (ha_open[1] + ha_close[1]) / 2
High (ha_high): The maximum of the regular high, Heikin Ashi open, and Heikin Ashi close.
Low (ha_low): The minimum of the regular low, Heikin Ashi open, and Heikin Ashi close.
Buy and Sell Signals:

Buy Signal (Long): This is generated when the Heikin Ashi EMA (an exponential moving average calculated with Heikin Ashi prices) crosses above the Slow EMA. The signal is confirmed by the MACD crossover (if the MACD filter is enabled).
Sell Signal (Short): This is generated when the Heikin Ashi EMA crosses below the Slow EMA, indicating a potential downtrend.
MACD as an Optional Filter:

The MACD is a momentum indicator that shows the relationship between two moving averages. In this strategy, if the MACD filter is enabled, buy and sell signals will only be triggered if the MACD also aligns with the direction of the signal.
MACD Filter: The MACD is calculated on an independent timeframe and used as a filter. If the MACD confirms the trend (i.e., if the MACD is above its signal line for a buy or below for a sell), the signal is valid.
Moving Averages Calculations:

The Heikin Ashi EMA is calculated using the Heikin Ashi close values over a configurable period.
The SMA (Simple Moving Average) is calculated using the regular close prices of the candles.
Plotting the Signals:

When a buy signal is detected, a green upward triangle is plotted below the bar.
When a sell signal is detected, a red downward triangle is plotted above the bar.
Strategy Configuration:
Heikin Ashi Timeframe (res):

Here, you can choose the timeframe of the Heikin Ashi candles you wish to analyze (for example, 60 minutes).
Heikin Ashi EMA (fama):

Set the period for the Exponential Moving Average (EMA) used with Heikin Ashi prices.
Slow EMA (sloma):

Set the period for the Slow EMA that determines the crossover signals for buy and sell.
MACD Filter (macdf):

If enabled, the strategy will only trigger buy and sell signals if the MACD also confirms the trend. If disabled, the strategy will trigger signals regardless of the MACD.
MACD Timeframe (res2):

You can select the timeframe for calculating the MACD, so it can be compared with the other signals.
MACD Shift (macds):

This setting controls the amount of shift applied to the MACD calculation.
Trading Signals:
Buy Signal (Long):
Generated when the Heikin Ashi EMA crosses above the Slow EMA and the MACD confirms the trend (if the MACD filter is enabled). This indicates a potential opportunity to enter a long (buy) position.
Sell Signal (Short):
Generated when the Heikin Ashi EMA crosses below the Slow EMA and the MACD confirms the trend (if the MACD filter is enabled). This indicates a potential opportunity to enter a short (sell) position.
TradingView Script Code:
This code can be used directly on TradingView. It provides an automated trading strategy that calculates buy and sell signals and displays them as graphical arrows on the chart. It also includes alerts, so you can receive notifications when the strategy conditions are met.

Alerts:

Buy Alert: Triggered when the Heikin Ashi EMA crosses above the Slow EMA or when the MACD confirms the signal.
Sell Alert: Triggered when the Heikin Ashi EMA crosses below the Slow EMA or when the MACD confirms the signal.

How to Use the Strategy:
Add to Your Chart: Copy and paste the code into the Pine Script editor in TradingView and run it on your chart.

Adjust Parameters: You can modify parameters such as the period of the EMAs and MACD to tailor the strategy to your trading preferences.
Follow the Signals: Watch for buy and sell signals (green and red arrows) on the chart to identify potential entry and exit points.
Bands and ChannelsBreadth IndicatorsCandlestick analysis

Skrypt open-source

W prawdziwym duchu TradingView autor tego skryptu opublikował go jako open source, aby inwestorzy mogli go zrozumieć i zweryfikować. Pozdrowienia dla autora! Możesz go używać bezpłatnie, ale ponowne użycie tego kodu w publikacji podlega Zasadom Regulaminu. Możesz go oznaczyć jako ulubione, aby użyć go na wykresie.

Chcesz użyć tego skryptu na wykresie?


Join my trading community! 📈

🔹 Discord: discord.gg/7Fwru9gqbS
🔹 YouTube: youtube.com/@TradingBauhaus
🔹 Instagram: instagram.com/tradingbauhaus/

See you inside! 🚀
Również na:

Wyłączenie odpowiedzialności