OneThingToRuleThemAll [v1.4]This script was created because I wanted to be able to display a contextual chart of commonly used indicators for scalping and swing traders, with the ability to control the visual representation on the charts as their cross-overs, cross-unders, or changes of state happen in real time. Additionally, I wanted the ability to control how or when they are displayed. While looking through other community projects, I found they lacked the ability to full customize the output controls and values used for these indicators.
The script leverages standard RSI/MACD/VWAP/MVWAP/EMA calculations to help a trader visually make more informed decisions on entering or exiting a trade, depending on their understanding on what the indicators represent. Paired with a table directly on the chart, it allows a trader to quickly reference values to make more informed decisions without having to look away from the price action or look through multiple indicator outputs.
The main functionality of the indicator is controlled within the settings directly on the chart. There a user can enable the visual representations, or disable, and configure how they are displayed on the charts by altering their values or style types.
Users have the ability to enable/disable visual representations of:
The indicator chart
RSI Cross-over and RSI Reversals
MACD Uptrends and Downtrends
VWAP Cross-overs and Cross-unders
VWAP Line
MVWAP Cross-overs and Cross-unders
MVWAP Line
EMA Cross-overs and Cross-unders
EMA Line
Some traders like to use these visual indications as thresholds to enter or exit trades. Its best to find out which ones work the best with the security you are trying to trade. Personally, I use the table as a reference in conjunction with the RSI chart indicators to help me decide a logical trailing stop if I am scalping. Some users might like the track EMA200 crossovers, and have visual representations on the chart for when that happens. However, users may use the other indicators in other methods, and this script provides the ability to be able to configure those both visually and by value.
The pine script code is open source and itself is fairly straightforward, it is mostly written to provide the ultimate level of control the the user of the various indicators. Please reach out to me directly if you would like a further understanding of the code and an explanation on anything that may be unclear.
Enjoy :)
-dead1.
Moving Average Convergence / Divergence (MACD)
MACD of Relative Strenght StrategyMACD Relative Strenght Strategy :
INTRODUCTION :
This strategy is based on two well-known indicators: MACD and Relative Strenght (RS). By coupling them, we obtain powerful buy signals. In fact, the special feature of this strategy is that it creates an indicator from an indicator. Thus, we construct a MACD whose source is the value of the RS. The strategy only takes buy signals, ignoring SHORT signals as they are mostly losers. There's also a money management method enabling us to reinvest part of the profits or reduce the size of orders in the event of substantial losses.
RELATIVE STRENGHT :
RS is an indicator that measures the anomaly between momentum and the assumption of market efficiency. It is used by professionals and is one of the most robust indicators. The idea is to own assets that do better than average, based on their past performance. We calculate RS using this formula :
RS = close/highest_high(RS_Length)
Where highest_high(RS_Length) = highest value of the high over a user-defined time period (which is the RS_Length).
We can thus situate the current price in relation to its highest price over this user-defined period.
MACD (Moving Average Convergence - Divergence) :
This is one of the best-known indicators, measuring the distance between two exponential moving averages : one fast and one slower. A wide distance indicates fast momentum and vice versa. We'll plot the value of this distance and call this line macdline. The MACD uses a third moving average with a lower period than the first two. This last moving average will give a signal when it crosses the macdline. It is therefore constructed using the values of the macdline as its source.
It's important to note that the first two MAs are constructed using RS values as their source. So we've just built an indicator of an indicator. This kind of method is very powerful because it is rarely used and brings value to the strategy.
PARAMETERS :
RS Length : Relative Strength length i.e. the number of candles back to find the highest high and compare the current price with this high. Default is 300.
MACD Fast Length : Relative Strength fast EMA length used to plot the MACD. Default is 14.
MACD Slow Length : Relative Strength slow EMA length used to plot the MACD. Default is 26.
MACD Signal Smoothing : Macdline SMA length used to plot the MACD. Default is 10.
Max risk per trade (in %) : The maximum loss a trade can incur (in percentage of the trade value). Default is 8%.
Fixed Ratio : This is the amount of gain or loss at which the order quantity is changed. Default is 400, meaning that for each $400 gain or loss, the order size is increased or decreased by a user-selected amount.
Increasing Order Amount : This is the amount to be added to or subtracted from orders when the fixed ratio is reached. The default is $200, which means that for every $400 gain, $200 is reinvested in the strategy. On the other hand, for every $400 loss, the order size is reduced by $200.
Initial capital : $1000
Fees : Interactive Broker fees apply to this strategy. They are set at 0.18% of the trade value.
Slippage : 3 ticks or $0.03 per trade. Corresponds to the latency time between the moment the signal is received and the moment the order is executed by the broker.
Important : A bot has been used to test the different parameters and determine which ones maximize return while limiting drawdown. This strategy is the most optimal on BITSTAMP:ETHUSD in 8h timeframe with the parameters set by default.
ENTER RULES :
The entry rules are very simple : we open a long position when the MACD value turns positive. You are therefore LONG when the MACD is green.
EXIT RULES :
We exit a position (whether losing or winning) when the MACD becomes negative, i.e. turns red.
RISK MANAGEMENT :
This strategy can incur losses, so it's important to manage our risks well. If the position is losing and has incurred a loss of -8%, our stop loss is activated to limit losses.
MONEY MANAGEMENT :
The fixed ratio method was used to manage our gains and losses. For each gain of an amount equal to the value of the fixed ratio, we increase the order size by a value defined by the user in the "Increasing order amount" parameter. Similarly, each time we lose an amount equal to the value of the fixed ratio, we decrease the order size by the same user-defined value. This strategy increases both performance and drawdown.
Enjoy the strategy and don't forget to take the trade :)
Dynamic Trend Fusion (DTF)The "Dynamic Trend Fusion" (DTF) indicator is a powerful technical analysis tool for traders. It stands out from other indicators due to its adaptability and ability to provide insights into different trading styles. Users can choose from various trading options such as "Short-term Trading," "Long-term Trading," "Aggressive Short-term," "Conservative Long-term," "Balanced Approach," "High Sensitivity," "Low Sensitivity," "Day Trading," and "Swing Trading." These options allow traders to customize the indicator to suit their specific trading strategies.
DTF combines the Moving Average Convergence Divergence (MACD) and Relative Strength Index (RSI) indicators, normalizing them to a similar scale for a comprehensive view of market conditions. It then calculates a combined value and smoothes it using a moving average.
One of its standout features is the ability to identify bullish and bearish states, which is represented visually on the chart. When the indicator detects a transition from a bullish to a bearish state or vice versa, the color of the line changes.
Additionally, DTF offers alert conditions, notifying users when the market shifts into a bullish or bearish state, allowing for timely decision-making.
In summary, the DTF indicator sets itself apart by providing traders with a versatile tool that can be tailored to various trading styles and offers clear visual signals for trend changes, enhancing trading precision and efficiency.
Enhanced McClellan Summation Index
The Enhanced McClellan Summation Index (MSI) is a comprehensive tool that transforms the MSI indicator with Heikin-Ashi visualization, offering improved trend analysis and momentum insights. This indicator includes MACD and it's histogram calculations to refine trend signals, minimize false positives and offer additional momentum analysis.
Methodology:
McClellan Summation Index (MSI) -
The MSI begins by calculating the ratio between advancing and declining issues in the specified index.
float decl = 𝘐𝘯𝘥𝘪𝘤𝘦 𝘥𝘦𝘤𝘭𝘪𝘯𝘪𝘯𝘨 𝘪𝘴𝘴𝘶𝘦𝘴
float adv = 𝘐𝘯𝘥𝘪𝘤𝘦 𝘢𝘥𝘷𝘢𝘯𝘤𝘪𝘯𝘨 𝘪𝘴𝘴𝘶𝘦𝘴
float ratio = (adv - decl) / (adv + decl)
It then computes a cumulative sum of the MACD (the difference between a 19-period EMA and a 39-period EMA) of this ratio. The result is a smoothed indicator reflecting market breadth and momentum.
macd(float r) =>
ta.ema(r, 19) - ta.ema(r, 39)
float msi = ta.cum(macd(ratio))
Heikin-Ashi Transformation -
Heikin-Ashi is a technique that uses a modified candlestick formula to create a smoother representation of price action. It averages the open, close, high, and low prices of the current and previous periods. This transformation reduces noise and provides a clearer view of trends.
type bar
float o = open
float h = high
float l = low
float c = close
bar b = bar.new()
float ha_close = math.avg(b.o, b.h, b.l, b.c)
MACD and Histogram -
The Enhanced MSI incorporates MACD and histogram calculations to provide additional momentum analysis and refine trend signals. The MACD represents the difference between the 12-period EMA and the 26-period EMA of the MSI. The histogram is the visual representation of the difference between the MACD and its signal line.
Options:
Index Selection - Choose from TVC:NYA , NASDAQ:NDX , or TVC:XAX to tailor the MSI-HA to the desired market index.
MACD Settings - Adjust the parameters for the MACD calculation to fine-tune the indicator's responsiveness.
Ratio Multiplier - Apply scaling to the MSI to suit different market conditions and indices.
Benefits of Heikin-Ashi -
Smoothed Trends - Heikin-Ashi reduces market noise, providing a more apparent and smoothed representation of trends.
Clearer Patterns - Candlestick patterns are more distinct, aiding in the identification of trend reversals and continuations.
Utility and Use Cases:
Trend & Momentum Analysis - Utilize the tool's Heikin-Ashi visualization for clearer trend identification in confluence with it's MACD and histogram to gain additional insights into the strength and direction of trends, while filtering out potential false positives.
Breadth Analysis - Explore market breadth through the MSI's cumulative breadth indicator, gauging the overall health and strength of the underlying market.
- Alerts Setup Guide -
The Enhanced MSI is a robust indicator that combines the breadth analysis of the McClellan Summation Index with the clarity of Heikin-Ashi visualization and additional momentum insights from MACD and histogram calculations. Its customization options make it adaptable to various indices and market conditions, offering traders a comprehensive tool for trend and momentum analysis.
MACD Pulse CheckThis custom script, titled " MACD Pulse Check ," is a modified and enhanced version of the traditional Moving Average Convergence Divergence (MACD) indicator, commonly used in trading for trend-following and momentum strategies. Here's a breakdown of its features and benefits over the traditional MACD:
Multiple MACD Lines with Different Parameters:
The script calculates six different MACD lines using various combinations of fast, slow, and signal lengths. This diverse range allows for a more comprehensive analysis of the market momentum and trend across different time scales and sensitivities.
Average of MACD Lines:
By averaging these six MACD lines, the script creates a more smoothed and potentially less noisy signal. This can help in reducing false signals and improving the reliability of trend indications.
Sideways Market Detection:
A unique feature of this script is its ability to identify sideways or range-bound markets using a user-defined threshold. This is calculated by comparing the current price to the price five candles ago and seeing if the change is within a certain percentage threshold. Identifying sideways markets is crucial as trend-following strategies like MACD typically perform poorly in these conditions.
Visual and Color-Coded Signals:
The script plots shapes (circles) on the chart, where the color (green for bullish, red for bearish, sideways price action will display as either a dull green or a dull red) quickly indicates the market condition. This visual representation makes it easier to interpret the signals at a glance, and spot sideways price action while still having a general idea of trend.
Benefits for Traders:
Versatility: By averaging multiple MACD lines, traders get a more nuanced view of the market momentum, potentially leading to more informed trading decisions.
Reduced False Signals:
The averaging process and sideways market detection can help in filtering out false or weak signals, which is a common issue with the traditional MACD.
Ease of Use:
The color-coded visual signals simplify the process of identifying market trends and conditions, making the tool accessible even for less experienced traders.
In summary, "MACD Pulse Check" enhances the traditional MACD by providing a more comprehensive, and visually intuitive tool, potentially leading to better trading decisions in varying market conditions. However, it's important to note that no indicator is foolproof and should always be used in conjunction with other analysis methods and sound risk management practices.
MACD_RSI_trend_followingINFO:
This indicator can be used to build-up a strategy for trading of assets which are currently in trending phase.
My preference is to use it on slowly moving assets like GOLD and on higher timeframes, but practice may show that we find more usefull cases.
This script uses two indicators - MACD and RSI, as the timeframe that those are extracted for is configurable (defaults with the Chart TF, but can be any other selected by the user).
The strategy has the following simple idea - buy if any if the conditions below is true:
The selected TF MACD line crosses above the signal line and the TF RSI is above the user selected trigger value
The selected TF MACD line is above the signal line and the TF RSI crosses above the user selected trigger value
Once we're in position we wait for the selected TF MACD line to cross below the signal line, and then we set a SL at the low of that bar
DETAILS and USAGE:
In the current implementation I find two possible use cases for the indicator:
as a stand-alone indicator on the chart which can also fire alerts that can help to determine if we want to manually enter/exit trades based on them
can be used to connect to the Signal input of the TTS (TempalteTradingStrategy) by jason5480 in order to backtest it, thus effectively turning it into a strategy (instructions below in TTS CONNECTIVITY section)
In the example below we see a position opened at the bar after the buy indicator from the script has been triggered, and then later after the SL indicator from the script has been triggered a SL has been set on the lower wick of the closing candle, and the position eventually got closed once the price hit that level. Note that most of the drawing on the example snapshot below are from the TTS indicator following the buy/sell/SL conditions themseves:
Trading period can be selected from the indicator itself to limit to more interesting periods.
Arrow indications are drawn on the chart to indicate the trading conditions met in the script - green arrow for a buy signal indication and orange for LTF crossunder to indicate setting of SL.
SETTINGS:
Leaving all of the settings as in vanilla use case, as both the MACD and RSI indicator's settings follow the default ones for the stand-alone indicators themselves.
The start-end date is a time filter that can be extermely usefull when backtesting different time periods.
Pesonal preference is using the script on a D/W timeframe, while the indicator is configured to use Monthly chart.
The default value of the RSI filter is left to 50, which can be changed. I.e. if the RSI is above 50 we have a regime filter based on the MACD criteria.
EXTERNAL LIBRARIES:
The script uses a couple of external libraries:
HeWhoMustNotBeNamed/enhanced_ta/14 - collection of TA indicators
jason5480/tts_convention/3 - more details about the Template Trading Strategy below
I would like to highly appreciate and credit the work of both HeWhoMustNotBeNamed and jason5480 for providing them to the community.
TTS SETTINGS (NEEDED IF USED TO BACKTEST WITH TTS):
The TempalteTradingStrategy is a strategy script developed in Pine by jason5480, which I recommend for quick turn-around of testing different ideas on a proven and tested framework
I cannot give enough credit to the developer for the efforts put in building of the infrastructure, so I advice everyone that wants to use it first to get familiar with the concept and by checking
by checking jason5480's profile www.tradingview.com
The TTS itself is extremely functional and have a lot of properties, so its functionality is beyond the scope of the current script -
Again, I strongly recommend to be thoroughly epxlored by everyone that plans on using it.
In the nutshell it is a script that can be feed with buy/sell signals from an external indicator script and based on many configuration options it can determine how to execute the trades.
The TTS has many settings that can be applied, so below I will cover only the ones that differ from the default ones, at least according to my testing - do your own research, you may find something even better :)
The current/latest version that I've been using as of writing and testing this script is TTSv48
Settings which differ from the default ones:
from - False (time filter is from the indicator script itself)
Deal Conditions Mode - External (take enter/exit conditions from an external script)
🔌Signal 🛈➡ - MACD_RSI_trend_following: 🔌Signal to TTSv48 (this is the output from the indicator script, according to the TTS convention)
Sat/Sun - true (for crypto, in order to trade 24/7)
Order Type - STOP (perform stop order)
Distance Method - HHLL (HigherHighLowerLow - in order to set the SL according to the strategy definition from above)
The next are just personal preferenes, you can feel free to experiment according to your trading style
Take Profit Targets - 0 (either 100% in or out, no incremental stepping in or out of positions)
Dist Mul|Len Long/Short- 10 (make sure that we don't close on profitable trades by any reason)
Quantity Method - EQUITY (personal backtesting preference is to consider each backtest as a separate portfolio, so determine the position size by 100% of the allocated equity size)
Equity % - 100 (note above)
Dual_MACD_trendingINFO:
This indicator is useful for trending assets, as my preference is for low-frequency trading, thus using BTCUSD on 1D/1W chart
In the current implementation I find two possible use cases for the indicator:
- as a stand-alone indicator on the chart which can also fire alerts that can help to determine if we want to manually enter/exit trades based on the signals from it (1D/1W is good for non-automated trading)
- can be used to connect to the Signal input of the TTS (TempalteTradingStrategy) by jason5480 in order to backtest it, thus effectively turning it into a strategy (instructions below in TTS CONNECTIVITY section)
Trading period can be selected from the indicator itself to limit to more interesting periods.
Arrow indications are drawn on the chart to indicate the trading conditions met in the script - light green for HTF crossover, dark green for LTF crossover and orange for LTF crossunder.
Note that the indicator performs best in trending assets and markets, and it is advisable to use additional indicators to filter the trading conditions when market/asset is expected to move sideways.
DETAILS:
It uses a couple of MACD indicators - one from the current timeframe and one from a higher timeframe, as the crossover/crossunder cases of the MACD line and the signal line indicate the potential entry/exit points.
The strategy has the following flow:
- If the weekly MACD is positive (MACD line is over the signal line) we have a trading window.
- If we have a trading window, we buy when the daily macd line crosses AND closes above the signal line.
- If we are in a position, we await the daily MACD to cross AND close under the signal line, and only then place a stop loss under the wick of that closing candle.
The user can select both the higher (HTF) and lower (LTF) timeframes. Preferably the lower timeframe should be the one that the Chart is on for better visualization.
If one to decide to use the indicator as a strategy, it implements the following buy and sell criterias, which are feed to the TTS, but can be also manually managed via adding alerts from this indicator.
Since usually the LTF is preceeding the crossover compared to the HTF, then my interpretation of the strategy and flow that it follows is allowing two different ways to enter a trade:
- crossover (and bar close) of the macd over the signal line in the HIGH TIMEFRAME (no need to look at the LOWER TIMEFRMAE)
- crossover (and bar close) of the macd over the signal line in the LOW TIMEFRAME, as in this case we need to check also that the macd line is over the signal line for the HIGH TIMEFRAME as well (like a regime filter)
The exit of the trade is based on the lower timeframe MACD only, as we create a stop loss equal to the lower wick of the bar, once the macd line crosses below the signal line on that timeframe
SETTINGS:
All of the indicator's settings are for the vanilla/general case.
User can set all of the MACD parameters for both the higher and lower (current) timeframes, currently left to default of the MACD stand-alone indicator itself.
The start-end date is a time filter that can be extermely usefull when backtesting different time periods.
TTS SETTINGS (NEEDED IF USED TO BACKTEST WITH TTS)
The TempalteTradingStrategy is a strategy script developed in Pine by jason5480, which I recommend for quick turn-around of testing different ideas on a proven and tested framework
I cannot give enough credit to the developer for the efforts put in building of the infrastructure, so I advice everyone that wants to use it first to get familiar with the concept and by checking
by checking jason5480's profile www.tradingview.com
The TTS itself is extremely functional and have a lot of properties, so its functionality is beyond the scope of the current script -
Again, I strongly recommend to be thoroughly epxlored by everyone that plans on using it.
In the nutshell it is a script that can be feed with buy/sell signals from an external indicator script and based on many configuration options it can determine how to execute the trades.
The TTS has many settings that can be applied, so below I will cover only the ones that differ from the default ones, at least according to my testing - do your own research, you may find something even better :)
The current/latest version that I've been using as of writing and testing this script is TTSv48
Settings which differ from the default ones:
- from - False (time filter is from the indicator script itself)
- Deal Conditions Mode - External (take enter/exit conditions from an external script)
- 🔌Signal 🛈➡ - Dual_MACD: 🔌Signal to TTSv48 (this is the output from the indicator script, according to the TTS convention)
- Sat/Sun - true (for crypto, in order to trade 24/7)
- Order Type - STOP (perform stop order)
- Distance Method - HHLL (HigherHighLowerLow - in order to set the SL according to the strategy definition from above)
The next are just personal preferenes, you can feel free to experiment according to your trading style
- Take Profit Targets - 0 (either 100% in or out, no incremental stepping in or out of positions)
- Dist Mul|Len Long/Short- 10 (make sure that we don't close on profitable trades by any reason)
- Quantity Method - EQUITY (personal backtesting preference is to consider each backtest as a separate portfolio, so determine the position size by 100% of the allocated equity size)
- Equity % - 100 (note above)
EXAMPLES:
If used as a stand-alone indicator, the green arrows on the bottom will represent:
- light green - MACD line crossover signal line in the HTF
- darker green - MACD line crossover signal line in the LTF
- orange - MACD line crossunder signal line in the LTF
I recommend enabling the alerts from the script to cover those cases.
If used as an input to the TTS, we'll get more decorations on the chart from the TTS itself.
In the example below we open a trade on the next day of LTF crossover, then a few days later a crossunder in the LTF occurs, so we set a SL at the low of the wick of this day. Few days later the price doesn't recover and hits that SL, so the position is closed.
MACD_base_and_reference_TF//====================================================================================================================
The "MACD_with_reference" indicator aims to illustrate the MACD (Moving Average Convergence Divergence) on two distinct timeframes: the base timeframe (typically the chart's timeframe, e.g., 1D) and the reference timeframe (defaulted to 1W). This tool provides a means to determine momentum shifts within the stock, potentially guiding traders in adjusting or trimming positions.
// ================================================== INFO ==================================================
Key Features of the Indicator:
- Dual Timeframe MACD: Displays MACD on both the primary (base) and higher (reference) timeframes - transparent.
- Momentum Analysis: indication of MACD crossdown of the signal line on the refenence TF to indicate momentum loss on the higher timeframe, guiding decisions to manage positions.
- MACD Line Status: Beneath the chart, a red/green bar line signifies the MACD line's position relative to the signal line on the higher timeframe.
- Alert Creation: Allows for alerts on the MACD and signal line crossdown on the higher timeframe, aiding in planning stop-loss settings for owned stocks.
// ================================================== NOTES ==================================================
The "MACD_with_reference" indicator finds optimal usage in several scenarios:
- Chart Analysis: Replacing the MACD indicator during chart reviews.
- Alert Setup: Setting alerts for owned stocks to plan ahead for stop-loss placements or position closures.
// ================================================== TODO ==================================================
//#endregion ========================================================================================================
// Continue the script code...
Heatmap MACD StrategyHello traders
A customer gave me the idea indirectly after I made an update to that script:
Supertrend MTF Heatmap
Important Notes
The backtest results aren't relevant for this educational script publication.
I used realistic backtesting data but didn't look too much into optimizing the results, as this isn't the point of why I'm publishing this script.
I wanted to showcase that any Heatmap script can be converted into a strategy.
The strategy default settings are:
Initial Capital: 100000 USD
Position Size: 1 contract
Commission Percent: 0.075%
Slippage: 1 tick
No margin/leverage used
For example, those are realistic settings for trading CFD indices with low timeframes, but not the best possible settings for all assets/timeframes.
Concept
The Heatmap MACD Strategy allows selecting one MACD in five different timeframes.
You'll get an exit signal whenever one of the 5 MACDs changes direction.
Then, the strategy re-enters whenever all the MACDs are in the same direction again.
It takes:
long trades when all the 5 MACD histograms are bullish
short trades when all the 5 MACD histograms are bearish
You can select the same timeframe multiple times if you don't need five timeframes.
For example, if you only need the 30min, the 1H, and 2H, you can set your timeframes as follow:
30m
30m
30m
1H
2H
Risk Management Features
Nothing too fancy
All the features below are pips-based
Stop-Loss
Trailing Stop-Loss
Stop-Loss to Breakeven after a certain amount of pips has been reached
Take Profit 1st level and closing X% of the trade
Take Profit 2nd level and close the remaining of the trade
What's next?
I'll publish this script's open-source Pineconnector, ProfitView, and AutoView versions for educational purposes.
Thank you
Dave
MACD AreaThis indicator calculates and displays the cumulative area for each region above and below the zero line in the MACD histogram. This area measurement serves as a momentum metric, where larger cumulative areas indicate stronger momentum. Divergences between the area and price can also potentially indicate an impending reversal. For example, when the stock price makes a higher high but the area makes a lower high, the current momentum may be unsustainable.
Double MACD Pattern 1.0This script is designed to assist traders in identifying potential trading signals and trends based on the MACD indicator. Users can adjust the input parameters to fine-tune the indicator to their trading preferences. When specific conditions are met, alerts are generated to notify the user of potential trading opportunities.
Indicator Description:
The script defines a custom indicator that calculates and plots two sets of Moving Average Convergence Divergence (MACD) lines along with their signal lines.
It allows users to configure various parameters for MACD calculation, such as fast and slow lengths for both MACD 1 and MACD 2, as well as signal lengths for both.
Plotting:
The script plots the MACD lines and signal lines for both MACD 1 and MACD 2 on the chart with different colors and line styles.
It also plots a middle line at zero for reference.
Alerts:
The script defines conditions for generating alerts based on MACD crossover and crossunder events for both MACD 1 and MACD 2.
Alerts are generated for the following scenarios:
A long signal is generated when MACD 1 crosses under its signal line while MACD 2 crosses over its signal line.
A short signal is generated when MACD 1 crosses over its signal line while MACD 2 crosses under its signal line.
An up trend signal is generated when MACD 2 crosses over MACD 1.
A down trend signal is generated when MACD 1 crosses over MACD 2.
Alerts are included in the script to notify users of these specific trading signals.
Please note that this script is meant for educational purposes and should be used cautiously in a real trading environment. It's important to have a thorough understanding of technical analysis and risk management when using such indicators in actual trading.
Weighted Oscillator Convergence DivergenceThe Weighted Oscillator Convergence Divergence (WOCD) aims to help traders identify potential trend reversals or momentum shifts in financial markets by calculating and visualizing the difference between a smoothed oscillator (WMA) value and its exponential moving average (EMA) and simple moving average (SMA) counterparts. This indicator is particularly useful for traders who want an alternative perspective on price momentum and divergence.
Key Features:
Inputs:
Length: The user can specify the number of bars to consider for calculations (default is 9).
Smoothing 1: Defines the smoothing factor for the first smoothed value (default is 5).
Smoothing 2: Specifies the smoothing factor for the second smoothed value (default is 7).
Ma Type: There are three types of moving averages you can choose (Wilder, non-lag, Weighted is by default).
Color Settings: Users can customize the indicator's colors for various elements, such as length, smoothing values, and different sections of the histogram.
Calculation:
WOCD calculates the raw oscillator value by subtracting the close price from a 3-period High, Low, Close (HLC3) moving average.
It then applies smoothing to this raw oscillator value using two different methods: exponential moving average (EMA) and simple moving average (SMA) with user-defined smoothing periods.
Histogram Plot:
The indicator plots a histogram based on the difference between the smoothed oscillator and the first smoothed value.
When the histogram is above zero and rising, it is colored according to the "Above Grow" color setting. When it's above zero and falling, it uses the "Fall" color for visualization.
Similarly, when the histogram is below zero and rising, it is colored according to the "Below Grow" color setting, and when it's below zero and falling, it uses the "Fall" color.
Oscillator and Smoothed Values:
The indicator also plots the smoothed oscillator, smoothed value 1 (EMA-based), and smoothed value 2 (SMA-based) on the chart.
Zero Line:
A horizontal line at zero is drawn on the chart for reference.
How to Use the WOCD Indicator:
Trend Identification: Observe the histogram's direction and color. A rising histogram above zero may indicate bullish momentum, while a falling histogram below zero could signal bearish momentum.
Divergence: Look for divergences between price action and the histogram. When the histogram and price move in opposite directions, it can be a potential reversal signal.
Crossovers: Pay attention to crossovers between the smoothed oscillator and its smoothed counterparts (EMA and SMA). These crossovers can indicate changes in trend strength or direction.
Zero Line: The zero line can act as a reference point. Positive histogram values suggest bullish sentiment, while negative values indicate bearish sentiment.
Comparison to MACD Indicator:
The WOCD indicator shares some similarities with the Moving Average Convergence Divergence (MACD) indicator but also has distinct differences:
Similarities:
Both WOCD and MACD are momentum oscillators designed to identify potential trend reversals and divergences.
They use moving averages (EMA in the case of MACD) to smooth the raw oscillator values.
Both indicators provide histogram representations of the difference between the oscillator and its smoothed counterpart.
Differences:
WOCD uses a 3-period High, Low, Close (HLC3) moving average to calculate the raw oscillator value, whereas MACD uses the difference between two exponential moving averages (usually 12-period and 26-period EMAs).
The smoothing in WOCD employs both EMA and SMA, while MACD exclusively uses EMA.
WOCD allows users to customize colors for various elements, enhancing visual clarity.
Alxuse MACD for tutorialAll abilities of MACD, moreover :
Drawing upper band and lower band & the ability to change values, change colors, turn on/off show.
Crossing MACD line and SIGNAL line in multi timeframe & there are symbols (Circles) with green color (Buy) and red color (Sell) & the ability to change colors, turn on/off show.
Crossing MACD line and SIGNAL line in multi timeframe according to the values of upper band and lower band & there are symbols (Triangles) with green color (Long) and red color (Short) & the ability to change colors, turn on/off show.
The ability used in the alert section and create customized alerts.
To receive valid alerts the replay section , the timeframe of the chart must be the same as the timeframe of the indicator.
MACD (Moving Average Convergence/Divergence)
Definition
MACD is an extremely popular indicator used in technical analysis. MACD can be used to identify aspects of a security's overall trend. Most notably these aspects are momentum, as well as trend direction and duration. What makes MACD so informative is that it is actually the combination of two different types of indicators. First, MACD employs two Moving Averages of varying lengths (which are lagging indicators) to identify trend direction and duration. Then, MACD takes the difference in values between those two Moving Averages (MACD Line) and an EMA of those Moving Averages (Signal Line) and plots that difference between the two lines as a histogram which oscillates above and below a center Zero Line. The histogram is used as a good indication of a security's momentum.
MACD Line is a result of taking a longer term EMA and subtracting it from a shorter term EMA.The most commonly used values are 26 days for the longer term EMA and 12 days for the shorter term EMA, but it is the trader's choice.
The Signal Line.
The Signal Line is an EMA of the MACD Line described in Component 1. The trader can choose what period length EMA to use for the Signal Line however 9 is the most common.
The MACD Histogram.
As time advances, the difference between the MACD Line and Signal Line will continually differ. The MACD histogram takes that difference and plots it into an easily readable histogram. The difference between the two lines oscillates around a Zero Line.
A general interpretation of MACD is that when MACD is positive and the histogram value is increasing, then upside momentum is increasing. When MACD is negative and the histogram value is decreasing, then downside momentum is increasing.
What to look for
The MACD indicator is typically good for identifying three types of basic signals; Signal Line Crossovers, Zero Line Crossovers, and Divergence.
SIGNAL LINE CROSSOVERS
A Signal Line Crossover is the most common signal produced by the MACD. First one must consider that the Signal Line is essentially an indicator of an indicator. The Signal Line is calculating the Moving Average of the MACD Line. Therefore the Signal Line lags behind the MACD line. That being said, on the occasions where the MACD Line crosses above or below the Signal Line, that can signify a potentially strong move.
The strength of the move is what determines the duration of Signal Line Crossover. Understanding and being able to analyze move strength, as well as being able to recognize false signals, is a skill that comes with experience.
The first type of Signal Line Crossover to examine is the Bullish Signal Line Crossover. Bullish Signal Line Crossovers occur when the MACD Line crosses above the Signal Line.
The second type of Signal Line Crossover to examine is the Bearish Signal Line Crossover. Bearish Signal Line Crossovers occur when the MACD Line crosses below the Signal Line.
Zero line crossovers
Zero Line Crossovers have a very similar premise to Signal Line Crossovers. Instead of crossing the Signal Line, Zero Line Crossovers occur when the MACD Line crossed the Zero Line and either becomes positive (above 0) or negative (below 0).
The first type of Zero Line Crossover to examine is the Bullish Zero Line Crossover. Bullish Zero Line Crossovers occur when the MACD Line crosses above the Zero Line and go from negative to positive.
The second type of Zero Line Crossover to examine is the Bearish Zero Line Crossover. Bearish Zero Line Crossovers occur when the MACD Line crosses below the Zero Line and go from positive to negative.
Divergence
Divergence is another signal created by the MACD. Simply put, divergence is when the MACD and actual price are not in agreement.
For example, Bullish Divergence occurs when price records a lower low, but the MACD records a higher low. The movement of price can provide evidence of the current trend, however changes in momentum as evidenced by the MACD can sometimes precede a significant reversal.
Bearish Divergence is, of course, the opposite. Bearish Divergence occurs when price records a higher high while the MACD records a lower high.
Summary
What makes the MACD such a valuable tool for technical analysis is that it is almost like two indicators in one. It can help to identify not just trends, but it can measure momentum as well. It takes two separate lagging indicators and adds the aspect of momentum which is much more active or predictive That kind of versatility is why it has been and is used by trader's and analysts across the entire spectrum of finance.
Despite MACD's obvious attributes, just like with any indicator, the trader or analyst needs to exercise caution. There are just some things that MACD doesn't do well which may tempt a trader regardless. Most notably, traders may be tempted into using MACD as a way to find overbought or oversold conditions. This is not a good idea. Remember, MACD is not bound to a range, so what is considered to be highly positive or negative for one instrument may not translate well to a different instrument.
With sufficient time and experience, almost anybody who wants to analyze chart data should be able to make good use out of the MACD.
The added features to the indicator are made for training, it is advisable to use it with caution in tradings.
Zaree - Bull & Bear Volume VoidThe "Zaree - Bull & Bear Volume Void" (BBVV) indicator is a versatile tool designed to help traders assess the dynamics of bull and bear power in the market, with a focus on volume-based analysis. This indicator offers a range of features that aid in identifying potential shifts in market sentiment and strength.
Details of the Indicator:
Volume Void Color Settings: This indicator allows you to customize the colors used for different conditions, such as strong bull areas, slowing bull areas, strong bear areas, and slowing bear areas. These colors play a crucial role in visualizing the indicator's output.
Volume Void Settings: The BBVV indicator provides options for selecting specific volume void functions, which include "Relative Volume Comparison," "Percentage of Average Volume," "Fixed Volume Threshold," "Volatility-Adjusted Volume," "Compare to Previous Volume Bars," "Volume Percentile Rank," and "Market Session Comparison." Each function has its own criteria for evaluating volume conditions.
Void Bull Sensitivity and Void Bear Sensitivity: These are key parameters in the settings. The values you choose for void bull sensitivity and void bear sensitivity will significantly impact the background color displayed by the indicator. Properly configuring these values is crucial for the indicator's effectiveness.
Moving Average Settings: You can specify the source and length of moving averages used in the indicator. This helps in smoothing out data and providing a clearer picture of bull and bear power.
Void Color Background Conditions: The indicator dynamically changes the background color of the chart based on the current market conditions. It takes into account bull and bear power, as well as the configured sensitivity levels to determine whether the market is in a strong or slowing bull/bear phase.
MACD and Signal Lines: The indicator also displays MACD and signal lines on the chart, helping traders identify potential bullish and bearish crossovers.
Histogram Bars: Histogram bars are used to represent the strength of bull and bear power. Above-zero bars indicate bullish strength, while below-zero bars indicate bearish strength.
How to Use the Indicator:
Begin by customizing the color settings for different market conditions to your preference.
Select a volume void function that aligns with your trading strategy and objectives.
Configure the void bull sensitivity and void bear sensitivity values carefully. These values should reflect your desired sensitivity to volume conditions.
Choose the source and length of moving averages based on your analysis requirements.
Pay attention to the background color of the chart. It will change dynamically based on the current market conditions, providing insights into the strength of bull and bear power.
Observe the MACD and signal lines for potential bullish or bearish crossovers, which can be used as additional confirmation signals.
Interpret the histogram bars to gauge the strength of bull and bear power.
Example of Usage:
As a swing trader with a focus on volume analysis, you can use the BBVV indicator to enhance your trading decisions. Here's an example of how you might use the indicator:
Select "Relative Volume Comparison" as the volume void function to assess volume relative to a simple moving average.
Configure void bull sensitivity and void bear sensitivity to match your risk tolerance and trading style.
Choose "SMA" as the moving average type with a suitable length.
Pay attention to the background color changes in the chart. Strong bull areas may indicate potential bullish opportunities, while strong bear areas may signal bearish conditions.
Monitor the MACD and signal lines for potential crossovers, aligning them with the background color to validate your trading decisions.
Use the histogram bars to assess the strength of bull and bear power, helping you gauge market sentiment.
Remember that the BBVV indicator is a valuable tool to complement your trading strategy. It provides insights into volume dynamics and market conditions, allowing you to make informed trading choices.
Be sure to adjust the indicator settings according to your trading preferences and always consider the broader market context in your analysis.
Volatility Adjusted MACDMACD, short for moving average convergence/divergence, is a trading indicator used in technical analysis of securities prices, created by Gerald Appel in the late 1970s. It is designed to reveal changes in the strength, direction, momentum, and duration of a trend in a stock's price.
The MACD indicator (or "oscillator") is a collection of three time series calculated from historical price data, most often the closing price. These three series are: the MACD series proper, the "signal" or "average" series, and the "divergence" series which is the difference between the two. The MACD series is the difference between a "fast" (short period) exponential moving average (EMA), and a "slow" (longer period) EMA of the price series. The average series is an EMA of the MACD series itself.
This version of MACD follows the work of Alex Spiroglou, DipTA(ATAA), CFTe in his 2022 paper that was awarded Charles H. Dow Award by CMT Association . The paper is available on papers.ssrn.com or on website.of CMT Association.
Please refer to the paper for details on construction and trading rules . I personally find the volatility adjusted version as described in this paper more responsive in terms of signals and divergences.
Dual-Supertrend with MACD - Strategy [presentTrading]## Introduction and How it is Different
The Dual-Supertrend with MACD strategy offers an amalgamation of two trend-following indicators (Supertrend 1 & 2) with a momentum oscillator (MACD). It aims to provide a cohesive and systematic approach to trading, eliminating the need for discretionary decision-making.
Key advantages over traditional single-indicator strategies:
- Dual Supertrend Validation: Utilizes two Supertrend indicators with different ATR periods and factors to confirm the trend direction. This double-check mechanism minimizes false signals.
- Momentum Confirmation: The MACD histogram acts as a momentum filter, confirming entries and exits, thus adding an extra layer of validation.
- Objective Entry and Exit: The strategy generates buy and sell signals based on a combination of trend direction and momentum, leaving no room for subjective interpretation.
- Automated Trade Management: The strategy includes built-in settings for commission, slippage, and initial capital, automating the trade execution process.
- Adaptability: The strategy allows for easy customization of all its parameters, adapting to a trader's specific needs and varying market conditions.
BTCUSD 8hr chart Long Condition
BTCUSD 6hr chart Long Short Condition
## Strategy, How it Works
The strategy operates on a set of clearly defined rules, primarily focusing on the trend direction confirmed by the Dual-Supertrend and the momentum as indicated by the MACD histogram.
### Entry Rules
- Long Entry: When both Supertrend indicators are bullish and the MACD histogram is above zero.
- Short Entry: When both Supertrend indicators are bearish and the MACD histogram is below zero.
### Exit Rules
- Exit long positions when either of the Supertrends turn bearish or the MACD histogram drops below zero.
- Exit short positions when either of the Supertrends turn bullish or the MACD histogram rises above zero.
### Trade Management
- The strategy uses a fixed commission rate and slippage in its calculations.
- Automated risk management features are integrated to avoid overexposure.
## Trade Direction
The strategy allows for trading in both bullish and bearish markets. Users can select their preferred trading direction ("long", "short", or "both") to align with their market outlook and trading objectives.
## Usage
- The strategy is best applied on timeframes where the trend is evident.
- Users can modify the ATR periods, factors for Supertrends, and MACD settings to suit their trading needs.
## Default Settings
- ATR Period for Supertrend 1: 10
- Factor for Supertrend 1: 3.0
- ATR Period for Supertrend 2: 20
- Factor for Supertrend 2: 5.0
- MACD Fast Length: 12
- MACD Slow Length: 26
- MACD Signal Smoothing: 9
- Commission: 0.1%
- Slippage: 1 point
- Trading Direction: Both
The strategy comes with these default settings to offer a balanced trading approach but can be customized according to individual trading preferences.
Realtime Divergence for Any Indicator - By John BartleThe main purpose of this script is to show historical and real-time divergences for any oscillating indicator. The secondary purpose is to give the user a lot of precise control over identifying divergences and determining what they are. This is an improved version of my other script which is similarly called "Realtime Divergence for Any Indicator"
There are four types of divergences that are offered:
Bull divergence
Hidden bull divergence
Bear divergence
Hidden Bear divergence
There are three types of potential(real-time) divergences which include:
1) Without right side bars for rightside pivots. Plus without waiting for the rightside pivot bar to complete
2) Without right side bars for rightside pivots. Plus with waiting for the rightside pivot bar to complete
3) With right side bars for rightside pivots. Plus without waiting for the rightside pivot right-most bar to complete
A definite divergence occurs when all specified bars are accounted for and fully formed.
Potential divergences use dashed lines and definite(historical) divergences use solid lines.
In addition to several other categories of settings to filter out unwanted divergences or manipulate the search process, this script also offers Alerts. Remember that alerts must not only be set within this scripts settings but also your "Alerts" panel on your right. It's strange but BOTH must be set for alerts to work...
Other interesting Things To Know:
1)I actually don't trade and so I have no need of a paid account. Unpaid accounts don't have the playback feature so I haven't really tested this script out very well. Sorry. Just let me know if something seems off and IF I have time I'll try to fix it.
2)Keep in mind that Pinescript limits the number of lines that can be shown at one time. This means that if your settings allow for a large number of divergence lines they will be removed from the leftward side of your chart but appear in the rightward side.
3) The time and the values for the price or oscillator are not the same things as each other nor are they physical things with physical space. This means that slopes of lines using the time as X and value as Y can not have definite angles. Consequently, under the setting "DIVERGENCES: SLOPE ANGLE EXCLUSION" YOU have to decide what slope equals what angle by using the setting called "Normalization Factor".
4) Remember that some individual settings apply to both the oscillator and price chart. This means that even if the setting's conditions are fulfilled in one they may not be fulfilled in the other.
5) Under the category "DIVERGENCES: INTERSECTION ALLOWANCE", if you set the "Measurement Type" to Relative Percentage then FYI any single given length will equate to an increasingly smaller percentage the further away from zero it is. Because of this, I think "Reletive Percentage" is probably only useful for price charts or oscillators with big values. Maybe >200 is OK ?
Errors:
1) If you get the error mentioning that the script must complete execution within X amount of time, this is because this is a big script and sometimes takes longer than your service plan's allotted time limit. You can just disable some of the settings to reduce the scripts amount of work and time. The biggest time savers will be to disable some lines and labels
2) If you get an error saying the script accessed a negative index(e.g. ) then try temporarily increasing the "Add More Array Elements" setting to 100-200. Sometimes it fixes the problem.
3) You may sometimes temporarily get an error that reads: "Pine cannot determine the referencing length of a series. Try using max_bars_back in the study or strategy function".
If this happens there are several things that you can do:
3A) Create a copy of my script. Then edit the section of code that looks like this ")//, max_bars_back = INSERT_YOUR_QUANTITY_HERE)" and transform it to look like this new code ", max_bars_back = INSERT_YOUR_QUANTITY_HERE)" then repeatedly try replacing "INSERT_YOUR_QUANTITY_HERE" with an increasingly larger number greater than 244 but less than 5000.
This method will increase your system resources and could cause other problems. Try changing the code back after a few hours and see if all is well again. It is a Pinescript limitation issue and happens when certain functions or variables don't get used at least once within the first 244 bars.
3B) Adjust your settings to hopefully find a divergence within the first 244 bars. If one is found then the problematic variables or functions should get used and the Pinescript 244 bar limitation should be temporarily resolved.
3C) Wait for X number of new bars to occur. If a divergence is eventually found within the first 244 bars that should solve the issue.
Tips:
1) If the amount that a setting changes value is undesirable for each time you click it then you can change that amount in the code. To do that, you'll need your own copy of my script. To make your own copy just click on "create a working copy" in the brown colored strip area above the code. Then within approximately the first 108 lines find the title of the setting you want to change. Then look to it's right to find the parameter called "step =". Change what the step equals to whatever you want. FYI, you can hover your mouse over the blue colored code and a popup will tell you what parameters(i.e. settings) that function(e.g. "input.int()") has available.
Linear Cross Trading StrategyLinear Cross Trading Strategy
The Linear Cross trading strategy is a technical analysis strategy that uses linear regression to predict the future price of a stock. The strategy is based on the following principles:
The price of a stock tends to follow a linear trend over time.
The slope of the linear trend can be used to predict the future price of the stock.
The strategy enters a long position when the predicted price crosses above the current price, and exits the position when the predicted price crosses below the current price.
The Linear Cross trading strategy is implemented in the TradingView Pine script below. The script first calculates the linear regression of the stock price over a specified period of time. The script then plots the predicted price and the current price on the chart. The script also defines two signals:
Long signal: The long signal is triggered when the predicted price crosses above the current price.
Short signal: The short signal is triggered when the predicted price crosses below the current price.
The script enters a long position when the long signal is triggered and exits the position when the short signal is triggered.
Here is a more detailed explanation of the steps involved in the Linear Cross trading strategy:
Calculate the linear regression of the stock price over a specified period of time.
Plot the predicted price and the current price on the chart.
Define two signals: the long signal and the short signal.
Enter a long position when the long signal is triggered.
Exit the long position when the short signal is triggered.
The Linear Cross trading strategy is a simple and effective way to trade stocks. However, it is important to note that no trading strategy is guaranteed to be profitable. It is always important to do your own research and backtest the strategy before using it to trade real money.
Here are some additional things to keep in mind when using the Linear Cross trading strategy:
The length of the linear regression period is a key parameter that affects the performance of the strategy. A longer period will smooth out the noise in the price data, but it will also make the strategy less responsive to changes in the price.
The strategy is more likely to generate profitable trades when the stock price is trending. However, the strategy can also generate profitable trades in ranging markets.
The strategy is not immune to losses. It is important to use risk management techniques to protect your capital when using the strategy.
I hope this blog post helps you understand the Linear Cross trading strategy better. Booost and share with your friend, if you like.
MACD 3D with Signals [Quantigenics]Quantigenics MACD 3D with Buy Sell Signals is a MACD-based trading indicator that aims to identify market trends and potential turning points, for Buy/Sell opportunities, by leveraging price data and volatility.
Unlike the traditional MACD indicator, the average price is calculated from the high, low, and close prices, from which a specialized MACD value is derived. This MACD value, combined with an average and standard deviation, takes into account volatility, and is used to generate an upper and lower boundary.
The indicator color-codes market trends: aqua indicates upward trends (signifying increased buying pressure), red suggests downward trends (increased selling pressure). When the MACD value crosses above the upper boundary or falls below the lower boundary, the color changes to yellow indicating a possible reversal point and "Momentum Crossover Signals" can be plotted at this point. "Standard Signal" arrows can also plotted when the MACD 3D changes from auqa to red and vice-versa.
A trendline is drawn at the median value, providing a baseline for comparison. A differential value, which measures the distance between the MACD value and the median line, provides additional insight into the price's deviation from this baseline (divergences from the underlying price can be spotted using this data as well). The differential is color-coded: green when MACD is above the median, and red when it's below, with darker shades representing a decreasing gap.
Alerts can be set to trigger with the "Standard Signal" arrows appearing after MACD 3D changes from auqa to red and vice-versa and when the "Momentum Crossover Signal" arrows appear when the MACD value crosses above the upper boundary or falls below the lower boundary indicating a potential reversal. Providing immediate notifications which can be especially helpful in larger time frames where it may take time for a trade setup to develop.
CME_MINI:NQ1!
OANDA:XAUUSD
Enjoy the MACD 3D indicator. Happy Trading!
Velocity Acceleration Convergence Divergence Indicator [CC]I created the Velocity Acceleration Convergence Divergence Indicator, and it is quite a mouthful if I do say so. I based this script on my two previous scripts: Velocity Indicator and Velocity Acceleration Indicator . This acts like a typical MACD but is much faster with the responses. This indicator is created by finding the difference between the Velocity Indicator and Velocity Acceleration Indicator to determine the overall trend strength of the underlying stock. Like the other scripts, I coded the general buy and sell signals the same, so you would want to buy when the indicator crosses over above the zero midline and sell when it crosses below the zero midline. I have also used the same colors, so darker colors for strong signals and lighter colors for normal signals.
Please let me know if you would like me to publish another script or if you want something custom done!
Adaptive MACD [LuxAlgo]The Adaptive MACD indicator is an adaptive version of the popular Moving Average Convergence Divergence (MACD) oscillator, returning longer-term variations during trending markets and cyclic variations during ranging markets while filtering out noisy variations.
🔶 USAGE
The proposed oscillator contains all the elements within a regular MACD, such as a signal line and histogram. A MACD value above 0 would indicate up-trending variations, while a value under 0 would be indicating down-trending variations.
Just like most oscillators, our proposed Adaptive MACD is able to return divergences with the price.
As we can see in the image above ranging markets will make the Adaptive MACD more conservative toward more cyclical conservations, filtering out both noise and longer-term variations. However, when longer-term variations (such as in a trending market) are prominent the oscillator will conserve longer-term variations.
The R2 Period setting determines when trending/ranging markets are detected, with higher values returning indications for longer intervals.
The fast and slow settings will act similarly to the regular MACD, however, closer values will return more cyclical outputs.
The image above compares our proposed MACD (top) with a regular MACD (bottom), both using fast = 19 and slow = 20 .
🔶 DETAILS
It is common to be solely interested in the trend component when the market is trending, however, during a ranging market it is more common to observe a more prominent cyclical/noise component. We want to be able to preserve one of the components at the appropriate market conditions, however, the regular MACD lack the ability to preserve cyclical component with high accuracy.
The MACD is an IIR bandpass filter. In order to obtain a lower passband bandwidth and a more symmetrical magnitude response (which would allow to conserve more precise cyclical variations) we can directly change the system calculation:
y = (price - price ) × g + ((1 - a1) + (1 - a2)) × y - (1 - a1) × (1 - a2) × y
where:
a1 = 2/(fast + 1)
a2 = 2/(slow + 1)
g = a1 - a2
Using division instead of multiplication on the second feedback weight allows further weighting the 2 samples lagged output, returning a more desirable magnitude response with a higher degree of filtering on both ends of the spectrum as shown in the image below:
We are interested in conserving cycles during ranging markets, and longer-term variations during trending markets, we can do this by interpolating between our two filter coefficients:
α × + (1 - α) ×
where 1 > α > 0 . α is measuring if the market is trending or ranging, with values closer to 1 indicating a trending market. We see that for higher values of α the original coefficient of the MACD is used. The image below shows various magnitude responses given multiple values of α :
We use a rolling R-Squared as α , this measurement has the benefit of indicating if the market is trending or ranging, as well as being constrained within range (0, 1), and having a U-shaped distribution.
If you are interested to learn more about the MACD see:
🔶 SETTINGS
R2 Period: Calculation window of the R-Squared.
Fast: Fast period for the calculation of the Adaptive MACD, lower values will return more noisy results.
Slow: Slow period for the calculation of the Adaptive MACD, higher values will return result with longer-term conserved variations.
Signal: Period of the EMA applied to the Adaptive MACD.
MACD Bands - Multi Timeframe [TradeMaster Lite]We present a customizable MACD indicator, with the following features:
Multi-timeframe
Deviation bands to spot unusual volatility
9 Moving Average types
Conditional coloring and line crossings
👉 What is MACD?
MACD is a classic, trend-following indicator that uses moving averages to identify changes in momentum. It can be used to identify trend changes, overbought and oversold conditions, and potential reversals.
👉 Multi-timeframe:
This feature allows to analyze the same market data on multiple time frames, which can be in help to identify trends and patterns that would not be visible on a single time frame. When using the multi-timeframe feature, it is important to start with the higher time frame and then look for confirmation on the lower time frames. This will help you to avoid false signals. Please note that only timeframes higher than the chart timeframe is supported currently with this feature enabled. Might get updated in the future.
👉 Deviation bands to spot unusual volatility:
Deviation bands are plotted around the Signal line that can be in help to identify periods of unusual volatility. When the MACD line crosses outside of the deviation bands, it suggests that the market is becoming more volatile and a strong trend may form in that direction.
👉 9 Moving Average types can be used in the script. Each type of moving average offers a unique perspective and can be used in different scenarios to identify market trends.
SMA (Simple Moving Average): This calculates the average of a selected range of values, by the number of periods in that range.
SMMA (Smoothed Moving Average): This takes into account all data available and assigns equal weighting to the values.
EMA (Exponential Moving Average): This places a greater weight and significance on the most recent data points.
DEMA (Double Exponential Moving Average): This is a faster-moving average that uses a proprietary calculation to reduce the lag in data points.
TEMA (Triple Exponential Moving Average): This is even quicker than the DEMA, helping traders respond more quickly to changes in trend.
LSMA (Least Squares Moving Average): This moving average applies least squares regression method to determine the future direction of the trend.
HMA (Hull Moving Average): This moving average is designed to reduce lag and improve smoothness, providing quicker signals for short-term market movements.
VWMA (Volume Weighted Moving Average): This assigns more weight to candles with a high volume, reflecting the true average values more accurately in high volume periods.
WMA (Weighted Moving Average): This assigns more weight to the latest data, but not as much as the EMA.
👉 Conditional coloring :
This feature colors the MACD line line based on it's direction and fills the area between the MACD line and Deviation band edges to highlight the potential volatility and the strength of the momentum. This can be useful to identify when the market is trending strongly and when it is in a more neutral or choppy state.
👉 MACD Line - Signal Line crossings:
This is a classic MACD trading signal that occurs when the MACD line crosses above or below the signal line. Crossovers can be used to identify potential trend reversals. This can be a bullish or bearish signal, depending on the direction of the crossover.
👉 General advice
Confirming Signals with other indicators:
As with all technical indicators, it is important to confirm potential signals with other analytical tools, such as support and resistance levels, as well as indicators like RSI, MACD, and volume. This helps increase the probability of a successful trade.
Use proper risk management:
When using this or any other indicator, it is crucial to have proper risk management in place. Consider implementing stop-loss levels and thoughtful position sizing.
Combining with other technical indicators:
The indicator can be effectively used alongside other technical indicators to create a comprehensive trading strategy and provide additional confirmation.
Keep in Mind:
Thorough research and backtesting are essential before making any trading decisions. Furthermore, it's crucial to have a solid understanding of the indicator and its behavior. Additionally, incorporating fundamental analysis and considering market sentiment can be vital factors to take into account in your trading approach.
Limitations:
This is a lagging indicator. Please note that the indicator is using moving averages, which are lagging indicators.
The indicators within the TradeMaster Lite package aim for simplicity and efficiency, while retaining their original purpose and value. Some settings, functions or visuals may be simpler than expected.
⭐ Conclusion
We hold the view that the true path to success is the synergy between the trader and the tool, contrary to the common belief that the tool itself is the sole determinant of profitability. The actual scenario is more nuanced than such an oversimplification. Our aim is to offer useful features that meet the needs of the 21st century and that we actually use.
🛑 Risk Notice:
Everything provided by trademasterindicator – from scripts, tools, and articles to educational materials – is intended solely for educational and informational purposes. Past performance does not assure future returns.
Bar Color Long / Short Indicator With Advised SL Rev 1This is the Revised Version of Bar Color Long / Short Indicator With Advised SL with some extra features
Overview
This script is a trading indicator named "Bar Color Long / Short Indicator With Advised SL" designed for the TradingView platform. The indicator's primary purpose is to provide entry signals for long and short positions, based on various technical analysis methods. Additionally, the indicator suggests stop-loss levels for both long and short positions.
User Inputs
The indicator has several user inputs, such as:
Length
Smoothing
Multiplier
Show bar colors (ON/OFF)
When the bar colors are turned off, the alert signals for long and short positions will be displayed instead.
Custom Risk Calculation
The script calculates a custom risk level based on a modified version of the RSI (Relative Strength Index) formula. The custom risk level is divided into three categories: low, medium, and high.
Sentiment Score Calculation
The indicator calculates a sentiment score based on a combination of methods resembling EMA (Exponential Moving Average), MACD (Moving Average Convergence Divergence), and ROC (Rate of Change). The sentiment score is used to determine if the sentiment is positive or negative.
Bollinger Bands Percent and Combined Signal
The Bollinger Bands Percent is calculated, and the custom risk, sentiment score, and Bollinger Bands Percent are combined to generate a new signal. This signal is used in conjunction with EMA10 to determine the bar colors and provide entry signals.
Bar Colors
Based on the combined signal and EMA10, the script determines the bar colors as follows:
Orange: Positive sentiment
Blue: Negative sentiment
Gray: Neutral
Entry Signals and Alerts
When the bar colors are turned off, the indicator displays large green arrow signals for long (buy) positions and red arrow signals for short (sell) positions based on the sentiment and EMA10 conditions. The script also includes alert conditions for long and short signals, which can be used to set up notifications when these signals are triggered in the TradingView platform.
Advised Stop-Loss Levels
The indicator plots stop-loss lines for both long and short positions at the last candle, accompanied by labels showing the advised stop-loss levels in numeric values
Rev 1
added / changed :
SMA50 slope check
EMA20 higher or lower than EMA10
color ON/OFF changed
Signal once Buy and Sell