Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //@version=5
- indicator(title='duoble signal scalp', shorttitle='double signal', precision=2, overlay=true)
- Rsi_value = input.int(14, title='RSI Length', step=1)
- hl = input.int(75, title='Higher Value of RSI', step=1)
- ll = input.int(25, title='Lower value of RSI', step=1)
- rs = ta.rsi(close, Rsi_value)
- sma_value = input.int(50, title='SMA Length', step=1)
- sma1 = ta.sma(close, sma_value)
- dist_SMA = 1
- candle_length = 1
- iff_1 = high < sma1 ? color.red : color.yellow
- iff_2 = low > sma1 ? color.lime : iff_1
- mycolor = rs >= hl or rs <= ll ? color.yellow : iff_2
- gaps = sma1 + dist_SMA //Gap between price and SMA for Sell
- gapb = sma1 - dist_SMA //Gap between price and SMA for Buy
- chartgap = gaps or gapb //for both below or above the SMA
- gap1 = sma1 + 5
- gapvalue = open / 100 * candle_length
- gapp = high - low > gapvalue
- gapp2 = high - low > gapvalue
- bull = open < close and high - low > 2 * gapvalue and close > (high + open) / 2
- bear = open > close and high - low > 2 * gapvalue and close < (low + open) / 2
- rev1 = rs > 68 and open > close and open > gaps and high - low > gapvalue + 0.5 and low != close
- rev1a = rs > 90 and open < close and close > gaps and high != close and open != low
- sellrev = rev1 or rev1a
- rev2 = rs < 50 and open < close and open < gapb and open == low //over green candles"B"
- rev3 = rs < 30 and open > close and high > gapb and open != high and barstate.isconfirmed != bear
- rev4 = rs < 85 and close == high and high - low > gapvalue and open < close
- hlrev_s = ta.crossunder(rs, hl)
- llrev_b = ta.crossover(rs, ll) and open < close
- buycall = open < close and open > sma1 and ta.cross(close[1], sma1) and close > sma1
- sellcall = ta.cross(close, sma1) and open > close
- BUY = ta.crossover(close[1], sma1) and close[1] > open[1] and high[0] > high[1] and close[0] > open[0]
- SELL = ta.crossunder(low[1], sma1) and close[1] < open[1] and low[0] < low[1] and close[0] < open[0]
- plotshape(SELL, title='SELL', style=shape.labeldown, color=color.new(color.red, 30), text='S', textcolor=color.new(color.black, 30))
- plotshape(BUY, title='BUY', style=shape.labelup, color=color.new(color.aqua, 30), text='B', textcolor=color.new(color.black, 30), location=location.belowbar)
- plotshape(hlrev_s, title='Reversal1', style=shape.labeldown, color=color.new(color.yellow, 20), text='!', textcolor=color.new(color.black, 20))
- plotshape(llrev_b, title='Reversal2', style=shape.labelup, color=color.new(color.yellow, 20), text='!', textcolor=color.new(color.black, 20), location=location.belowbar)
- plot(sma1, title='SMA', color=mycolor, linewidth=2)
- alertcondition(hlrev_s or llrev_b, title='Reversal Signal', message='Reversal Alert')
- alertcondition(SELL or BUY, title='Buy/Sale Signal', message='Buy/Sell Alert')
Advertisement
Add Comment
Please, Sign In to add comment