OPEN-SOURCE SCRIPT
Updated EMA+ATR Band MTF Trend Entry

This is a Multi-Timeframe Trend Trading indicator strategy adapted from Sahil Rohmehtra’s Mentorship programme. The trading decision is made by first accessing the trend in higher timeframe (say Monthly) by using TWO EMAs. If the faster EMA (say 20 period) is above Slower EMA (say 50 period) and the price is above slower EMA then the trend is suitable for buyers. Similarly if faster EMA is below slow EMA and the price is below that then trend is suitable for sellers.
Once we access the trend in the higher timeframe we move to the lower timeframe (say Weekly) and access the 5-period RSI value. If RSI is below 30 then we can prepare for possible buy entry in lower (Daily) timeframe if entry conditions are met in daily timeframe. Similarly sell bias can be initiated when the higher timeframe EMA trend is down, daily RSI is above 70 and sell entry condition is met in daily timeframe. The RSI thresholds can be changed by the user.
Once we identified the RSI bias then wait for the confirmation candle in the lower timeframe (say 1 hour). In the entry timeframe we plot a band of 20 EMA of LOWs ± 1 ATR lines. Here,we wait for a candle to close above the 20 EMA of LOWs + 1 ATR for a buy signal with an increase in On Balance Volume (OBV) value. Similarly for sell signal we should get a candle close below the 20 EMA of LOWs - 1 ATR with corresponding change in OBV. This candle is the signal candle.
Once we get a Buy or Sell signal the corresponding stop loss is the nearest LOW - 1 ATR or HIGH + 1 ATR. The ATR scaling may be changed by the user. Now if another candle closes above the high of the buy signal candle then enter on buy. If the low of the buy signal candle is broken then it is a potential short-term sell entry. Similarly if another candle closes below the sell signal candle then enter short and if there is a close above high of the signal candle then it is a potential buy entry.
Once we access the trend in the higher timeframe we move to the lower timeframe (say Weekly) and access the 5-period RSI value. If RSI is below 30 then we can prepare for possible buy entry in lower (Daily) timeframe if entry conditions are met in daily timeframe. Similarly sell bias can be initiated when the higher timeframe EMA trend is down, daily RSI is above 70 and sell entry condition is met in daily timeframe. The RSI thresholds can be changed by the user.
Once we identified the RSI bias then wait for the confirmation candle in the lower timeframe (say 1 hour). In the entry timeframe we plot a band of 20 EMA of LOWs ± 1 ATR lines. Here,we wait for a candle to close above the 20 EMA of LOWs + 1 ATR for a buy signal with an increase in On Balance Volume (OBV) value. Similarly for sell signal we should get a candle close below the 20 EMA of LOWs - 1 ATR with corresponding change in OBV. This candle is the signal candle.
Once we get a Buy or Sell signal the corresponding stop loss is the nearest LOW - 1 ATR or HIGH + 1 ATR. The ATR scaling may be changed by the user. Now if another candle closes above the high of the buy signal candle then enter on buy. If the low of the buy signal candle is broken then it is a potential short-term sell entry. Similarly if another candle closes below the sell signal candle then enter short and if there is a close above high of the signal candle then it is a potential buy entry.
Release Notes
Added AlertsRelease Notes
Added volume above average candle color and some additional user options to change.Updated higher timeframe defaults and added RSI trend.
Added buffer levels around High and Low of signal candle.
Release Notes
Added volume above average candle color and some additional user options to change.Updated higher timeframe defaults and added RSI trend.
Added buffer levels around High and Low of signal candle.
Removed unused codes
Release Notes
Updated with Signal candle mid range (dashed lines) to access the price trend. If any of the next few candles close above the id range then price may move up and stay below the mid range price may go down. Therefore, for buy signal we want candles to stay above mid range otherwise ignore and for sell signals candle close should be below the mid range for validity.Also modified to include gap-up and gap-down days around ATR band lines for signals.
Release Notes
Added Moving average selection. You can select: -- EMA
- SMA
- MAMA-FAMA - The MESA Adaptive Moving Average (MAMA) is a technical analysis indicator that is designed to respond to changing market conditions and reduce lag in trend identification. Developed by John F. Ehlers in 2001, the MAMA is based on the concept of the Maximum Entropy Spectral Analysis (MESA) of market data. The MAMA is a unique moving average that adjusts its speed based on market volatility, making it a more responsive and accurate indicator compared to traditional moving averages.
The background color changed from higher timeframe RSI to long period (100) Stochastic in current timeframe. Stochastic cross above 50 is Green and cross below 30 is Red.
In addition mid-range rice level tracking added for buy and sell signals. If the price trade above mid-range of buy signal then you may enter buy trade. No need to wait till higher levels stop loss may be put at lower line or if the price close below the mid-range. Similarly, for sell signal price trading below the mid-range is bearish and above mid-range is weakly bullish and may reverse to upside.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.