Ichimoku Cloud and ADX with Trailing Stop Loss (by Coinrule)The Ichimoku Cloud is a collection of technical indicators that show support and resistance levels, as well as momentum and trend direction. It does this by taking multiple averages and plotting them on a chart. It also uses these figures to compute a “cloud” that attempts to forecast where the price may find support or resistance in the future.
The Ichimoku Cloud was developed by Goichi Hosoda, a Japanese journalist, and published in the late 1960s. It provides more data points than the standard candlestick chart. While it seems complicated at first glance, those familiar with how to read the charts often find it easy to understand with well-defined trading signals.
The Ichimoku Cloud is composed of five lines or calculations, two of which comprise a cloud where the difference between the two lines is shaded in.
The lines include a nine-period average, a 26-period average, an average of those two averages, a 52-period average, and a lagging closing price line.
The cloud is a key part of the indicator. When the price is below the cloud, the trend is down. When the price is above the cloud, the trend is up.
The above trend signals are strengthened if the cloud is moving in the same direction as the price. For example, during an uptrend, the top of the cloud is moving up, or during a downtrend, the bottom of the cloud is moving down.
DMI is simple to interpret. When +DI > - DI, it means the price is trending up. On the other hand, when -DI > +DI , the trend is weak or moving on the downside. The ADX does not give an indication about the direction but about the strength of the trend.
Typically values of ADX above 25 mean that the trend is steeply moving up or down, based on the -DI and +D positioning. This script aims to capture swings in the DMI, and thus, in the trend of the asset, using a contrarian approach.
Trading on high values of ADX, the strategy tries to spot extremely oversold and overbought conditions. Values of ADX above 45 may suggest that the trend has overextended and is may be about to reverse.
This strategy combines the Ichimoku Cloud with the ADX indicator to better enter trades.
Long orders are placed when these basic signals are triggered.
Long Position:
Tenkan-Sen is above the Kijun-Sen
Chikou-Span is above the close of 26 bars ago
Close is above the Kumo Cloud
MACD line crosses over the signal line
-DI is greater than +DI
ADX is greater than 45
Close Position:
3% increase trailing
3% decrease trailing
The script is backtested from 1 January 2018 and provides good returns.
The strategy assumes each order is using 30% of the available coins to make the results more realistic and to simulate you only ran this strategy on 30% of your holdings. A trading fee of 0.1% is also taken into account and is aligned to the base fee applied on Binance.
This script also works well on MATIC (1d timeframe), ETH (1d timeframe), and SOL (1d timeframe).
Directional Movement Index (DMI)
Inverse MACD + DMI Scalping with Volatility Stop (By Coinrule)This script is focused on shorting during downtrends and utilises two strength based indicators to provide confluence that the start of a short-term downtrend has occurred - catching the opportunity as soon as possible.
This script can work well on coins you are planning to hodl for long-term and works especially well whilst using an automated bot that can execute your trades for you. It allows you to hedge your investment by allocating a % of your coins to trade with, whilst not risking your entire holding. This mitigates unrealised losses from hodling as it provides additional cash from the profits made. You can then choose to hodl this cash, or use it to reinvest when the market reaches attractive buying levels.
Alternatively, you can use this when trading contracts on futures markets where there is no need to already own the underlying asset prior to shorting it.
ENTRY
The trading system uses the Momentum Average Convergence Divergence (MACD) indicator and the Directional Movement Index (DMI) indicator to confirm when the best time is for selling. Combining these two indicators prevents trading during uptrends and reduces the likelihood of getting stuck in a market with low volatility.
The MACD is a trend following momentum indicator and provides identification of short-term trend direction. In this variation it utilises the 12-period as the fast and 26-period as the slow length EMAs, with signal smoothing set at 9.
The DMI indicates what way price is trending and compares prior lows and highs with two lines drawn between each - the positive directional movement line (+DI) and the negative directional movement line (-DI). The trend can be interpreted by comparing the two lines and what line is greater. When the negative DMI is greater than the positive DMI, there are more chances that the asset is trading in a sustained downtrend, and vice versa.
The system will enter trades when two conditions are met:
1) The MACD histogram turns bearish.
2) When the negative DMI is greater than the positive DMI.
EXIT
The strategy comes with a fixed take profit combined with a volatility stop, which acts as a trailing stop to adapt to the trend's strength. Depending on your long-term confidence in the asset, you can edit the fixed take profit to be more conservative or aggressive.
The position is closed when:
Take-Profit Exit: +8% price decrease from entry price.
OR
Stop-Loss Exit: Price crosses above the volatility stop.
In general, this approach suits medium to long term strategies. The backtesting for this strategy begins on 1 April 2022 to 18 July 2022 in order to demonstrate its results in a bear market. Back testing it further from the beginning of 2022 onwards further also produces good returns.
Pairs that produce very strong results include SOLUSDT on the 45m timeframe, MATICUSDT on the 2h timeframe, and AVAUSDT on the 1h timeframe. Generally, the back testing suggests that it works best on the 45m/1h timeframe across most pairs.
A trading fee of 0.1% is also taken into account and is aligned to the base fee applied on Binance.
Sideways Strategy DMI + Bollinger Bands (by Coinrule)Markets don’t always trade in a clear direction. At a closer look, most of the time, they move sideways. Relying on trend-following strategies all the time can thus lead to repeated false signals in such conditions.
However, before you can safely trade sideways, you have to identify the most suitable market conditions.
The main features of such strategies are:
Short-term trades, with quick entries and quick exits
Slightly contrarian and mean-reversionary
Require some indicator that tells you it’s a sideways market
This Sideways DMI + Bollinger Bands strategy incorporates such features to bring you a profitable alternative when the regular trend-following systems stop working.
ENTRY
1. The trading system requires confirmation for a sideways market from the Directional Movement Index (DMI) before you can start opening any trades. For this purpose, the strategy uses the absolute difference between positive and negative DMI, which must be lower than 20.
2. To pick the right moment to buy, the strategy looks at the Bollinger Bands (BB). It enters the trade when the price crosses over the lower BB.
EXIT
The strategy then exits when the move has been exhausted. Generally, in sideways markets, the price should revert lower. The position is closed when the price crosses back down below the upper BB.
The best time frame for this strategy based on our backtest is the 1-hr. Shorter timeframes can also work well on certain coins that are more volatile and trade sideways more often. However, as expected, these exhibit larger volatility in their returns. In general, this approach suits medium timeframes. A trading fee of 0.1% is taken into account. The fee is aligned to the base fee applied on Binance, which is the largest cryptocurrency exchange.
Relative Strength Index - MayurRSI backtesting long only portfolio builder.
only for investing at cheap valuations
DMI (Multi timeframe) DI Strategy [KL]Directional Movement Index Strategy
Entry conditions:
- (a) when DI+ > DI- on timeframe #1, and
- (b) Confirmation: when DI+ > DI- on timeframe #2
In the shown example, timeframe1 was same as the chart (1H) and timeframe2 was 1D.
Stop Loss: ATR based trailing stop
About DMI
Can refer to Investopedia for general understanding.
Applications of DMI in this strategy:
- Assumes uptrend when DI+ is above DI- (when green DI+ lines above red DI-), vice versa for downtrend. This is checked in two different timeframes that can be set by user in settings.
- DX is ignored, it doesn't give a direction of the trend. But if DX was applied, it would be a good indicator for quantifying the strength of uptrend/downtrend. This measurement would typically be read along a threshold (i.e. if below 20, then market is likely consolidating). All of these have been commented out (ignored by pinescript's interpreter via //) in the codes, as said; we are not using DX for sake of simplicity.
Visualizations
To make the chart look cleaner, DMI plots have been simplified to just down/up arrows placed at bottom of the chart.
Referring to the example chart:
- Green arrows : when DI+ > DI- for both timeframes, implies uptrend
- Red arrows: other way around (DI+ < DI-), implies downtrend
DMI Swings (by Coinrule)The Directional Movement Index is a handy indicator that helps catch the direction in which the price of an asset is moving. It compares the prior highs and lows to draw three lines:
Positive directional line (+DI)
Negative directional line (-DI)
Average direction index (ADX)
DMI is simple to interpret. When +DI > - DI, it means the price is trending up. On the other hand, when -DI > +DI, the trend is weak or moving on the downside.
The ADX does not give an indication about the direction but about the strength of the trend.
Typically values of ADX above 25 mean that the trend is steeply moving up or down, based on the -DI and +D positioning. This script aims to capture swings in the DMI, and thus, in the trend of the asset, using a contrarian approach.
ENTRY
-DI is greater than +DI
ADX is greater than 45
EXIT
+DI is greater than -DI
ADX is greater than 45
Trading on high values of ADX, the strategy tries to spot extremely oversold and overbought conditions. Values of ADX above 45 may suggest that the trend has overextended and is may be about to reverse.
Our backtests suggest that this script performs well for very short-term scalping strategies on low time frames, such as the 1-minute.
The script considers a 0.1% trading fee to make results more realistic to those you can expect from live market conditions. So realistically, live results should be similar to backtested results.
You can plug this script directly into your crypto exchange using TradingView Signals on Coinrule.
Trade Safely!
ADX / RSI Strategy by Trade Rush (created by SirPoggy) This is one of many new strategies coming soon which were seen on Trade Rush
This one is the ADX / RSI Strategy seen here:
https:www.youtube.com/watch?v=uSkGE0ujyn4
While the strategy has been modified slightly to use the DMI instead of the ADX, the core of the strategy is essentially the same
Long signals are generated when the RSI is above 70, close is above the 200EMA, and the ADX is above 25 (added is the plus DMI over 25 and minus DMI below 20)
Stop loss is placed below /above the 21 EMA, however, there is a deviation required to ensure price is not too close to where a stop loss would be placed.
Short signals are generated when the RSI is below 30, close is below the 200EMA, and the ADX is above 25 (added is the minus DMI over 25 and plus DMI below 20)
I do not recommend using this strategy but I have provided this code for educational purposes.
Thanks!
Let me know which strategy you'd like coded next in the comments below.
CHOP Zone Entry Strategy + DMI/PSAR ExitThis is a Strategy with associated visual indicators and Long/Short and Reverse/Close Position Alerts for the Choppiness Index (CHOP) . It is used to determine if the market is choppy (trading sideways) or not choppy (trading within a trend in either direction). CHOP is not directional, so a DMI script was ported into this strategy to allow for trend confirmation and direction determination; it consists of an Average Directional Index (ADX) , Plus Directional Indicator (+DI) and Minus Directional Indicator (-DI) . In addition, a Parabolic SAR is also included to act as a trailing stop during any strong trends.
Development Notes
---------------------------
This indicator, and most of the descriptions below, were derived largely from the TradingView reference manual. Feedback and suggestions for improvement are more than welcome, as well are recommended Input settings and best practices for use.
www.tradingview.com
www.tradingview.com
www.tradingview.com
Recommend using the below DMI and PSAR indicators in conjunction with this script to fully visualize and understand how entry and exit conditions are chosen. Variable inputs should correlate between the scripts for uniformity and visual compatibility.
THANKS to LazyBear and his Momentum Squeeze script for helping me quickly develop a momentum state model for coloring the Chop line by trend.
Strategy Description
---------------------------
CHOP produces values that determine whether the market is choppy or trending . The closer the value is to 100 , the higher the choppiness levels , while the closer it is to 0 , the stronger the market is trending . Territories for both levels, and their associated upper and lower thresholds, are popularly defined using the Fibonacci Retracements, 61.8 and 38.2.
Basic Use
---------------------------
CHOP is often used to confirm the market condition to help you stay out of sideways markets and only enter when there is movement or imminent explosions. When readings are above the upper threshold, continued sideways movement may be expected, while readings below the lower threshold are typically indicative of a continuing trend. It is also used to anticipate upcoming trendiness changes, with the general belief that extended periods of consolidation (sideways movement) are followed by extended periods of strong, trending, directional movement, and vice versa.
One limitation in this index is that you must be cautious in deciding whether the range or trend will likely continue, or if it will reverse.
Confidence in price action and trend is higher when two or more indicators are in agreement -- while this strategy combines CHOP with both DMI and PSAR, we would still recommend pairing with other indicators to determine entry or exit trade opportunities.
Recommend also choosing 'Once Per Bar Close' when creating alerts.
Inputs
---------------------------
Strategy Direction - an option to only trade Short, Long, Both, or only in the direction of the Trend (Follow Trend is the Default).
Sensitivity - an incremental variable to test whether the past n candles are in the same trend state before triggering a delayed long or short alert (1 is the Default). Can help filter out noise and reduces active alerts.
Show Chop Index - two visual styles are provided for user preference, a visible Chop line with a background overlay, or a compact column and label only view.
Chop Lookback Period - the time period to be used in calculating CHOP (14 is the Default).
Chop Offset - changing this number will move the CHOP either forwards or backwards relative to the current market (0 is the Default).
Smooth Chop Line and Length - if enabled, the entered time period will be used in calculating a smooth average of the index (Enabled and 4 are the Defaults).
Color Line to Trend Direction - toggles whether the index line is colored to visually depict the current trend direction (Enabled is the Default).
Color Background - toggles the visibility of a background color based on the index state (Enabled is the Default).
Enable DMI Option - if enabled, then entry will be confirmed by and dependent on the ADX Key Level, with any close or reversal confirmed by both ADX and +/-DI to determine whether there is a strong trend present or not (Enabled is the Default).
ADX Smoothing - the time period to be used in calculating the ADX which has a smoothing component (14 is the Default).
DI Length - the time period to be used in calculating the DI (14 is the Default).
ADX Key Level - any trade with the ADX above the key level is a strong indicator that it is trending (23 to 25 is the suggested setting).
Enable PSAR Option - enables trailing stop loss orders (Enabled is the Default).
PSAR Start - the starting value for the Acceleration Force (0.015 is our chosen Default, 0.02 is more common).
PSAR Increment - the increment in which the Acceleration Force will move (0.001 is our chosen Default, 0.02 is more common).
PSAR Max Value - the maximum value of the Acceleration Factor (0.2 is the Default).
Color Candles Option - an option to transpose the CHOP condition levels to the main candle bars. Note that the outer red and green border will still be distinguished by whether each individual candle is bearish or bullish during the specified timeframe.
Note too that if both DMI and PSAR are deselected, then close determinations will default to a CHOP reversal strategy (e.g., close long when below 38.2 and close short when above 61.8). Though if either DMI or PSAR are enabled, then the CHOP reversal for close determination will automatically be disabled.
Indicator Visuals
---------------------------
For the candle colors, black indicates tight chop (45 to 55), yellow is loose chop (38.2 to 45 and 55 to 61.8), dark purple is trending down (< 38.2), and dark blue is trending up (> 61.8).
The background color has additional shades to differentiate a wider range of more levels…
• < 30 is dark purple
• 30 to 38.2 is purple
• 38.2 to 45 is light purple
• 45 to 55 is black
• 55 to 61.8 is light blue
• 61.8 to 70 is blue
• > 70 is dark blue
Long, Short, Close, and Reverse labels are plotted on the Chop line, which itself can be colored based on the trend. The chop line can also be hidden for a clean and compact, columnar view, which is my preferred option (see example image below).
Visual cues are intended to improve analysis and decrease interpretation time during trading, as well as to aid in understanding the purpose of this strategy and how its inclusion can benefit a comprehensive trading plan.
DMI and Trend Strength
---------------------------
To analyze trend strength, the focus should be on the ADX line and not the +DI or -DI lines. An ADX reading above 25 indicates a strong trend , while a reading below 20 indicates a weak or non-existent trend . A reading between those two values would be considered indeterminable. Though what is truly a strong trend or a weak trend depends on the financial instrument being examined; historical analysis can assist in determining appropriate values.
DMI exits trade when ADX is below the user selected key level (e.g., default is 25) and when the +/- DI lines cross (e.g., -DI > +DI exits long position and +DI > -DI exits short position).
PSAR and Trailing Stop
---------------------------
PSAR is a time and price based indicator that excels at measuring direction and duration, though not the actual strength of a trend, which is why we use this in conjunction with DMI. It is also included in this script as a trailing stop option to maximize gains during strong trends and to mitigate any false ADX strengthening signals.
This creates a parabola that is located below the candle during a Bullish trend and above during a Bearish trend. A buy or reversal is signaled when the price crosses above or below the Parabolic SAR.
Long/Short Entry
---------------------------
1. CHOP must be over 61.8 (long) or under 38.2 (short).
2. If DMI is enabled, then the ADX signal line must be above the user selected Key Level (default is 25).
3. If Sensitivity is selected, then that past candle must meet the criteria in step 1, as well as all the intermediate candles in between.
4. If "Follow Trend" is selected and PSAR is enabled, then a long position can only open when the momentum and PSAR are in an uptrend, or short when both are in a downtrend, to include all intermediate candles if the Sensitivity option is set on a past candle.
Close/Reverse
---------------------------
1. If DMI is enabled, then a close flag will be raised when the ADX signal drops below the Key Level (of 25), and -DI crosses over +DI (if long), or +DI crosses over -DI (if short).
2. If PSAR is enabled, then a close flag will be raised when the current trend state is opposite the last state.
3. If both DMI and PSAR are disabled, then a close flag will be raised if the Chop line drops under 38.2 (if long) or goes over 61.8 (if short).
4. If a Long or Short Entry is triggered on the same candle as any of the above close flags, then the position will be reversed, else the position will be closed.
Strategy Alerts
---------------------------
1. Long Entry
2. Short Entry
3. Reverse
4. Close
The provided backtest result is based on a position sizing of 10% equity with 100k initial capital. When testing SPX, disabling the DMI performed the best, but EURUSD performed poorly without it enabled, and TSLA had a small reduction in net profit. Timeframe likewise differed between commodities with TSLA performing best at 30M, SPX at 15M, and EURUSD at 4H. I do not plan on using this as a standalone strategy, but I also was expecting better results with the inclusion of EMI and PSAR to compliment the CHOP. Key elements of this script will likely be included in future, more holistic strategies.
Disclaimer
---------------------------
Past performance may not be indicative of future results. Due to various factors, including changing market conditions, the strategy may no longer perform as well as in historical backtesting. This post and the script are not intended to provide any financial advice. Trade at your own risk.
No known repainting, though there may be if an offset is introduced in the Inputs. I did my best not to code any other variables that repaint, but cannot fully attest to this fact.
MrBS:Directional Movement Index [Trend Friend Strategy]This goes with my MrBS:DMI+ indicator. I originally combined them into one, but then you cannot set alerts based on what the ADX and DMI is doing, only strategy alerts, so separate ones have more flexibility and uses.
Indicator Version is found under "MrBS:Directional Movement Index " ()
//// THE IDEA
The majority of profits made in the market come from trending markets. Of course there are strategies that would say otherwise but for the majority of people, THE TREND IS YOUR FRIEND (until the end). The idea is to follow the trend, entering once it has established its self and exiting positions when the trend weakens. This strategy gives a rough idea of the returns produced from following purely the ADX signals. At first Heikin Ashi values were used for the calculation but the results show it's not that effective. The functionality to switch between calculation types has been left in, so we can uses HA candle data to generate signals from while looking at an OHLC chart, if we want to experiment. Due to the way strategies work, we are unable to get reliable results when running the strategy on the HA chart even if we are calculating the signals from the real OHLC values. It is best to always run strategies on standard charts.
When using this strategy, I look for confirmation of the signal based on stochastic (14:3:6) direction, reversal level of stochastic, and divergance, to add confidence and adjust position size accordingly. I am going to try and code some version of that in future updates, if anyone can help or has suggestions please drop me a message.
//// INDICATOR DETAILS
- The default settings are for optimized Daily charts, for 4 hour I would suggest a smoothing of 2.
- The default values used for calculation are the Real OHLC, we can change this to Heikin Ashi in the menu.
- The strategy enters a position when ADX crosses the threshold level, and closes the position when ADX starts to fall.
- There is a signal filter in the form of a 377 period Hull Moving Average, which the price must be above or bellow for long and short positions respectively.
- The strategy closes the position when a cross-under of the ADX and its 4 period EMA. This is an attempt to stay into positions longer as sometimes the ADX will fall for 1 bar and then keep rising, while the overall trend is strong. The downside to this is that we exit trades later and this affects our max drawdown.
DMI Modified StrategyAs promised a strategy of my DMI Modified indicator! (See link below for indicator).
=== How does it work? ===
Instead of plotting the positive direction of +DI and negative direction for -DI, we subtract the +DI with the -DI on scales of 100 to -100.
The result is plotted with a oscillator to identify the current trend.
DMI Modified supports multiple moving averages (default is EMA with length of 9). You can disable moving averages smoothing in settings.
//== About the Strategy ==
Buys when the line crosses over the Zero line.
Sells when the line crosses under the Zero line.
The DMI modified strategy is pretty much clean, without any filtering besides the DMI Modified and a moving average to smooth it.
Works best to catch a trend and more suitable for 1 hour and above time frame. Stay tuned for updates.
On sideways you will get more false signals. as i said , it's a clean version without much bells and whistles for you to experiment.
== Oscillator Colors ==
GREEN : Strong Up Trend as DMI Modified is above zero line and DMI modified is ascending.
LIGHT GREEN: Still up trend but weakening as DMI modified is above zero but descending.
RED: Strong Downtrend as DMI Modified is below zero line and DMI modified is descending.
LIGHT RED: Still down trending but weakening as DMI modified is below zero but ascending.
== Notes ==
Short is enabled by default.
Bar coloring is disabled by default.
== Links ==
DMI modified indicator:
Like if you like and Enjoy! Follow for more upcoming indicators/strategies: www.tradingview.com
Simple Moving Average + ADX + DMI + Time Range Test
Use long and short moving average to look for a potential price in/out. (default as 14 and 7, bases on the history experience)
ADX and DMI to prevent the small volatility and tangling MA.
This script allows you to set the beginning & end time to test the bullish & bearish market.
If you want an indicator version, here is it.
Thanks.
ADX | DMI Trend StrategyThis strategy takes the ADX Indicator I wrote and applies it to a strategy for back testing purposes.
I've also applied a date filter so you can back test specific date ranges and a moving average filter so you can choose whether to filter your longs/shorts based on a moving average.