EMA 5 and SMA 10 Crossover with RSI by santosh kadam
Explanation of the Script: Indicators:
EMA 5 and SMA 10: These are the two moving averages used to determine the trend direction. Buy signal is triggered when EMA 5 crosses above SMA 10. Sell signal is triggered when EMA 5 crosses below SMA 10. RSI 14: This is used to filter buy and sell signals. Buy trades are allowed only if RSI 14 is above 60. Sell trades are allowed only if RSI 14 is below 50. Buy Conditions:
The strategy waits for the EMA crossover (EMA 5 crosses above SMA 10). The strategy checks if RSI 14 is above 60 for confirmation. If the price is below 60 on RSI 14 at the time of crossover, the strategy will wait until the price crosses above 60 on RSI 14 to initiate the buy. Sell Conditions:
The strategy waits for the EMA crossover (EMA 5 crosses below SMA 10). The strategy checks if RSI 14 is below 50 for confirmation. If the price is above 50 on RSI 14 at the time of crossover, the strategy will wait until the price crosses below 50 on RSI 14 to initiate the sell. Exit Conditions:
The Buy position is closed if the EMA crossover reverses (EMA 5 crosses below SMA 10) or RSI 14 drops below 50. The Sell position is closed if the EMA crossover reverses (EMA 5 crosses above SMA 10) or RSI 14 rises above 60. Plotting:
The script plots the EMA 5, SMA 10, and RSI 14 on the chart for easy visualization. Horizontal lines are drawn at RSI 60 and RSI 50 levels for reference. Key Features: Price Confirmation: The strategy ensures that buy trades are only initiated if RSI 14 crosses above 60, and sell trades are only initiated if RSI 14 crosses below 50. Additionally, price action must cross these RSI levels to confirm the trade. Reversal Exits: Positions are closed when the EMA crossover or RSI condition reverses. Backtesting: Paste this script into the Pine Editor on TradingView to test it with historical data. You can adjust the EMA, SMA, and RSI lengths based on your preferences. Let me know if you need further adjustments or clarification!