OPEN-SOURCE SCRIPT

BFS-MACD-MACO+

The "Bollinger Fibonacci Strategy with MACD and MA Crossover" is a trading strategy designed for use in financial markets, such as stocks, forex, or cryptocurrencies. It combines several technical indicators, including Bollinger Bands, Fibonacci retracement levels, Moving Average Crossovers (MACD), and predicted market direction based on moving averages. The strategy aims to identify potential buy and sell signals based on these indicators and manage risk through stop-loss and take-profit levels.

Here's how the strategy works:

Bollinger Bands:
Bollinger Bands consist of three lines: the middle line (basis), the upper band (upper), and the lower band (lower).
The middle line (basis) is the Simple Moving Average (SMA) of the chosen price source over a specified length.
The upper and lower bands are calculated by adding and subtracting a specified number of standard deviations (mult * standard deviation) from the middle line.

Breakout Signal:
The strategy identifies a breakout signal when the current price crosses above the upper Bollinger Band, and the previous closing price was below the upper Bollinger Band.
A bullish breakout is indicated by a triangle-up shape below the corresponding candlestick.

Fibonacci Retracement Levels:
The strategy calculates several Fibonacci retracement levels based on the Bollinger Bands.
The levels include 0%, 23.6%, 38.2%, 50%, 61.8%, and 100% of the distance between the upper and lower Bollinger Bands.

Buy and Sell Conditions based on Fibonacci Retracement:
A buy signal is generated when the current price crosses above the upper Bollinger Band, and the close price is higher than the 38.2% Fibonacci retracement level.
A sell signal is generated when the current price crosses below the lower Bollinger Band, and the close price is lower than the 61.8% Fibonacci retracement level.

Stop Loss and Take Profit:
The stop-loss level is set at the basis (middle line) minus twice the Bollinger Band width.
The take-profit level is set at the basis (middle line) plus twice the Bollinger Band width.

MACD Indicator Implementation:
The strategy uses the Moving Average Convergence Divergence (MACD) indicator to identify potential trends and crossovers.
It calculates the MACD line and the Signal line using the specified fast and slow lengths and the selected smoothing method (SMA or EMA).
The histogram represents the difference between the MACD line and the Signal line.

Predicted Market Direction:
The strategy predicts the market direction based on the crossover of short-term and long-term moving averages.
If the short-term moving average crosses above the long-term moving average, it predicts a bullish (1) market direction. If it crosses below, it predicts a bearish (-1) market direction.

Plotting Predicted Path:
The strategy plots the predicted high and low prices based on the predicted market direction as dotted lines.

Overall, this trading strategy combines Bollinger Bands, Fibonacci retracement levels, and MACD indicator crossovers to identify potential entry and exit points in the market. It also uses predicted market direction to visualize potential future price movement. Traders can use this strategy as a starting point for further analysis and customization to fit their trading style and risk tolerance. Remember that no trading strategy can guarantee profits, and it's essential to thoroughly backtest and validate any strategy before applying it to real trading situations.
Bollinger Bands (BB)Moving Average Convergence / Divergence (MACD)Trend Analysis

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publication is governed by House rules. You can favorite it to use it on a chart.

Want to use this script on a chart?


Also on:

Disclaimer