Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //@version=5
- indicator("Top and bottom Hunter", overlay=true)
- // Fibonacci Levels
- fib_0 = input.float(0.382, "Fib Level 0")
- fib_1 = input.float(0.618, "Fib Level 1")
- // Calculate Fibonacci levels
- fib_range = ta.highest(high, 2) - ta.lowest(low, 2)
- fib_level_0 = ta.highest(high, 2) - (fib_range * fib_0)
- fib_level_1 = ta.highest(high, 2) - (fib_range * fib_1)
- // RSI
- rsi_length = input(14, "RSI Length")
- rsi_overbought = input(70, "RSI Overbought Level")
- rsi_oversold = input(30, "RSI Oversold Level")
- rsi_value = ta.rsi(close, rsi_length)
- // Determine buy and sell conditions
- buy_condition = ta.crossover(rsi_value, rsi_oversold) and close > fib_level_1
- sell_condition = ta.crossunder(rsi_value, rsi_overbought) and close < fib_level_0
- // Plot Fibonacci levels
- plot(fib_level_0, color=color.red, linewidth=2)
- plot(fib_level_1, color=color.green, linewidth=2)
- // Plot RSI
- plot(rsi_value, "RSI", color=color.blue, linewidth=2)
- // Plot buy and sell signals
- plotshape(buy_condition, title="Buy Signal", location=location.belowbar, color=color.green, style=shape.labelup, text="BUY")
- plotshape(sell_condition, title="Sell Signal", location=location.abovebar, color=color.red, style=shape.labeldown, text="SELL")
Advertisement
Add Comment
Please, Sign In to add comment