//@version=5
//1. AVG Stochastic Calculate
//1.1 AVG %K is calculated by apply EMA with smooth K period on Average of Original Stochastic %k & %d
//+ avg_k=ema((%k+%d)/2,smoothK)
//1.2 AVG %D is calculated by apply EMA with %d period on AVG %K
//+ avg_d=ema(avg_k,periodD)
//2. Parameter
//+ %K Length: 21
//+ %K Smoothing: 3
//+ %D Smoothing: 3
//+ Symbol: BTC/USDT
//+ Timeframe: M30
//+ Pyramiding: Maximum 3 orders at the same direction.
//3. Signal
//3.1 Buy Signal
//+ Entry: AVG %K crossover AVG %D and AVG %D < 20
//+ Exit: AVG %D > 80
//3.2 Sell Signal
//+ Entry: AVG %K crossunder AVG %D and AVG %D > 80
//+ Exit: AVG %D < 20
strategy(title="AVG Stochastic Strategy [M30 Backtesting]", overlay=true, pyramiding=3)
periodK = input.int(21, title="%K Length", minval=1)
smoothK = input.int(3, title="%K Smoothing", minval=1)
periodD = input.int(3, title="%D Smoothing", minval=1)
k = ta.sma(ta.stoch(close, high, low, periodK), smoothK)
d = ta.sma(k, periodD)
_avg_k=ta.ema(math.avg(k,d),smoothK)
_avg_d=ta.ema(_avg_k,periodD)
up=
_avg_k[1]<_avg_d[1]
and _avg_k>_avg_d
and _avg_d<20
dn=
_avg_k[1]>_avg_d[1]
and _avg_k<_avg_d
and _avg_d>80
var arr_val=0
if up
arr_val:=1
strategy.entry("Long", strategy.long)
if dn
arr_val:=-1
strategy.entry("Short", strategy.short)
if up[1] or dn[1]
arr_val:=0
plotarrow(arr_val,title="Signal",colorup=color.green,colordown=color.red)
if _avg_d>80
strategy.close("Long")
if _avg_d<20
strategy.close("Short")
//EOF
Expand (51 lines)
Overview
AVG Stochastic Strategy triggers long entries when the averaged %K crosses above averaged %D while below 20, and short entries when %K crosses below %D while above 80. Long trades exit when averaged %D moves above 80, and short trades exit when it drops below 20. Main settings adjust Stochastic length, K smoothing, and D smoothing. Plots signal arrows directly on the chart. It allows pyramiding up to three orders without using stop losses.
The inputs you can change from the gear icon on the chart. Defaults are the author's.
Setting
Type
Default
Variable
%K Length
int
21
periodK
%K Smoothing
int
3
smoothK
%D Smoothing
int
3
periodD
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.
Alert BB + RSI [Alorse] is a multi-symbol mean-reversion strategy designed for cryptocurrency trading. It evaluates Bollinger Bands and the Relative Strength Index (RSI) across up to 20 user-defined ticker symbols simultaneously. The strategy enters long posit
Mean Reversion Strategy is an overlay strategy that identifies pullbacks using a long-term EMA, RSI, and candlestick patterns. It generates long signals when a bullish engulfing candle forms below the EMA while RSI is oversold, and short signals when a bearish
This strategy combines Bollinger Bands with a short RSI to fade moves that leave the bands and then return. A long requires the prior bar below the lower band and oversold, then a close back inside the band while RSI is between 30 and 50. Shorts mirror that at
This strategy implements Larry Connors' 2-period RSI mean-reversion algorithm overlaid on the price chart. It filters trades using a long-term Simple Moving Average (SMA), entering long positions when the price trades above the SMA and the short-term RSI drops
This strategy combines multi-timeframe RSI analysis with exponential moving average filters to execute trades on price bounces. It evaluates daily and weekly RSI levels alongside pip-distance thresholds between fast, slow, and long-term EMAs. Position entries
This strategy plots on the price chart and trades fair value gaps filtered by RSI and two EMAs. It opens a long when a bullish gap, a rising candle, RSI below the oversold level, and price under both EMAs align, and a short on the opposite conditions. Each tra