OPEN-SOURCE SCRIPT

EMA Crossover with 50 EMA Filter

50-period EMA: We added the 50-period EMA as the filterEMA variable.
Buy and Sell Conditions: The buy signal is generated only if the 8-period and 16-period EMAs both cross above each other and are above the 50-period EMA. Similarly, the sell signal is generated when the 8-period and 16-period EMAs cross below each other and are below the 50-period EMA.
Plotting: The 50-period EMA is also plotted on the chart (in orange).

This strategy will ensure that the buy signals are only triggered when the trend is considered "bullish" (both EMAs above the 50 EMA) and sell signals when the trend is "bearish" (both EMAs below the 50 EMA).
You can set up alerts for both buy and sell conditions using the alertcondition() function.
Let me know if you need further adjustments!

NOTE :- Applicable only for banknifty

Wyłączenie odpowiedzialności