UT 3 3 strategythis is for test Ut bot 3 and 3
this have tp and sl persent and show use martingle for manage losses
in table show maximum sequent loss and date that happened
Indicators and strategies
atheromeri RSI//@version=5
indicator(title="Relative Strength Index", shorttitle="RSI", format=format.price, precision=2, timeframe="", timeframe_gaps=true)
rsiLengthInput = input.int(14, minval=1, title="RSI Length", group="RSI Settings")
rsiSourceInput = input.source(close, "Source", group="RSI Settings")
calculateDivergence = input.bool(false, title="Calculate Divergence", group="RSI Settings", display = display.data_window, tooltip = "Calculating divergences is needed in order for divergence alerts to fire.")
change = ta.change(rsiSourceInput)
up = ta.rma(math.max(change, 0), rsiLengthInput)
down = ta.rma(-math.min(change, 0), rsiLengthInput)
rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / down))
rsiPlot = plot(rsi, "RSI", color=#7E57C2)
rsiUpperBand = hline(70, "RSI Upper Band", color=#787B86)
midline = hline(50, "RSI Middle Band", color=color.new(#787B86, 50))
rsiLowerBand = hline(30, "RSI Lower Band", color=#787B86)
fill(rsiUpperBand, rsiLowerBand, color=color.rgb(126, 87, 194, 90), title="RSI Background Fill")
midLinePlot = plot(50, color = na, editable = false, display = display.none)
fill(rsiPlot, midLinePlot, 100, 70, top_color = color.new(color.green, 0), bottom_color = color.new(color.green, 100), title = "Overbought Gradient Fill")
fill(rsiPlot, midLinePlot, 30, 0, top_color = color.new(color.red, 100), bottom_color = color.new(color.red, 0), title = "Oversold Gradient Fill")
// Smoothing MA inputs
GRP = "Moving Average"
TT_BB = "Only applies when 'SMA + Bollinger Bands' is selected. Determines the distance between the SMA and the bands."
maTypeInput = input.string("SMA", "Type", options = , group = GRP, display = display.data_window)
maLengthInput = input.int(14, "Length", group = GRP, display = display.data_window)
bbMultInput = input.float(2.0, "BB StdDev", minval = 0.001, maxval = 50, step = 0.5, tooltip = TT_BB, group = GRP, display = display.data_window)
var enableMA = maTypeInput != "None"
var isBB = maTypeInput == "SMA + Bollinger Bands"
// Smoothing MA Calculation
ma(source, length, MAtype) =>
switch MAtype
"SMA" => ta.sma(source, length)
"SMA + Bollinger Bands" => ta.sma(source, length)
"EMA" => ta.ema(source, length)
"SMMA (RMA)" => ta.rma(source, length)
"WMA" => ta.wma(source, length)
"VWMA" => ta.vwma(source, length)
// Smoothing MA plots
smoothingMA = enableMA ? ma(rsi, maLengthInput, maTypeInput) : na
smoothingStDev = isBB ? ta.stdev(rsi, maLengthInput) * bbMultInput : na
plot(smoothingMA, "RSI-based MA", color=color.yellow, display = enableMA ? display.all : display.none)
bbUpperBand = plot(smoothingMA + smoothingStDev, title = "Upper Bollinger Band", color=color.green, display = isBB ? display.all : display.none)
bbLowerBand = plot(smoothingMA - smoothingStDev, title = "Lower Bollinger Band", color=color.green, display = isBB ? display.all : display.none)
fill(bbUpperBand, bbLowerBand, color= isBB ? color.new(color.green, 90) : na, title="Bollinger Bands Background Fill", display = isBB ? display.all : display.none)
// Divergence
lookbackRight = 5
lookbackLeft = 5
rangeUpper = 60
rangeLower = 5
bearColor = color.red
bullColor = color.green
textColor = color.white
noneColor = color.new(color.white, 100)
_inRange(bool cond) =>
bars = ta.barssince(cond)
rangeLower <= bars and bars <= rangeUpper
plFound = false
phFound = false
bullCond = false
bearCond = false
rsiLBR = rsi
if calculateDivergence
//------------------------------------------------------------------------------
// Regular Bullish
// rsi: Higher Low
plFound := not na(ta.pivotlow(rsi, lookbackLeft, lookbackRight))
rsiHL = rsiLBR > ta.valuewhen(plFound, rsiLBR, 1) and _inRange(plFound )
// Price: Lower Low
lowLBR = low
priceLL = lowLBR < ta.valuewhen(plFound, lowLBR, 1)
bullCond := priceLL and rsiHL and plFound
//------------------------------------------------------------------------------
// Regular Bearish
// rsi: Lower High
phFound := not na(ta.pivothigh(rsi, lookbackLeft, lookbackRight))
rsiLH = rsiLBR < ta.valuewhen(phFound, rsiLBR, 1) and _inRange(phFound )
// Price: Higher High
highLBR = high
priceHH = highLBR > ta.valuewhen(phFound, highLBR, 1)
bearCond := priceHH and rsiLH and phFound
plot(
plFound ? rsiLBR : na,
offset=-lookbackRight,
title="Regular Bullish",
linewidth=2,
color=(bullCond ? bullColor : noneColor),
display = display.pane
)
plotshape(
bullCond ? rsiLBR : na,
offset=-lookbackRight,
title="Regular Bullish Label",
text=" Bull ",
style=shape.labelup,
location=location.absolute,
color=bullColor,
textcolor=textColor
)
plot(
phFound ? rsiLBR : na,
offset=-lookbackRight,
title="Regular Bearish",
linewidth=2,
color=(bearCond ? bearColor : noneColor),
display = display.pane
)
plotshape(
bearCond ? rsiLBR : na,
offset=-lookbackRight,
title="Regular Bearish Label",
text=" Bear ",
style=shape.labeldown,
location=location.absolute,
color=bearColor,
textcolor=textColor
)
alertcondition(bullCond, title='Regular Bullish Divergence', message="Found a new Regular Bullish Divergence, `Pivot Lookback Right` number of bars to the left of the current bar.")
alertcondition(bearCond, title='Regular Bearish Divergence', message='Found a new Regular Bearish Divergence, `Pivot Lookback Right` number of bars to the left of the current bar.')
Advanced Multi-Indicator BTC/USD StrategyThis strategy combines several indicators to achieve precise entries and exits when trading BTC/USD. It focuses on signals of upward and downward movements based on trends, oscillators, and momentum indicators, with the requirement that most conditions are met before opening or closing a position.
First 5 Minutes Open/Close LinesThis very simple indicator paints lines at the high and low of the first 5m candle of the session. It is primarily intended for big cap NYSE traded stocks with high volume. I wrote this indicator to save me the trouble of manually drawing the lines each day.
The lines drawn at the 5m high/low will remain constant regardless of which timeframe you switch to. In the example screenshot, we are looking at the 1m timeframe. This helps us switch effortlessly between different timeframes to see if a given price movement meets our entry criteria.
In addition to drawing lines at the first 5m high/low, it will optionally paint two zones, one each around the high and low. The boundaries of this zone are configurable and expressed as a percentage of the total movement of the first 5m bar. By default, it is set to 25%.
This indicator is based on the concept that the first 5m bar always has massive volume which helps us infer that price may react around the extremes of that movement. The basic strategy works something like this:
- You identify the high timeframe (HTF) trend direction of the stock
- You wait for the first 5m candle of the session to close
- You wait for price to puncture through the outer boundary of the zone marked by the indicator.
- You enter when price retraces to the high, or low, which marks the midpoint of the punctured zone.
- Only enter long on stocks in a HTF uptrend, and short on stocks in an HTF downtrend.
- Use market structure to identify stop loss and take profit targets
Note: Use at your own risk. This indicator and the strategy described herein are not in any way financial advice, nor does the author of this script make any claims about the effectiveness of this strategy, which may depend highly on the discretion and skill of the trader executing it, among many other factors outside of the author's control. The author of this script accepts no liability, and is not responsible for any trading decisions that you may or may not make as a result of this indicator. You should expect to lose money if using this indicator.
Trading Copter Ribbon EMATrading Copter Ribbon EMA is a versatile technical analysis tool designed to help traders identify trends and potential reversals in the market. This indicator utilizes multiple Exponential Moving Averages (EMAs) with varying lengths to create a dynamic ribbon effect, offering clear visual cues of market direction.
ATH y ATLEste script muestra el nivel de precio máximo y mínimo de la acción del gráfico, con el objetivo de poder efectuar análisis más precisos en los escenarios donde el precio alcanza esos niveles históricos para poder evaluar la posible acción del precio
MTF+MA V2 MTF+MA Indicator by ridvansozen1
The MTF+MA Indicator is a multi-timeframe moving average strategy developed by TradingView user ridvansozen1. This tool is designed to assist cryptocurrency traders in identifying potential long and short trading opportunities by analyzing market trends across multiple timeframes.
Key Features:
Multi-Timeframe Analysis: Utilizes fast and slow exponential moving averages (EMAs) on user-defined long, mid, and short-term timeframes to assess market direction.
Signal Generation: Generates long signals when all selected timeframes indicate a positive trend and short signals when all indicate a negative trend.
Customizable Parameters: Allows users to adjust source data, EMA lengths, and timeframes to tailor the strategy to specific trading preferences.
Date Range Filtering: Includes settings to define specific date ranges for signal generation, enabling focused backtesting and analysis.
How to Use:
Configure Moving Averages: Set your preferred lengths for the fast and slow EMAs.
Select Timeframes: Choose the long, mid, and short-term timeframes that align with your trading strategy.
Set Date Range: Define the date range during which the strategy should generate signals.
Interpret Signals: Monitor the indicator plots—green, blue, and red lines representing the EMA differences across timeframes. A long position is suggested when all three lines are above zero, and a short position is suggested when all are below zero.
Disclaimer: This indicator is intended for educational purposes and should not be considered financial advice. Users are encouraged to conduct thorough backtesting and apply proper risk management before utilizing this strategy in live trading.
Alikyy//@version=5
indicator("Fibonacci ve SMA", overlay=true)
// SMA hesaplama
ma5 = ta.sma(close, 5)
ma8 = ta.sma(close, 8)
ma13 = ta.sma(close, 13)
// 144 Günlük Fibonacci ayarları
len = input(144, 'Auto Fibo Length')
hl1272a = input(1.272, 'Adjustable Fibo Level')
AFL = input(false, title='Show Adjustable Fibo Level?')
AFL1 = input(false, title='Show 1.618 Fibo Level?')
AFL2 = input(false, title='Show 2.618 Fibo Level?')
AFL3 = input(false, title='Show 3.618 Fibo Level?')
// 144 günlük yüksek ve düşük hesaplama
h1 = ta.highest(high, len)
l1 = ta.lowest(low, len)
fark = h1 - l1
// Fibonacci seviyeleri
hl236 = l1 + fark * 0.236
hl382 = l1 + fark * 0.382
hl500 = l1 + fark * 0.5
hl618 = l1 + fark * 0.618
hl786 = l1 + fark * 0.786
hl1272 = l1 + fark * hl1272a
hl1618 = l1 + fark * 1.618
hl2618 = l1 + fark * 2.618
hl3618 = l1 + fark * 3.618
lh236 = h1 - fark * 0.236
lh382 = h1 - fark * 0.382
lh500 = h1 - fark * 0.5
lh618 = h1 - fark * 0.618
lh786 = h1 - fark * 0.786
lh1272 = h1 - fark * hl1272a
lh1618 = h1 - fark * 1.618
lh2618 = h1 - fark * 2.618
lh3618 = h1 - fark * 3.618
// Hangi değerlerin gösterileceği
hbars = -ta.highestbars(high, len)
lbars = -ta.lowestbars(low, len)
f236 = hbars > lbars ? hl236 : lh236
f382 = hbars > lbars ? hl382 : lh382
f500 = hbars > lbars ? hl500 : lh500
f618 = hbars > lbars ? hl618 : lh618
f786 = hbars > lbars ? hl786 : lh786
f1272 = hbars > lbars ? hl1272 : lh1272
f1618 = hbars > lbars ? hl1618 : lh1618
f2618 = hbars > lbars ? hl2618 : lh2618
f3618 = hbars > lbars ? hl3618 : lh3618
// SMA'ları çizme
plot(ma5, color=color.blue, title="5 Günlük SMA")
plot(ma8, color=color.red, title="8 Günlük SMA")
plot(ma13, color=color.green, title="13 Günlük SMA")
// Fibonacci seviyelerini çizme
plot(l1, trackprice=true, offset=-9999, color=color.new(#4B0082, 0), linewidth=3)
plot(h1, trackprice=true, offset=-9999, color=color.new(#4B0082, 0), linewidth=3)
plot(f236, trackprice=true, offset=-9999, color=color.new(color.black, 0), title='0.236')
plot(f382, trackprice=true, offset=-9999, color=color.new(color.blue, 0), linewidth=1, title='0.382')
plot(f500, trackprice=true, offset=-9999, color=color.new(color.gray, 0), linewidth=1, title='0.5')
plot(f618, trackprice=true, offset=-9999, color=color.new(#800000, 0), linewidth=2, title='0.618')
plot(f786, trackprice=true, offset=-9999, color=color.new(color.black, 0), title='0.786')
plot(AFL and f1272 ? f1272 : na, trackprice=true, offset=-9999, color=color.new(color.red, 0), linewidth=2, title='1.272')
plot(AFL1 and f1618 ? f1618 : na, trackprice=true, offset=-9999, color=color.new(color.red, 0), linewidth=2, title='1.618')
plot(AFL2 and f2618 ? f2618 : na, trackprice=true, offset=-9999, color=color.new(color.red, 0), linewidth=2, title='2.618')
plot(AFL3 and f3618 ? f3618 : na, trackprice=true, offset=-9999, color=color.new(color.red, 0), linewidth=2, title='3.618')
BAR COLORthis indicator is to analyse the speed of trend you can trade when candel changes his color and exit with change in another color
MDM Customizable 5 EMA
//@version=5
indicator("MDM Customizable 5 EMA", overlay=true)
// Define inputs for EMA lengths and colors
emaLength1 = input.int(8, title="EMA Length 1")
emaColor1 = input.color(color.new(color.purple, 0), title="EMA Color 1")
emaLength2 = input.int(21, title="EMA Length 2")
emaColor2 = input.color(color.new(color.green, 0), title="EMA Color 2")
emaLength3 = input.int(55, title="EMA Length 3")
emaColor3 = input.color(color.new(color.blue, 0), title="EMA Color 3")
emaLength4 = input.int(144, title="EMA Length 4")
emaColor4 = input.color(color.new(color.orange, 0), title="EMA Color 4")
emaLength5 = input.int(233, title="EMA Length 5")
emaColor5 = input.color(color.new(color.gray, 0), title="EMA Color 5")
// Calculate the EMAs
ema1 = ta.ema(close, emaLength1)
ema2 = ta.ema(close, emaLength2)
ema3 = ta.ema(close, emaLength3)
ema4 = ta.ema(close, emaLength4)
ema5 = ta.ema(close, emaLength5)
// Plot the EMAs with the selected colors
plot(ema1, title="EMA 1", color=emaColor1, linewidth=2)
plot(ema2, title="EMA 2", color=emaColor2, linewidth=2)
plot(ema3, title="EMA 3", color=emaColor3, linewidth=2)
plot(ema4, title="EMA 4", color=emaColor4, linewidth=2)
plot(ema5, title="EMA 5", color=emaColor5, linewidth=2)
//mean0 =(a8 + a13 + a21)/3
//mean1 = (a21 + a34 + a55)/3
////mean2 = (a34 + a55 + a89)/3
//mean3 = (a55 + a89 + a144)/3
// Define the length of the EMA
emaLength = 8
// Calculate the EMA for each time frame
//ema_3min = ta.ema(request.security(syminfo.tickerid, "3", close), emaLength)
//ema_15min = ta.ema(request.security(syminfo.tickerid, "15", close), emaLength)
//ema_8min = ta.ema(request.security(syminfo.tickerid, "8", close), emaLength)
// Plot the EMAs with respective colors
//plot(ema_3min, color=color.rgb(130, 232, 162, 32), linewidth=2, title="3-Min EMA 8 (Red)")
//plot(ema_15min, color=color.rgb(233, 167, 167), linewidth=2, title="5-Min EMA 8 (Cyan)")
//(ema_8min, color=#5e54e06b, linewidth=2, title="8-Min EMA 8 (Green)")
9:30 Opening Price LineMarks 9:30 open for PO3 and just a reminder of where price is trading in comparative to the 9:30 opening price
Combined HalfTrend + Willy EMA StrategyAl dene /@version=5
indicator("Combined HalfTrend + Willy EMA Strategy", overlay=true)
// HalfTrend Ayarları
amplitude = input(2, title="HalfTrend Amplitude")
channelDeviation = input(2, title="HalfTrend Channel Deviation")
emaLength = input(12, title="EMA Length") // Williams %R için EMA uzunluğu
wrLength = input(45, title="Williams %R Length") // Williams %R uzunluğu
// HalfTrend Değişkenleri
var int trend = 0
var int nextTrend = 0
var float maxLowPrice = nz(low , low)
var float minHighPrice = nz(high , high)
var float up = 0.0
var float down = 0.0
float atr2 = ta.atr(100) / 2
float arrowUp = na
<relativeStrenght/>This custom RSI (Relative Strength Index) indicator is based on the traditional RSI with a 14-period length but includes additional levels at 20, 30, 40, 50, 60, 70, and 80, providing a more detailed view of price momentum and potential reversal zones. Unlike standard RSI indicators with just two thresholds (overbought at 70 and oversold at 30), this enhanced RSI allows traders to assess intermediate levels of buying and selling pressure. The multiple levels offer finer insights, helping traders identify early signals of trend shifts, possible consolidation zones, and the strength of trends across a broader spectrum.
Fun Numbers Resistance (10k-1M)round numbers and human tradeable levels
eg
11111 "Repeating 1's"
12345 "Ascending 12345"
42069 "420 + 69 Meme"
71717.1 "Repeating 71's"
76543.21 "Countdown"
EMA AND PIVOT its a combination multiple EMA and pivot point indicator for finding major crucial points
BELLEZZA: Market Strength IndicatorThe BELLEZZA: Market Strength Indicator is a comprehensive tool designed to help traders assess overall market sentiment by combining signals from multiple technical indicators. This indicator displays real-time signals from the RSI, Stochastic Oscillator, MACD, and the 50-day, 100-day, and 200-day Simple Moving Averages (SMAs) in a convenient table on your chart.
Features
Multi-Indicator Analysis: Aggregates signals from six popular technical indicators to provide a holistic view of market conditions.
High-Contrast Visuals: Utilizes high-contrast colors for better visibility and readability, ensuring signals are easily distinguishable.
Customizable Display: Allows you to adjust the text color and position of the signal table on the chart to suit your preferences.
Real-Time Updates: Refreshes signals on each confirmed bar, providing up-to-date information for timely decision-making.
Benefits of the Indicator
Quick Market Overview: Instantly assess market sentiment without analyzing each indicator separately.
Enhanced Visibility: High-contrast colors ensure signals are easily visible against any chart background.
Customizable Appearance: Adjust the indicator's display to fit your trading style and chart preferences.
Real-Time Insights: Stay updated with the latest market signals as the indicator refreshes on each confirmed bar.
Limitations
Indicator Lag:
Some indicators like moving averages are lagging indicators and may not reflect immediate market changes.
False Signals:
No indicator is 100% accurate. Always consider the possibility of false signals.
Market Conditions:
Extreme market volatility can affect indicator performance. Use in conjunction with other analysis methods.
Disclaimer
Educational Purposes:
This indicator is intended for educational and informational purposes only.
No Financial Advice:
It does not constitute financial advice. Always consult with a professional financial advisor.
Risk Warning:
Trading involves significant risk, and past performance is not indicative of future results.
Personal Responsibility:
Users are responsible for their own trading decisions.
5-Minute YEN Pivot Bars 1.0The 5-Minute YEN Pivot Bars indicator is designed to identify and highlight low-range pivot bars on 5-minute charts, specifically tailored for Yen-based pairs (e.g., GBPJPY, USDJPY). By focusing on precise pip thresholds, this tool helps traders detect potential pivot points within specific trading sessions, while avoiding inside bars and other noise often seen in low-volatility conditions. This can be particularly useful for trend traders and those looking to refine their entry points based on intraday reversals.
Key Features:
- Customized Pip Thresholds for Yen Pairs:
The indicator is pre-configured for Yen pairs, where 1 pip is typically represented by 0.01. It applies these thresholds:
- Limited Range: 4 pips or less between open and close prices.
- High/Low Directionality: At least 3 pips from the close/open to the bar's high or low.
- Open/Close Proximity: 4 pips or less between open and close.
- Inside Bar Tolerance: A tolerance of 3 pips for inside bars, helping reduce false signals from bars contained within the previous bar's range.
- Session-Specific Alerts:
- The indicator allows you to enable alerts for the European Session (6:00-12:00), American Session (12:00-17:00), and London Close (17:00-20:00). You can adjust these times based on your own trading hours or timezone preferences via a time-shift setting.
- Receive real-time alerts when a valid bullish or bearish pivot bar is identified within the chosen sessions, allowing you to respond to potential trade opportunities immediately.
- Time Shift Customization:
- Adjust the "Time Shift" parameter to account for different time zones, ensuring accurate session alignment regardless of your local time.
How It Works:
1. Pivot Bar Identification:
The indicator scans for bars where the difference between the open and close is within the "Limited Range" threshold, and both open and close prices are close to either the high or the low of the bar.
2. Directional Filtering:
It requires the bar to show strong directional bias by enforcing an additional distance between the open/close levels and the opposite end of the bar (high/low). Only bars with this directional structure are considered for highlighting.
3. Exclusion of Inside Bars:
Bars that are completely contained within the range of the previous bar are excluded (inside bars), as are consecutive inside bars. This filtering is essential to avoid marking bars that typically indicate consolidation rather than potential pivot points.
4. Session Alerts:
When a valid pivot bar appears within the selected sessions, an alert is triggered, notifying the trader of a potential trading signal. Bullish and bearish signals are differentiated based on whether the close is near the high or low.
How to Use:
- Trend Reversals: Use this indicator to spot potential trend reversals or pullbacks on a 5-minute chart, especially within key trading sessions.
- Entry and Exit Points: Highlighted bars can serve as potential entry points for traders looking to capitalize on short-term directional changes or continuation patterns.
- Combine with Other Indicators: Consider pairing this tool with momentum indicators or trendlines to confirm the signals, providing a comprehensive analysis framework.
Default Parameters:
- Limited Range: 4 Pips
- High/Low Directionality: 3 Pips
- Open/Close Proximity: 4 Pips
- Inside Bar Tolerance: 3 Pips
- Session Alerts: Enabled for European, American, and London Close sessions
- Time Shift: Default 6 (adjustable to align with different time zones)
This indicator is specifically optimized for Yen pairs on 5-minute charts due to its pip calculation.
Depth Trend Indicator - RSIDepth Trend Indicator - RSI
This indicator is designed to identify trends and gauge pullback strength by combining the power of RSI and moving averages with a depth-weighted calculation. The script was created by me, Nathan Farmer and is based on a multi-step process to determine trend strength and direction, adjusted by a "depth" factor for more accurate signal analysis.
How It Works
Trend Definition Using RSI: The RSI Moving Average ( rsiMa ) is calculated to assess the current trend, using customizable parameters for the RSI Period and MA Period .
Trends are defined as follows:
Uptrend : RSI MA > Critical RSI Value
Downtrend : RSI MA < Critical RSI Value
Pullback Depth Calculation: To measure pullback strength relative to the current trend, the indicator calculates a Depth Percentage . This is defined as the portion of the gap between the moving average and the price covered by a pullback.
Depth-Weighted RSI Calculation: The Depth Percentage is then applied as a weighting factor on the RSI Moving Average , giving us a Weighted RSI line that adjusts to the depth of pullbacks. This line is rather noisy, and as such we take a moving average to smooth out some of the noise.
Key Parameters
RSI Period : The period for RSI calculation.
MA Period : The moving average period applied to RSI.
Price MA Period : Determines the SMA period for price, used to calculate pullback depth.
Smoothing Length : Length of smoothing applied to the weighted RSI, creating a more stable signal.
RSI Critical Value : The critical value (level) used in determining whether we're in an uptrend or a downtrend.
Depth Critical Value : The critical value (level) used in determining whether or not the depth weighted value confirms the state of a trend.
Notes:
As always, backtest this indicator and modify the parameters as needed for your specific asset, over your specific timeframe. I chose these defaults as they worked well on the assets I look at, but it is likely you tend to look at a different group of assets over a different timeframe than what I do.
Large pullbacks can create large downward spikes in the weighted line. This isn't graphically pleasing, but I have tested it with various methods of normalization and smoothing and found the simple smoothing used in the indicator to be best despite this.
[Gw]Adaptive RSI Candles V1 (Refined)//@version=5
indicator(title=' Adaptive RSI Candles V1 (Refined)', shorttitle='ARC RSI', overlay=false)
// Inputs for RSI
rsiLength = input.int(title='RSI Length', defval=14)
multiplier = input.float(title='Range Multiplier:', defval=0.1)
SHOW_RSI_LINE = input.bool(title='Show RSI Line?', defval=true)
// RSI Calculation
rsiValue = ta.rsi(close, rsiLength)
// Calculate high and low values for RSI adaptive range
var float rsiHigh = na
var float rsiLow = na
rsiHigh := na(rsiHigh ) ? rsiValue : (rsiValue >= rsiHigh ? rsiValue : rsiHigh )
rsiLow := na(rsiLow ) ? rsiValue : (rsiValue <= rsiLow ? rsiValue : rsiLow )
rsiRange = (rsiHigh - rsiLow) * multiplier
// Adaptive average calculation for RSI
var float adaptiveRsi = na
adaptiveRsi := na(adaptiveRsi ) ? rsiValue : (rsiValue > adaptiveRsi + rsiRange ? rsiValue : (rsiValue < adaptiveRsi - rsiRange ? rsiValue : adaptiveRsi ))
// Preventing repainting
var float prevAdaptiveRsi = na
prevAdaptiveRsi := ta.valuewhen(ta.change(adaptiveRsi) != 0, adaptiveRsi, 1)
// Plot the adaptive RSI candles with reduced noise
plotcandle(prevAdaptiveRsi, rsiHigh, rsiLow, adaptiveRsi, color=adaptiveRsi > prevAdaptiveRsi ? color.lime : color.red)
// Option to plot the RSI line
plot(title='RSI', series=SHOW_RSI_LINE ? rsiValue : na, color=color.blue, linewidth=1)
// Plot Overbought, Oversold, and 50-Level Lines
hline(70, 'Overbought', color=color.red, linestyle=hline.style_dotted)
hline(50, 'Mid-Level', color=color.gray, linestyle=hline.style_solid)
hline(30, 'Oversold', color=color.green, linestyle=hline.style_dotted)
// Buy/Sell Labels Based on RSI 50-Level Crossover
longCondition = ta.crossover(rsiValue, 50)
shortCondition = ta.crossunder(rsiValue, 50)
if (longCondition)
label.new(bar_index, rsiValue, "Buy", color=color.green, textcolor=color.white, size=size.small, style=label.style_label_up)
if (shortCondition)
label.new(bar_index, rsiValue, "Sell", color=color.red, textcolor=color.white, size=size.small, style=label.style_label_down)