-
PHP Code:
//@version=6
indicator(title = 'Master Trend BUY&SELL', shorttitle = '.', overlay = true, max_labels_count=500)
////
// === Inputs ===
fairLen = input.int(50, "Fair Value EMA Length")
zLen = input.int(100, "Z-Score Lookback Length")
zThreshold = input.float(3.0, "Z-Score Threshold")
src = input.source(close, "Source")
rsiLen = input.int(14, "RSI Length")
rsiEmaLen = input.int(7, "EMA of RSI Slope")
colorMode = input.string("None", "Bar Coloring Mode", options=[
"None",
"Reversal Solid",
"Reversal Fade",
"Exceeding Bands",
"Classic Heat"
])
enableSignals = input.bool(false,'Show Signals')
// === Smooth RGB Gradient Function
f_colorGradient(_ratio, _colA, _colB) =>
rA = color.r(_colA)
gA = color.g(_colA)
bA = color.b(_colA)
rB = color.r(_colB)
gB = color.g(_colB)
bB = color.b(_colB)
rr = rA + int((rB - rA) * _ratio)
rg = gA + int((gB - gA) * _ratio)
rb = bA + int((bB - bA) * _ratio)
color.rgb(rr, rg, rb, 0)
// === Color Scheme ===
bullMain = color.new(#5CF0D7, 0)
bearMain = color.new(#B32AC3, 0)
labelTextCol = color.white
borderCol = color.white
// === Fair Value (EMA Only) ===
fair = ta.ema(src, fairLen)
// === Z-Score Deviation
dev = src - fair
devMean = ta.sma(dev, zLen)
devStdev = ta.stdev(dev, zLen)
zScore = devStdev != 0 ? (dev - devMean) / devStdev : 0
// === Z-Bands
upperBand = fair + zThreshold * devStdev
lowerBand = fair - zThreshold * devStdev
// === Re-entry Logic
wasAbove = src[1] > upperBand[1]
wasBelow = src[1] < lowerBand[1]
backInsideFromAbove = wasAbove and src <= upperBand
backInsideFromBelow = wasBelow and src >= lowerBand
// === RSI EMA Slope Filter
rsi = ta.rsi(close, rsiLen)
rsiEma = ta.ema(rsi, rsiEmaLen)
rsiSlope = rsiEma - rsiEma[1]
slopeUp = rsiSlope > 0
slopeDown = rsiSlope < 0
// === Signal Memory (One per slope)
var bool buyFiredOnSlope = false
var bool sellFiredOnSlope = false
// Reset logic when slope flips
buyReset = ta.crossover(rsiSlope, 0)
sellReset = ta.crossunder(rsiSlope, 0)
if buyReset
buyFiredOnSlope := false
if sellReset
sellFiredOnSlope := false
// Final entry conditions
finalBuy = backInsideFromBelow and slopeUp and not buyFiredOnSlope and enableSignals
finalSell = backInsideFromAbove and slopeDown and not sellFiredOnSlope and enableSignals
if finalBuy
buyFiredOnSlope := true
if finalSell
sellFiredOnSlope := true
// === Bar Coloring Modes
// Reversal Memory (for "Reversal Solid" and "Reversal Fade")
var string lastSignal = ""
if finalBuy
lastSignal := "bull"
if finalSell
lastSignal := "bear"
// Reversal Fade Tracker
var int signalAge = 0
if finalBuy or finalSell
signalAge := 0
else
signalAge += 1
// info
var string lastTrend = ""
if close > upperBand
lastTrend := "bull"
else if close < lowerBand
lastTrend := "bear"
// === Bar Coloring Logic
var color barCol = na
// 1. Reversal Solid
if colorMode == "Reversal Solid"
barCol := lastSignal == "bull" ? color.new(bullMain, 0) : lastSignal == "bear" ? color.new(bearMain, 0) : na
if colorMode == "None"
barCol := na
// 2. Reversal Fade
if colorMode == "Reversal Fade"
fade = math.min(90, signalAge * 1)
barCol := lastSignal == "bull" ? color.new(bullMain, fade) : lastSignal == "bear" ? color.new(bearMain, fade) : na
// 4. Exceeding Bands Only (only when outside bands)
if colorMode == "Exceeding Bands"
barCol := close > upperBand ? color.new(bullMain, 0) : close < lowerBand ? color.new(bearMain, 0) : na
// 5. Classic Heat — correct: strongest color near bands, fade near fair
// 5. Classic Heat — fixed: most intense near boundaries, fades toward fair
// 6. Gradient Flow — RGB blend from bull to bear based on band distance
if colorMode == "Classic Heat"
bandRange = upperBand - lowerBand
ratioRaw = (close - lowerBand) / bandRange
ratioClamped = math.max(0.0, math.min(ratioRaw, 1.0))
barCol := f_colorGradient(ratioClamped, bullMain, bearMain)
barcolor(barCol)
// === Table Position Setting
enableTable = input.bool(true,'Enable Table')
tablePos = input.string("Top Right", "Table Position", options=["Top Left", "Top Right", "Bottom Left", "Bottom Right"])
pos = tablePos == "Top Left" ? position.top_left :
tablePos == "Top Right" ? position.top_right :
tablePos == "Bottom Left" ? position.bottom_left :
position.bottom_right
// === Scoring Logic
score_z = zScore < -zThreshold ? +1 : zScore > zThreshold ? -1 : 0
score_slope = rsiSlope > 0 ? +1 : rsiSlope < 0 ? -1 : 0
score_price = close > fair ? +1 : close < fair ? -1 : 0
score_trend = lastTrend == "bull" ? +1 : lastTrend == "bear" ? -1 : 0
score_reentry = finalBuy ? +1 : finalSell ? -1 : 0
// === Score Aggregation
totalScore = score_z + score_slope + score_price + score_trend + score_reentry
scoreCount = 5
avgScore = totalScore / scoreCount
finalSignal = avgScore > 0.1 ? "AL" : avgScore < -0.1 ? "SAT" : "Nötr"
finalColor = avgScore > 0.1 ? bullMain : avgScore < -0.1 ? bearMain : color.gray
// === Shared Style
bgcolor = color.new(#000000, 0)
textCol = color.white
// === Table Drawing
if bar_index % 2 == 0 and enableTable
var table scoreTable = table.new(pos, 2, 7,frame_width = 1, border_width=1, frame_color=color.white, border_color=color.white)
table.cell(scoreTable, 0, 0, "Ýnd", bgcolor=bgcolor, text_color=textCol)
table.cell(scoreTable, 1, 0, "Puan", bgcolor=bgcolor, text_color=textCol)
table.cell(scoreTable, 0, 1, "Z-Score", bgcolor=bgcolor, text_color=textCol)
table.cell(scoreTable, 1, 1, str.tostring(score_z), bgcolor=bgcolor, text_color=textCol)
table.cell(scoreTable, 0, 2, "RSI", bgcolor=bgcolor, text_color=textCol)
table.cell(scoreTable, 1, 2, str.tostring(score_slope), bgcolor=bgcolor, text_color=textCol)
table.cell(scoreTable, 0, 3, "Fiyat", bgcolor=bgcolor, text_color=textCol)
table.cell(scoreTable, 1, 3, str.tostring(score_price), bgcolor=bgcolor, text_color=textCol)
table.cell(scoreTable, 0, 4, "Trend ", bgcolor=bgcolor, text_color=textCol)
table.cell(scoreTable, 1, 4, str.tostring(score_trend), bgcolor=bgcolor, text_color=textCol)
table.cell(scoreTable, 0, 5, "R Giriþ", bgcolor=bgcolor, text_color=textCol)
table.cell(scoreTable, 1, 5, str.tostring(score_reentry),bgcolor=bgcolor, text_color=textCol)
table.cell(scoreTable, 0, 6, "Sonuç", bgcolor=bgcolor, text_color=textCol)
table.cell(scoreTable, 1, 6, finalSignal, bgcolor=bgcolor, text_color=finalColor)
table.cell_set_text_font_family(scoreTable,0,0,font.family_monospace)
table.cell_set_text_font_family(scoreTable,1,0,font.family_monospace)
table.cell_set_text_font_family(scoreTable,0,1,font.family_monospace)
table.cell_set_text_font_family(scoreTable,1,1,font.family_monospace)
table.cell_set_text_font_family(scoreTable,0,2,font.family_monospace)
table.cell_set_text_font_family(scoreTable,1,2,font.family_monospace)
table.cell_set_text_font_family(scoreTable,0,3,font.family_monospace)
table.cell_set_text_font_family(scoreTable,1,3,font.family_monospace)
table.cell_set_text_font_family(scoreTable,0,4,font.family_monospace)
table.cell_set_text_font_family(scoreTable,1,4,font.family_monospace)
table.cell_set_text_font_family(scoreTable,0,5,font.family_monospace)
table.cell_set_text_font_family(scoreTable,1,5,font.family_monospace)
table.cell_set_text_font_family(scoreTable,0,6,font.family_monospace)
table.cell_set_text_font_family(scoreTable,1,6,font.family_monospace)
/////////////////
src88 = input.source(close,"RSI Source",group = "Connors RSI")
lenrsi = input(24, "RSI Length",group = "Connors RSI")
lenupdown = input(20, "UpDown Length",group = "Connors RSI")
lenroc = input(75, "ROC Length",group = "Connors RSI")
z_score_length = input(14, "Z-Score Lookback",group = "Filtering")
threshold = input.float(1.5, "Z-Score Threshold", step=0.025,group = "Filtering")
trendingLongThreshold = input.float(65, "Trending Long Threshold" ,group = "Filtering")
trendingShortThreshold = input.float(35, "Trending Short Threshold",group = "Filtering")
revertingLongThreshold = input.float(70, title="Reverting Long Threshold",group = "Filtering")
revertingShortThreshold = input.float(30, title="Reverting Short Threshold",group = "Filtering")
// ─── CONNORS RSI ──────────────────────────────────────────────────────────
updown(s) =>
isEqual = s == s[1]
isGrowing = s > s[1]
ud = 0.0
ud := isEqual ? 0 : isGrowing ? (nz(ud[1]) <= 0 ? 1 : nz(ud[1])+1) : (nz(ud[1]) >= 0 ? -1 : nz(ud[1])-1)
ud
rsi88 = ta.rsi(src88, lenrsi)
updownrsi = ta.rsi(updown(src88), lenupdown)
percentrank = ta.percentrank(ta.roc(src88, 1), lenroc)
crsi = math.avg(rsi, updownrsi, percentrank)
// ─── Z-SCORING ──────────────────────────────────────────────────────────
mean = ta.sma(crsi, z_score_length)
stdDev = ta.stdev(crsi, z_score_length)
zScore88 = (crsi - mean) / stdDev
isTrending = math.abs(zScore88) > threshold
// ─── Signal Generation ────────────────────────────────────────────────
var int signal = 0
if barstate.isconfirmed
if isTrending
signal := crsi > trendingLongThreshold ? 1 : crsi < trendingShortThreshold ? -1 : signal[1]
else
signal := crsi > revertingLongThreshold ? 1 : crsi < revertingShortThreshold ? -1 : signal[1]
trendColor = signal == 1 ? #17dfad : signal == -1 ? #dd326b : color.gray
//decor = plot(crsi,"Decor",style = plot.style_columns,histbase = 50,color=trendColor,linewidth = 2)
bgcolor(color.new(trendColor,75))
//plotcandle(open,high,low,close,"Candles",color=trendColor,wickcolor = trendColor,bordercolor = trendColor,force_overlay = true)
/////////////
src77 = close
rsiLen77 = input.int(1, 'RSI Length', group = "T3")
minLen = input.int(3, 'Min T3 Length', group = "T3")
maxLen = input.int(5, 'Max T3 Length', group = "T3")
v = input.float(0.34, 'T3 Volume Factor', step = 0.01, maxval = 2, minval = 0.1, group = "T3")
color_up = input.color(#21b8f3)
color_dn = input.color(#fd761b)
grp_vol_b = 'Volatility Bands'
show_bands = input.bool(true, 'Display', group = grp_vol_b, inline = "vol")
vol_col = input.color(#21c9f380, "", group = grp_vol_b, inline = "vol")
volat = input.int(100, 'Volatility', group = grp_vol_b)
// Step 1: Adaptive length via RSI
rsi77 = ta.rsi(src77, rsiLen77)
rsi_scale = 1 - rsi77 / 100
len = math.round(minLen + (maxLen - minLen) * rsi_scale)
pine_ema(src, length) =>
alpha = 2 / (length + 1)
sum = 0.0
sum := na(sum[1]) ? src : alpha * src + (1 - alpha) * nz(sum[1])
sum
// Step 2: T3 with adaptive length
e1 = pine_ema(src, len)
e2 = pine_ema(e1, len)
e3 = pine_ema(e2, len)
e4 = pine_ema(e3, len)
e5 = pine_ema(e4, len)
e6 = pine_ema(e5, len)
c1 = -v * v * v
c2 = 3 * v * v + 3 * v * v * v
c3 = -6 * v * v - 3 * v - 3 * v * v * v
c4 = 1 + 3 * v + v * v * v + 3 * v * v
t3 = c1 * e6 + c2 * e5 + c3 * e4 + c4 * e3
t3_col = t3 > t3[2] ? color_up : color_dn
stdv = ta.stdev(t3, volat)
pt31 = plot(t3, color = t3_col, linewidth = 1, editable = false)
pt32 = plot(t3[2], color = t3_col, linewidth = 1, editable = false)
plotchar(ta.crossover(t3, t3[2]) or ta.crossunder(t3, t3[2]) ? t3 : na, "", "🞛", location.absolute, t3_col)
////////////
//@ Julien_Eche
//@version=6
length = input.int(20, title="SMEMA Length")
table_size = input.string("normal", title="Table Size", options=["small", "normal", "large"])
table_text_size = table_size
show_deviation_lines = input.bool(true, title="Show Deviation Levels")
show_tf_cells = input.bool(true, title="Show All Timeframes")
approach = input.string("Swing Trading", title="Overall Trend Weighting", options=["Long Term", "Swing Trading", "Short Term"])
color_bull = input.color(#ecf405, title="Bull Color", inline="col")
color_bear = input.color(color.rgb(5, 29, 247), title="Bear Color", inline="col")
color_neutral = input.color(color.rgb(205, 2, 246), title="Neutral Color", inline="col")
get_trend_arrow(score) => score >= 0.5 ? "➚" : score <= -0.5 ? "➘" : "➡"
get_trend_strength(score) => str.tostring(math.round(math.abs(score))) + "/10"
trend_col(score) => score > 0.5 ? color_bull : score < -0.5 ? color_bear : color_neutral
get_dynamic_color(score, alpha) => color.new(trend_col(score), alpha)
get_band_color(level, src, score, is_upper, col_bull, col_bear) =>
r = math.abs(src - level) / ta.percentile_linear_interpolation(math.abs(src - level), 400, 100)
c = score > 0 and is_upper ? col_bull : score < 0 and not is_upper ? col_bear : na
result = na(c) ? na : r <= 0.03 ? color.new(c, 96) : r <= 0.06 ? color.new(c, 90) : r <= 0.10 ? color.new(c, 80) : r <= 0.15 ? color.new(c, 68) : r <= 0.20 ? color.new(c, 55) : r <= 0.27 ? color.new(c, 42) : r <= 0.35 ? color.new(c, 30) : color.new(c, 18)
result
get_score_internal() =>
sm = ta.sma(ta.ema(close, length), length)
sm_prev = ta.sma(ta.ema(close[1], length), length)
step = ta.atr(100)
slope = sm - sm_prev
slope_ratio = slope / sm
slope_ratio := slope_ratio > 0.1 ? 0.1 : slope_ratio < -0.1 ? -0.1 : slope_ratio
slope_weight = 1.0 + slope_ratio * 10.0
bull = (close > sm + step ? 1 : 0) + (close > sm + step * 2 ? 1 : 0) + (close > sm + step * 3 ? 1 : 0)
bear = (close < sm - step ? 1 : 0) + (close < sm - step * 2 ? 1 : 0) + (close < sm - step * 3 ? 1 : 0)
raw_score = (bull - bear) * 10.0 / 3.0
adjusted_score = raw_score * slope_weight
adjusted_score := adjusted_score > 10.0 ? 10.0 : adjusted_score < -10.0 ? -10.0 : adjusted_score
adjusted_score
sm = ta.sma(ta.ema(close, length), length)
sm_prev = ta.sma(ta.ema(close[1], length), length)
step = ta.atr(100)
sm_bull = (close > sm + step ? 1 : 0) + (close > sm + step * 2 ? 1 : 0) + (close > sm + step * 3 ? 1 : 0)
sm_bear = (close < sm - step ? 1 : 0) + (close < sm - step * 2 ? 1 : 0) + (close < sm - step * 3 ? 1 : 0)
sm_score = (sm_bull - sm_bear) * 10.0 / 3.0
slope = sm - sm_prev
slope_ratio = slope / step
slope_ratio := slope_ratio > 2.0 ? 2.0 : slope_ratio < -2.0 ? -2.0 : slope_ratio
slope_weight = 1.0 + slope_ratio * 0.25
adjusted_sm_score = sm_score * slope_weight
adjusted_sm_score := adjusted_sm_score > 10.0 ? 10.0 : adjusted_sm_score < -10.0 ? -10.0 : adjusted_sm_score
plot(show_deviation_lines ? sm + step * 3 : na, color=get_band_color(sm + step * 3, close, adjusted_sm_score, true, color_bull, color_bear))
plot(show_deviation_lines ? sm + step * 2 : na, color=get_band_color(sm + step * 2, close, adjusted_sm_score, true, color_bull, color_bear))
plot(show_deviation_lines ? sm + step : na, color=get_band_color(sm + step , close, adjusted_sm_score, true, color_bull, color_bear))
plot(sm, color=get_dynamic_color(adjusted_sm_score, 0), title="SMEMA", linewidth=2)
plot(show_deviation_lines ? sm - step : na, color=get_band_color(sm - step , close, adjusted_sm_score, false, color_bull, color_bear))
plot(show_deviation_lines ? sm - step * 2 : na, color=get_band_color(sm - step * 2, close, adjusted_sm_score, false, color_bull, color_bear))
plot(show_deviation_lines ? sm - step * 3 : na, color=get_band_color(sm - step * 3, close, adjusted_sm_score, false, color_bull, color_bear))
/////////////////
https://www.tradingview.com/x/Fbs3GFVX/
kombine yapýlmýþ kod...
-
kombin...istediðiniz gibi deðiþtirin...
PHP Code:
//@version=6
indicator(title = 'Master Trend BUY&SELL', shorttitle = '.', overlay = true, max_lines_count = 500, max_labels_count=500)
////
// === Inputs ===
fairLen = input.int(50, "Fair Value EMA Length")
zLen = input.int(100, "Z-Score Lookback Length")
zThreshold = input.float(3.0, "Z-Score Threshold")
src = input.source(close, "Source")
rsiLen = input.int(14, "RSI Length")
rsiEmaLen = input.int(7, "EMA of RSI Slope")
colorMode = input.string("None", "Bar Coloring Mode", options=[
"None",
"Reversal Solid",
"Reversal Fade",
"Exceeding Bands",
"Classic Heat"
])
enableSignals = input.bool(false,'Show Signals')
// === Smooth RGB Gradient Function
f_colorGradient(_ratio, _colA, _colB) =>
rA = color.r(_colA)
gA = color.g(_colA)
bA = color.b(_colA)
rB = color.r(_colB)
gB = color.g(_colB)
bB = color.b(_colB)
rr = rA + int((rB - rA) * _ratio)
rg = gA + int((gB - gA) * _ratio)
rb = bA + int((bB - bA) * _ratio)
color.rgb(rr, rg, rb, 0)
// === Color Scheme ===
bullMain = color.new(#5CF0D7, 0)
bearMain = color.new(#B32AC3, 0)
labelTextCol = color.white
borderCol = color.white
// === Fair Value (EMA Only) ===
fair = ta.ema(src, fairLen)
// === Z-Score Deviation
dev = src - fair
devMean = ta.sma(dev, zLen)
devStdev = ta.stdev(dev, zLen)
zScore = devStdev != 0 ? (dev - devMean) / devStdev : 0
// === Z-Bands
upperBand = fair + zThreshold * devStdev
lowerBand = fair - zThreshold * devStdev
// === Re-entry Logic
wasAbove = src[1] > upperBand[1]
wasBelow = src[1] < lowerBand[1]
backInsideFromAbove = wasAbove and src <= upperBand
backInsideFromBelow = wasBelow and src >= lowerBand
// === RSI EMA Slope Filter
rsi = ta.rsi(close, rsiLen)
rsiEma = ta.ema(rsi, rsiEmaLen)
rsiSlope = rsiEma - rsiEma[1]
slopeUp = rsiSlope > 0
slopeDown = rsiSlope < 0
// === Signal Memory (One per slope)
var bool buyFiredOnSlope = false
var bool sellFiredOnSlope = false
// Reset logic when slope flips
buyReset = ta.crossover(rsiSlope, 0)
sellReset = ta.crossunder(rsiSlope, 0)
if buyReset
buyFiredOnSlope := false
if sellReset
sellFiredOnSlope := false
// Final entry conditions
finalBuy = backInsideFromBelow and slopeUp and not buyFiredOnSlope and enableSignals
finalSell = backInsideFromAbove and slopeDown and not sellFiredOnSlope and enableSignals
if finalBuy
buyFiredOnSlope := true
if finalSell
sellFiredOnSlope := true
// === Bar Coloring Modes
// Reversal Memory (for "Reversal Solid" and "Reversal Fade")
var string lastSignal = ""
if finalBuy
lastSignal := "bull"
if finalSell
lastSignal := "bear"
// Reversal Fade Tracker
var int signalAge = 0
if finalBuy or finalSell
signalAge := 0
else
signalAge += 1
// info
var string lastTrend = ""
if close > upperBand
lastTrend := "bull"
else if close < lowerBand
lastTrend := "bear"
// === Bar Coloring Logic
var color barCol = na
// 1. Reversal Solid
if colorMode == "Reversal Solid"
barCol := lastSignal == "bull" ? color.new(bullMain, 0) : lastSignal == "bear" ? color.new(bearMain, 0) : na
if colorMode == "None"
barCol := na
// 2. Reversal Fade
if colorMode == "Reversal Fade"
fade = math.min(90, signalAge * 1)
barCol := lastSignal == "bull" ? color.new(bullMain, fade) : lastSignal == "bear" ? color.new(bearMain, fade) : na
// 4. Exceeding Bands Only (only when outside bands)
if colorMode == "Exceeding Bands"
barCol := close > upperBand ? color.new(bullMain, 0) : close < lowerBand ? color.new(bearMain, 0) : na
// 5. Classic Heat — correct: strongest color near bands, fade near fair
// 5. Classic Heat — fixed: most intense near boundaries, fades toward fair
// 6. Gradient Flow — RGB blend from bull to bear based on band distance
if colorMode == "Classic Heat"
bandRange = upperBand - lowerBand
ratioRaw = (close - lowerBand) / bandRange
ratioClamped = math.max(0.0, math.min(ratioRaw, 1.0))
barCol := f_colorGradient(ratioClamped, bullMain, bearMain)
barcolor(barCol)
// === Table Position Setting
enableTable = input.bool(true,'Enable Table')
tablePos = input.string("Top Right", "Table Position", options=["Top Left", "Top Right", "Bottom Left", "Bottom Right"])
pos = tablePos == "Top Left" ? position.top_left :
tablePos == "Top Right" ? position.top_right :
tablePos == "Bottom Left" ? position.bottom_left :
position.bottom_right
// === Scoring Logic
score_z = zScore < -zThreshold ? +1 : zScore > zThreshold ? -1 : 0
score_slope = rsiSlope > 0 ? +1 : rsiSlope < 0 ? -1 : 0
score_price = close > fair ? +1 : close < fair ? -1 : 0
score_trend = lastTrend == "bull" ? +1 : lastTrend == "bear" ? -1 : 0
score_reentry = finalBuy ? +1 : finalSell ? -1 : 0
// === Score Aggregation
totalScore = score_z + score_slope + score_price + score_trend + score_reentry
scoreCount = 5
avgScore = totalScore / scoreCount
finalSignal = avgScore > 0.1 ? "AL" : avgScore < -0.1 ? "SAT" : "Nötr"
finalColor = avgScore > 0.1 ? bullMain : avgScore < -0.1 ? bearMain : color.gray
// === Shared Style
bgcolor = color.new(#000000, 0)
textCol = color.white
// === Table Drawing
if bar_index % 2 == 0 and enableTable
var table scoreTable = table.new(pos, 2, 7,frame_width = 1, border_width=1, frame_color=color.white, border_color=color.white)
table.cell(scoreTable, 0, 0, "Ýnd", bgcolor=bgcolor, text_color=textCol)
table.cell(scoreTable, 1, 0, "Puan", bgcolor=bgcolor, text_color=textCol)
table.cell(scoreTable, 0, 1, "Z-Score", bgcolor=bgcolor, text_color=textCol)
table.cell(scoreTable, 1, 1, str.tostring(score_z), bgcolor=bgcolor, text_color=textCol)
table.cell(scoreTable, 0, 2, "RSI", bgcolor=bgcolor, text_color=textCol)
table.cell(scoreTable, 1, 2, str.tostring(score_slope), bgcolor=bgcolor, text_color=textCol)
table.cell(scoreTable, 0, 3, "Fiyat", bgcolor=bgcolor, text_color=textCol)
table.cell(scoreTable, 1, 3, str.tostring(score_price), bgcolor=bgcolor, text_color=textCol)
table.cell(scoreTable, 0, 4, "Trend ", bgcolor=bgcolor, text_color=textCol)
table.cell(scoreTable, 1, 4, str.tostring(score_trend), bgcolor=bgcolor, text_color=textCol)
table.cell(scoreTable, 0, 5, "R Giriþ", bgcolor=bgcolor, text_color=textCol)
table.cell(scoreTable, 1, 5, str.tostring(score_reentry),bgcolor=bgcolor, text_color=textCol)
table.cell(scoreTable, 0, 6, "Sonuç", bgcolor=bgcolor, text_color=textCol)
table.cell(scoreTable, 1, 6, finalSignal, bgcolor=bgcolor, text_color=finalColor)
table.cell_set_text_font_family(scoreTable,0,0,font.family_monospace)
table.cell_set_text_font_family(scoreTable,1,0,font.family_monospace)
table.cell_set_text_font_family(scoreTable,0,1,font.family_monospace)
table.cell_set_text_font_family(scoreTable,1,1,font.family_monospace)
table.cell_set_text_font_family(scoreTable,0,2,font.family_monospace)
table.cell_set_text_font_family(scoreTable,1,2,font.family_monospace)
table.cell_set_text_font_family(scoreTable,0,3,font.family_monospace)
table.cell_set_text_font_family(scoreTable,1,3,font.family_monospace)
table.cell_set_text_font_family(scoreTable,0,4,font.family_monospace)
table.cell_set_text_font_family(scoreTable,1,4,font.family_monospace)
table.cell_set_text_font_family(scoreTable,0,5,font.family_monospace)
table.cell_set_text_font_family(scoreTable,1,5,font.family_monospace)
table.cell_set_text_font_family(scoreTable,0,6,font.family_monospace)
table.cell_set_text_font_family(scoreTable,1,6,font.family_monospace)
/////////////////
src88 = input.source(close,"RSI Source",group = "Connors RSI")
lenrsi = input(24, "RSI Length",group = "Connors RSI")
lenupdown = input(20, "UpDown Length",group = "Connors RSI")
lenroc = input(75, "ROC Length",group = "Connors RSI")
z_score_length = input(14, "Z-Score Lookback",group = "Filtering")
threshold = input.float(1.5, "Z-Score Threshold", step=0.025,group = "Filtering")
trendingLongThreshold = input.float(65, "Trending Long Threshold" ,group = "Filtering")
trendingShortThreshold = input.float(35, "Trending Short Threshold",group = "Filtering")
revertingLongThreshold = input.float(70, title="Reverting Long Threshold",group = "Filtering")
revertingShortThreshold = input.float(30, title="Reverting Short Threshold",group = "Filtering")
// ─── CONNORS RSI ──────────────────────────────────────────────────────────
updown(s) =>
isEqual = s == s[1]
isGrowing = s > s[1]
ud = 0.0
ud := isEqual ? 0 : isGrowing ? (nz(ud[1]) <= 0 ? 1 : nz(ud[1])+1) : (nz(ud[1]) >= 0 ? -1 : nz(ud[1])-1)
ud
rsi88 = ta.rsi(src88, lenrsi)
updownrsi = ta.rsi(updown(src88), lenupdown)
percentrank = ta.percentrank(ta.roc(src88, 1), lenroc)
crsi = math.avg(rsi, updownrsi, percentrank)
// ─── Z-SCORING ──────────────────────────────────────────────────────────
mean = ta.sma(crsi, z_score_length)
stdDev = ta.stdev(crsi, z_score_length)
zScore88 = (crsi - mean) / stdDev
isTrending = math.abs(zScore88) > threshold
// ─── Signal Generation ────────────────────────────────────────────────
var int signal = 0
if barstate.isconfirmed
if isTrending
signal := crsi > trendingLongThreshold ? 1 : crsi < trendingShortThreshold ? -1 : signal[1]
else
signal := crsi > revertingLongThreshold ? 1 : crsi < revertingShortThreshold ? -1 : signal[1]
trendColor = signal == 1 ? #17dfad : signal == -1 ? #dd326b : color.gray
//decor = plot(crsi,"Decor",style = plot.style_columns,histbase = 50,color=trendColor,linewidth = 2)
bgcolor(color.new(trendColor,90))
//plotcandle(open,high,low,close,"Candles",color=trendColor,wickcolor = trendColor,bordercolor = trendColor,force_overlay = true)
/////////////
src77 = close
rsiLen77 = input.int(1, 'RSI Length', group = "T3")
minLen = input.int(3, 'Min T3 Length', group = "T3")
maxLen = input.int(5, 'Max T3 Length', group = "T3")
v = input.float(0.34, 'T3 Volume Factor', step = 0.01, maxval = 2, minval = 0.1, group = "T3")
color_up = input.color(#21b8f3)
color_dn = input.color(#fd761b)
grp_vol_b = 'Volatility Bands'
show_bands = input.bool(true, 'Display', group = grp_vol_b, inline = "vol")
vol_col = input.color(#21c9f380, "", group = grp_vol_b, inline = "vol")
volat = input.int(100, 'Volatility', group = grp_vol_b)
// Step 1: Adaptive length via RSI
rsi77 = ta.rsi(src77, rsiLen77)
rsi_scale = 1 - rsi77 / 100
len = math.round(minLen + (maxLen - minLen) * rsi_scale)
pine_ema(src, length) =>
alpha = 2 / (length + 1)
sum = 0.0
sum := na(sum[1]) ? src : alpha * src + (1 - alpha) * nz(sum[1])
sum
// Step 2: T3 with adaptive length
e1 = pine_ema(src, len)
e2 = pine_ema(e1, len)
e3 = pine_ema(e2, len)
e4 = pine_ema(e3, len)
e5 = pine_ema(e4, len)
e6 = pine_ema(e5, len)
c1 = -v * v * v
c2 = 3 * v * v + 3 * v * v * v
c3 = -6 * v * v - 3 * v - 3 * v * v * v
c4 = 1 + 3 * v + v * v * v + 3 * v * v
t3 = c1 * e6 + c2 * e5 + c3 * e4 + c4 * e3
t3_col = t3 > t3[2] ? color_up : color_dn
stdv = ta.stdev(t3, volat)
pt31 = plot(t3, color = t3_col, linewidth = 1, editable = false)
pt32 = plot(t3[2], color = t3_col, linewidth = 1, editable = false)
plotchar(ta.crossover(t3, t3[2]) or ta.crossunder(t3, t3[2]) ? t3 : na, "", "🞛", location.absolute, t3_col)
////////////
//@ Julien_Eche
//@version=6
length = input.int(20, title="SMEMA Length")
table_size = input.string("normal", title="Table Size", options=["small", "normal", "large"])
table_text_size = table_size
show_deviation_lines = input.bool(true, title="Show Deviation Levels")
show_tf_cells = input.bool(true, title="Show All Timeframes")
approach = input.string("Swing Trading", title="Overall Trend Weighting", options=["Long Term", "Swing Trading", "Short Term"])
color_bull = input.color(#ecf405, title="Bull Color", inline="col")
color_bear = input.color(color.rgb(5, 29, 247), title="Bear Color", inline="col")
color_neutral = input.color(color.rgb(205, 2, 246), title="Neutral Color", inline="col")
get_trend_arrow(score) => score >= 0.5 ? "➚" : score <= -0.5 ? "➘" : "➡"
get_trend_strength(score) => str.tostring(math.round(math.abs(score))) + "/10"
trend_col(score) => score > 0.5 ? color_bull : score < -0.5 ? color_bear : color_neutral
get_dynamic_color(score, alpha) => color.new(trend_col(score), alpha)
get_band_color(level, src, score, is_upper, col_bull, col_bear) =>
r = math.abs(src - level) / ta.percentile_linear_interpolation(math.abs(src - level), 400, 100)
c = score > 0 and is_upper ? col_bull : score < 0 and not is_upper ? col_bear : na
result = na(c) ? na : r <= 0.03 ? color.new(c, 96) : r <= 0.06 ? color.new(c, 90) : r <= 0.10 ? color.new(c, 80) : r <= 0.15 ? color.new(c, 68) : r <= 0.20 ? color.new(c, 55) : r <= 0.27 ? color.new(c, 42) : r <= 0.35 ? color.new(c, 30) : color.new(c, 18)
result
get_score_internal() =>
sm = ta.sma(ta.ema(close, length), length)
sm_prev = ta.sma(ta.ema(close[1], length), length)
step = ta.atr(100)
slope = sm - sm_prev
slope_ratio = slope / sm
slope_ratio := slope_ratio > 0.1 ? 0.1 : slope_ratio < -0.1 ? -0.1 : slope_ratio
slope_weight = 1.0 + slope_ratio * 10.0
bull = (close > sm + step ? 1 : 0) + (close > sm + step * 2 ? 1 : 0) + (close > sm + step * 3 ? 1 : 0)
bear = (close < sm - step ? 1 : 0) + (close < sm - step * 2 ? 1 : 0) + (close < sm - step * 3 ? 1 : 0)
raw_score = (bull - bear) * 10.0 / 3.0
adjusted_score = raw_score * slope_weight
adjusted_score := adjusted_score > 10.0 ? 10.0 : adjusted_score < -10.0 ? -10.0 : adjusted_score
adjusted_score
sm = ta.sma(ta.ema(close, length), length)
sm_prev = ta.sma(ta.ema(close[1], length), length)
step = ta.atr(100)
sm_bull = (close > sm + step ? 1 : 0) + (close > sm + step * 2 ? 1 : 0) + (close > sm + step * 3 ? 1 : 0)
sm_bear = (close < sm - step ? 1 : 0) + (close < sm - step * 2 ? 1 : 0) + (close < sm - step * 3 ? 1 : 0)
sm_score = (sm_bull - sm_bear) * 10.0 / 3.0
slope = sm - sm_prev
slope_ratio = slope / step
slope_ratio := slope_ratio > 2.0 ? 2.0 : slope_ratio < -2.0 ? -2.0 : slope_ratio
slope_weight = 1.0 + slope_ratio * 0.25
adjusted_sm_score = sm_score * slope_weight
adjusted_sm_score := adjusted_sm_score > 10.0 ? 10.0 : adjusted_sm_score < -10.0 ? -10.0 : adjusted_sm_score
//plot(show_deviation_lines ? sm + step * 3 : na, color=get_band_color(sm + step * 3, close, adjusted_sm_score, true, color_bull, color_bear))
//plot(show_deviation_lines ? sm + step * 2 : na, color=get_band_color(sm + step * 2, close, adjusted_sm_score, true, color_bull, color_bear))
plot(show_deviation_lines ? sm + step : na, color=get_band_color(sm + step , close, adjusted_sm_score, true, color_bull, color_bear))
//plot(sm, color=get_dynamic_color(adjusted_sm_score, 0), title="SMEMA", linewidth=2)
plot(show_deviation_lines ? sm - step : na, color=get_band_color(sm - step , close, adjusted_sm_score, false, color_bull, color_bear))
//plot(show_deviation_lines ? sm - step * 2 : na, color=get_band_color(sm - step * 2, close, adjusted_sm_score, false, color_bull, color_bear))
//plot(show_deviation_lines ? sm - step * 3 : na, color=get_band_color(sm - step * 3, close, adjusted_sm_score, false, color_bull, color_bear))
/////////////////
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Darkoexe
//@version=6
ATRwithTrendFactor = input(4.5, 'ATR with trend factor')
ATRagainstTrendFactor = input(1.5, 'ATR against trend factor')
ATRperiod = input(14, 'ATR period')
color ColorStartUpTrend = input.color(color.green, 'Start Up Trend Color')
color ColorStartDownTrend = input.color(color.red, 'Start Down Trend Color')
color ColorEndTrend = input.color(color.purple, 'End Trend Color')
color ColorBoth = input.color(color.gray, 'Color when start and end trend are the same')
var bool endTrend = false
var float fullTrendChecker = 0.0
var float counterTrendChecker = close - close[1] > 0.0 ? 0.1 : -0.1
var bool UpTrend = false
var bool DownTrend = false
var StartTrendBarTime = time
var EndTrendBarTime = time
var float previous_EndTrendBarTime = time
var float EndTrendClose = close
var bool reversal = false
if bar_index > 1
fullTrendChecker := fullTrendChecker + close - close[1]
fullTrendChecker
if UpTrend and reversal
counterTrendChecker := counterTrendChecker + close - close[1]
counterTrendChecker
else if UpTrend and close - close[1] < 0.0 and counterTrendChecker == 0.1
counterTrendChecker := close - close[1]
EndTrendBarTime := time[1]
reversal := true
EndTrendClose := close[1]
endTrend := true
endTrend
if DownTrend and reversal
counterTrendChecker := counterTrendChecker + close - close[1]
counterTrendChecker
else if DownTrend and close - close[1] > 0.0 and counterTrendChecker == -0.1
counterTrendChecker := close - close[1]
EndTrendBarTime := time[1]
reversal := true
EndTrendClose := close[1]
endTrend := true
endTrend
var float endTrendATR = 0
endTrendATR := endTrend ? ta.atr(ATRperiod)[1] : endTrendATR
endTrend := false
var float startTrendATR = 0
var upWick = 0.0
var downWick = 0.0
if bar_index > 1
if close - close[1] > 0.0
upWick := high - close
upWick
else
upWick := high - close
upWick
if close - close[1] < 0.0
downWick := low - close
downWick
else
downWick := low - close
downWick
findIndex(TIME) =>
int i = 0
while true
if time[i] == TIME
findIndex = i
break
i := i + 1
i
if counterTrendChecker + upWick >= ATRagainstTrendFactor * endTrendATR and DownTrend //Checks if the trend has ended
fullTrendChecker := fullTrendChecker + EndTrendClose - close
if fullTrendChecker <= -ATRwithTrendFactor * startTrendATR //Checks if the trend was atleast the size of "ATRwithTrendFactor" multiplied by the ATR at the start of the trend
if StartTrendBarTime == previous_EndTrendBarTime
label.new(point = chart.point.from_time(StartTrendBarTime, close[findIndex(StartTrendBarTime)]), style = label.style_label_down, xloc = xloc.bar_time, size = size.small, text = 'Trend Kontrol', color = ColorBoth)
label.new(point = chart.point.from_time(EndTrendBarTime, close[findIndex(EndTrendBarTime)]), style = label.style_label_up, xloc = xloc.bar_time, size = size.small, text = 'Trend Devam', color = ColorEndTrend)
// line.new(x1=StartTrendBarTime, y1=1, x2=StartTrendBarTime, y2=2, extend=extend.both, color=ColorBoth, width=4, xloc=xloc.bar_time)
// line.new(x1=EndTrendBarTime, y1=1, x2=EndTrendBarTime, y2=2, extend=extend.both, color=ColorEndTrend, width=2, xloc=xloc.bar_time)
else
label.new(point = chart.point.from_time(StartTrendBarTime, close[findIndex(StartTrendBarTime)]), style = label.style_label_down, xloc = xloc.bar_time, size = size.small, text = 'Düþüþ Baþladý', color = ColorStartDownTrend)
label.new(point = chart.point.from_time(EndTrendBarTime, close[findIndex(EndTrendBarTime)]), style = label.style_label_up, xloc = xloc.bar_time, size = size.small, text = 'Düþüþ Bitti', color = ColorEndTrend)
// line.new(x1=StartTrendBarTime, y1=1, x2=StartTrendBarTime, y2=2, extend=extend.both, color=lineColorStartTrend, width=2, xloc=xloc.bar_time)
// line.new(x1=EndTrendBarTime, y1=1, x2=EndTrendBarTime, y2=2, extend=extend.both, color=ColorEndTrend, width=2, xloc=xloc.bar_time)
previous_EndTrendBarTime := EndTrendBarTime
previous_EndTrendBarTime
//ATR := ta.atr(ATRperiod)
if counterTrendChecker < 0.0
StartTrendBarTime := time[1]
startTrendATR := ta.atr(ATRperiod)[1]
fullTrendChecker := close - open
counterTrendChecker := -0.1
reversal := false
reversal
else
StartTrendBarTime := EndTrendBarTime
startTrendATR := endTrendATR
fullTrendChecker := counterTrendChecker
counterTrendChecker := 0.1
UpTrend := true
DownTrend := false
reversal := false
reversal
else if counterTrendChecker + downWick <= -(ATRagainstTrendFactor * endTrendATR) and UpTrend //Checks if the trend has ended
fullTrendChecker := fullTrendChecker + EndTrendClose - close
if fullTrendChecker >= ATRwithTrendFactor * startTrendATR //Checks if the trend was atleast the size of "ATRwithTrendFactor" multiplied by the ATR at the start of the trend
if StartTrendBarTime == previous_EndTrendBarTime
label.new(point = chart.point.from_time(StartTrendBarTime, close[findIndex(StartTrendBarTime)]), style = label.style_label_up, xloc = xloc.bar_time, size = size.small, text = 'Trend Kontrol', color = ColorBoth)
label.new(point = chart.point.from_time(EndTrendBarTime, close[findIndex(EndTrendBarTime)]), style = label.style_label_down, xloc = xloc.bar_time, size = size.small, text = 'Trend Devam', color = ColorEndTrend)
// line.new(x1=StartTrendBarTime, y1=1, x2=StartTrendBarTime, y2=2, extend=extend.both, color=ColorBoth, width=4, xloc=xloc.bar_time)
// line.new(x1=EndTrendBarTime, y1=1, x2=EndTrendBarTime, y2=2, extend=extend.both, color=ColorEndTrend, width=2, xloc=xloc.bar_time)
else
label.new(point = chart.point.from_time(StartTrendBarTime, close[findIndex(StartTrendBarTime)]), style = label.style_label_up, xloc = xloc.bar_time, size = size.small, text = 'Yükseliþ Baþladý', color = ColorStartUpTrend)
label.new(point = chart.point.from_time(EndTrendBarTime, close[findIndex(EndTrendBarTime)]), style = label.style_label_down, xloc = xloc.bar_time, size = size.small, text = 'Yükseliþ Bitti', color = ColorEndTrend)
// line.new(x1=StartTrendBarTime, y1=1, x2=StartTrendBarTime, y2=2, extend=extend.both, color=lineColorStartTrend, width=2, xloc=xloc.bar_time)
// line.new(x1=EndTrendBarTime, y1=1, x2=EndTrendBarTime, y2=2, extend=extend.both, color=ColorEndTrend, width=2, xloc=xloc.bar_time)
previous_EndTrendBarTime := EndTrendBarTime
previous_EndTrendBarTime
//ATR := ta.atr(ATRperiod)
if counterTrendChecker > 0.0
StartTrendBarTime := time[1]
startTrendATR := ta.atr(ATRperiod)[1]
fullTrendChecker := close - open
counterTrendChecker := 0.1
reversal := false
reversal
else
StartTrendBarTime := EndTrendBarTime
startTrendATR := endTrendATR
fullTrendChecker := counterTrendChecker
counterTrendChecker := -0.1
DownTrend := true
UpTrend := false
reversal := false
reversal
if reversal and UpTrend and close - close[1] > 0.0 and counterTrendChecker > 0.0
reversal := false
counterTrendChecker := 0.1
counterTrendChecker
else if reversal and DownTrend and close - close[1] < 0.0 and counterTrendChecker < 0.0
reversal := false
counterTrendChecker := -0.1
counterTrendChecker
if fullTrendChecker > 0.0
UpTrend := true
DownTrend := false
DownTrend
else if fullTrendChecker < 0.0
UpTrend := false
DownTrend := true
DownTrend
/////////////////
-
https://i.hizliresim.com/5thlpwm.jpg
bu grafikte ne görülür... burayý okuyanlar....
bunun kombine edilmiþ kod olduðunu,
arka zemine hesaplama yapýldýðýný,
içindeki stratejilerin tablo ve label kullanýlarak görselleþtiðini,
ve hesaplamalarýn teyit için deðerler deðiþtirildiðini görür.....
PHP Code:
//@version=6
indicator(title = 'Master Trend BUY&SELL', shorttitle = '.', overlay = true, max_lines_count = 500, max_labels_count=500)
////
// === Inputs ===
fairLen = input.int(50, "Fair Value EMA Length")
zLen = input.int(100, "Z-Score Lookback Length")
zThreshold = input.float(3.0, "Z-Score Threshold")
src = input.source(close, "Source")
rsiLen = input.int(14, "RSI Length")
rsiEmaLen = input.int(7, "EMA of RSI Slope")
colorMode = input.string("None", "Bar Coloring Mode", options=[
"None",
"Reversal Solid",
"Reversal Fade",
"Exceeding Bands",
"Classic Heat"
])
enableSignals = input.bool(false,'Show Signals')
// === Smooth RGB Gradient Function
f_colorGradient(_ratio, _colA, _colB) =>
rA = color.r(_colA)
gA = color.g(_colA)
bA = color.b(_colA)
rB = color.r(_colB)
gB = color.g(_colB)
bB = color.b(_colB)
rr = rA + int((rB - rA) * _ratio)
rg = gA + int((gB - gA) * _ratio)
rb = bA + int((bB - bA) * _ratio)
color.rgb(rr, rg, rb, 0)
// === Color Scheme ===
bullMain = color.new(#5CF0D7, 0)
bearMain = color.new(#B32AC3, 0)
labelTextCol = color.white
borderCol = color.white
// === Fair Value (EMA Only) ===
fair = ta.ema(src, fairLen)
// === Z-Score Deviation
dev = src - fair
devMean = ta.sma(dev, zLen)
devStdev = ta.stdev(dev, zLen)
zScore = devStdev != 0 ? (dev - devMean) / devStdev : 0
// === Z-Bands
upperBand = fair + zThreshold * devStdev
lowerBand = fair - zThreshold * devStdev
// === Re-entry Logic
wasAbove = src[1] > upperBand[1]
wasBelow = src[1] < lowerBand[1]
backInsideFromAbove = wasAbove and src <= upperBand
backInsideFromBelow = wasBelow and src >= lowerBand
// === RSI EMA Slope Filter
rsi = ta.rsi(close, rsiLen)
rsiEma = ta.ema(rsi, rsiEmaLen)
rsiSlope = rsiEma - rsiEma[1]
slopeUp = rsiSlope > 0
slopeDown = rsiSlope < 0
// === Signal Memory (One per slope)
var bool buyFiredOnSlope = false
var bool sellFiredOnSlope = false
// Reset logic when slope flips
buyReset = ta.crossover(rsiSlope, 0)
sellReset = ta.crossunder(rsiSlope, 0)
if buyReset
buyFiredOnSlope := false
if sellReset
sellFiredOnSlope := false
// Final entry conditions
finalBuy = backInsideFromBelow and slopeUp and not buyFiredOnSlope and enableSignals
finalSell = backInsideFromAbove and slopeDown and not sellFiredOnSlope and enableSignals
if finalBuy
buyFiredOnSlope := true
if finalSell
sellFiredOnSlope := true
// === Bar Coloring Modes
// Reversal Memory (for "Reversal Solid" and "Reversal Fade")
var string lastSignal = ""
if finalBuy
lastSignal := "bull"
if finalSell
lastSignal := "bear"
// Reversal Fade Tracker
var int signalAge = 0
if finalBuy or finalSell
signalAge := 0
else
signalAge += 1
// info
var string lastTrend = ""
if close > upperBand
lastTrend := "bull"
else if close < lowerBand
lastTrend := "bear"
// === Bar Coloring Logic
var color barCol = na
// 1. Reversal Solid
if colorMode == "Reversal Solid"
barCol := lastSignal == "bull" ? color.new(bullMain, 0) : lastSignal == "bear" ? color.new(bearMain, 0) : na
if colorMode == "None"
barCol := na
// 2. Reversal Fade
if colorMode == "Reversal Fade"
fade = math.min(90, signalAge * 1)
barCol := lastSignal == "bull" ? color.new(bullMain, fade) : lastSignal == "bear" ? color.new(bearMain, fade) : na
// 4. Exceeding Bands Only (only when outside bands)
if colorMode == "Exceeding Bands"
barCol := close > upperBand ? color.new(bullMain, 0) : close < lowerBand ? color.new(bearMain, 0) : na
// 5. Classic Heat — correct: strongest color near bands, fade near fair
// 5. Classic Heat — fixed: most intense near boundaries, fades toward fair
// 6. Gradient Flow — RGB blend from bull to bear based on band distance
if colorMode == "Classic Heat"
bandRange = upperBand - lowerBand
ratioRaw = (close - lowerBand) / bandRange
ratioClamped = math.max(0.0, math.min(ratioRaw, 1.0))
barCol := f_colorGradient(ratioClamped, bullMain, bearMain)
barcolor(barCol)
// === Table Position Setting
enableTable = input.bool(true,'Enable Table')
tablePos = input.string("Top Right", "Table Position", options=["Top Left", "Top Right", "Bottom Left", "Bottom Right"])
pos = tablePos == "Top Left" ? position.top_left :
tablePos == "Top Right" ? position.top_right :
tablePos == "Bottom Left" ? position.bottom_left :
position.bottom_right
// === Scoring Logic
score_z = zScore < -zThreshold ? +1 : zScore > zThreshold ? -1 : 0
score_slope = rsiSlope > 0 ? +1 : rsiSlope < 0 ? -1 : 0
score_price = close > fair ? +1 : close < fair ? -1 : 0
score_trend = lastTrend == "bull" ? +1 : lastTrend == "bear" ? -1 : 0
score_reentry = finalBuy ? +1 : finalSell ? -1 : 0
// === Score Aggregation
totalScore = score_z + score_slope + score_price + score_trend + score_reentry
scoreCount = 5
avgScore = totalScore / scoreCount
finalSignal = avgScore > 0.1 ? "AL" : avgScore < -0.1 ? "SAT" : "Nötr"
finalColor = avgScore > 0.1 ? bullMain : avgScore < -0.1 ? bearMain : color.gray
// === Shared Style
bgcolor = color.new(#000000, 0)
textCol = color.white
// === Table Drawing
if bar_index % 2 == 0 and enableTable
var table scoreTable = table.new(pos, 2, 7,frame_width = 1, border_width=1, frame_color=color.white, border_color=color.white)
table.cell(scoreTable, 0, 0, "Ýnd", bgcolor=bgcolor, text_color=textCol)
table.cell(scoreTable, 1, 0, "Puan", bgcolor=bgcolor, text_color=textCol)
table.cell(scoreTable, 0, 1, "Z-Score", bgcolor=bgcolor, text_color=textCol)
table.cell(scoreTable, 1, 1, str.tostring(score_z), bgcolor=bgcolor, text_color=textCol)
table.cell(scoreTable, 0, 2, "RSI", bgcolor=bgcolor, text_color=textCol)
table.cell(scoreTable, 1, 2, str.tostring(score_slope), bgcolor=bgcolor, text_color=textCol)
table.cell(scoreTable, 0, 3, "Fiyat", bgcolor=bgcolor, text_color=textCol)
table.cell(scoreTable, 1, 3, str.tostring(score_price), bgcolor=bgcolor, text_color=textCol)
table.cell(scoreTable, 0, 4, "Trend ", bgcolor=bgcolor, text_color=textCol)
table.cell(scoreTable, 1, 4, str.tostring(score_trend), bgcolor=bgcolor, text_color=textCol)
table.cell(scoreTable, 0, 5, "R Giriþ", bgcolor=bgcolor, text_color=textCol)
table.cell(scoreTable, 1, 5, str.tostring(score_reentry),bgcolor=bgcolor, text_color=textCol)
table.cell(scoreTable, 0, 6, "Sonuç", bgcolor=bgcolor, text_color=textCol)
table.cell(scoreTable, 1, 6, finalSignal, bgcolor=bgcolor, text_color=finalColor)
table.cell_set_text_font_family(scoreTable,0,0,font.family_monospace)
table.cell_set_text_font_family(scoreTable,1,0,font.family_monospace)
table.cell_set_text_font_family(scoreTable,0,1,font.family_monospace)
table.cell_set_text_font_family(scoreTable,1,1,font.family_monospace)
table.cell_set_text_font_family(scoreTable,0,2,font.family_monospace)
table.cell_set_text_font_family(scoreTable,1,2,font.family_monospace)
table.cell_set_text_font_family(scoreTable,0,3,font.family_monospace)
table.cell_set_text_font_family(scoreTable,1,3,font.family_monospace)
table.cell_set_text_font_family(scoreTable,0,4,font.family_monospace)
table.cell_set_text_font_family(scoreTable,1,4,font.family_monospace)
table.cell_set_text_font_family(scoreTable,0,5,font.family_monospace)
table.cell_set_text_font_family(scoreTable,1,5,font.family_monospace)
table.cell_set_text_font_family(scoreTable,0,6,font.family_monospace)
table.cell_set_text_font_family(scoreTable,1,6,font.family_monospace)
/////////////////
src88 = input.source(close,"RSI Source",group = "Connors RSI")
lenrsi = input(24, "RSI Length",group = "Connors RSI")
lenupdown = input(20, "UpDown Length",group = "Connors RSI")
lenroc = input(75, "ROC Length",group = "Connors RSI")
z_score_length = input(14, "Z-Score Lookback",group = "Filtering")
threshold = input.float(1.5, "Z-Score Threshold", step=0.025,group = "Filtering")
trendingLongThreshold = input.float(65, "Trending Long Threshold" ,group = "Filtering")
trendingShortThreshold = input.float(35, "Trending Short Threshold",group = "Filtering")
revertingLongThreshold = input.float(70, title="Reverting Long Threshold",group = "Filtering")
revertingShortThreshold = input.float(30, title="Reverting Short Threshold",group = "Filtering")
// ─── CONNORS RSI ──────────────────────────────────────────────────────────
updown(s) =>
isEqual = s == s[1]
isGrowing = s > s[1]
ud = 0.0
ud := isEqual ? 0 : isGrowing ? (nz(ud[1]) <= 0 ? 1 : nz(ud[1])+1) : (nz(ud[1]) >= 0 ? -1 : nz(ud[1])-1)
ud
rsi88 = ta.rsi(src88, lenrsi)
updownrsi = ta.rsi(updown(src88), lenupdown)
percentrank = ta.percentrank(ta.roc(src88, 1), lenroc)
crsi = math.avg(rsi, updownrsi, percentrank)
// ─── Z-SCORING ──────────────────────────────────────────────────────────
mean = ta.sma(crsi, z_score_length)
stdDev = ta.stdev(crsi, z_score_length)
zScore88 = (crsi - mean) / stdDev
isTrending = math.abs(zScore88) > threshold
// ─── Signal Generation ────────────────────────────────────────────────
var int signal = 0
if barstate.isconfirmed
if isTrending
signal := crsi > trendingLongThreshold ? 1 : crsi < trendingShortThreshold ? -1 : signal[1]
else
signal := crsi > revertingLongThreshold ? 1 : crsi < revertingShortThreshold ? -1 : signal[1]
trendColor = signal == 1 ? #17dfad : signal == -1 ? #dd326b : color.gray
//decor = plot(crsi,"Decor",style = plot.style_columns,histbase = 50,color=trendColor,linewidth = 2)
bgcolor(color.new(trendColor,90))
//plotcandle(open,high,low,close,"Candles",color=trendColor,wickcolor = trendColor,bordercolor = trendColor,force_overlay = true)
/////////////
src77 = close
rsiLen77 = input.int(1, 'RSI Length', group = "T3")
minLen = input.int(3, 'Min T3 Length', group = "T3")
maxLen = input.int(5, 'Max T3 Length', group = "T3")
v = input.float(0.34, 'T3 Volume Factor', step = 0.01, maxval = 2, minval = 0.1, group = "T3")
color_up = input.color(#21b8f3)
color_dn = input.color(#fd761b)
grp_vol_b = 'Volatility Bands'
show_bands = input.bool(true, 'Display', group = grp_vol_b, inline = "vol")
vol_col = input.color(#21c9f380, "", group = grp_vol_b, inline = "vol")
volat = input.int(100, 'Volatility', group = grp_vol_b)
// Step 1: Adaptive length via RSI
rsi77 = ta.rsi(src77, rsiLen77)
rsi_scale = 1 - rsi77 / 100
len = math.round(minLen + (maxLen - minLen) * rsi_scale)
pine_ema(src, length) =>
alpha = 2 / (length + 1)
sum = 0.0
sum := na(sum[1]) ? src : alpha * src + (1 - alpha) * nz(sum[1])
sum
// Step 2: T3 with adaptive length
e1 = pine_ema(src, len)
e2 = pine_ema(e1, len)
e3 = pine_ema(e2, len)
e4 = pine_ema(e3, len)
e5 = pine_ema(e4, len)
e6 = pine_ema(e5, len)
c1 = -v * v * v
c2 = 3 * v * v + 3 * v * v * v
c3 = -6 * v * v - 3 * v - 3 * v * v * v
c4 = 1 + 3 * v + v * v * v + 3 * v * v
t3 = c1 * e6 + c2 * e5 + c3 * e4 + c4 * e3
t3_col = t3 > t3[2] ? color_up : color_dn
stdv = ta.stdev(t3, volat)
pt31 = plot(t3, color = t3_col, linewidth = 1, editable = false)
pt32 = plot(t3[2], color = t3_col, linewidth = 1, editable = false)
plotchar(ta.crossover(t3, t3[2]) or ta.crossunder(t3, t3[2]) ? t3 : na, "", "", location.absolute, t3_col)
////////////
//@ Julien_Eche
//@version=6
length = input.int(20, title="SMEMA Length")
table_size = input.string("normal", title="Table Size", options=["small", "normal", "large"])
table_text_size = table_size
show_deviation_lines = input.bool(true, title="Show Deviation Levels")
show_tf_cells = input.bool(true, title="Show All Timeframes")
approach = input.string("Swing Trading", title="Overall Trend Weighting", options=["Long Term", "Swing Trading", "Short Term"])
color_bull = input.color(#ecf405, title="Bull Color", inline="col")
color_bear = input.color(color.rgb(5, 29, 247), title="Bear Color", inline="col")
color_neutral = input.color(color.rgb(205, 2, 246), title="Neutral Color", inline="col")
get_trend_arrow(score) => score >= 0.5 ? "➚" : score <= -0.5 ? "➘" : "➡"
get_trend_strength(score) => str.tostring(math.round(math.abs(score))) + "/10"
trend_col(score) => score > 0.5 ? color_bull : score < -0.5 ? color_bear : color_neutral
get_dynamic_color(score, alpha) => color.new(trend_col(score), alpha)
get_band_color(level, src, score, is_upper, col_bull, col_bear) =>
r = math.abs(src - level) / ta.percentile_linear_interpolation(math.abs(src - level), 400, 100)
c = score > 0 and is_upper ? col_bull : score < 0 and not is_upper ? col_bear : na
result = na(c) ? na : r <= 0.03 ? color.new(c, 96) : r <= 0.06 ? color.new(c, 90) : r <= 0.10 ? color.new(c, 80) : r <= 0.15 ? color.new(c, 68) : r <= 0.20 ? color.new(c, 55) : r <= 0.27 ? color.new(c, 42) : r <= 0.35 ? color.new(c, 30) : color.new(c, 18)
result
get_score_internal() =>
sm = ta.sma(ta.ema(close, length), length)
sm_prev = ta.sma(ta.ema(close[1], length), length)
step = ta.atr(100)
slope = sm - sm_prev
slope_ratio = slope / sm
slope_ratio := slope_ratio > 0.1 ? 0.1 : slope_ratio < -0.1 ? -0.1 : slope_ratio
slope_weight = 1.0 + slope_ratio * 10.0
bull = (close > sm + step ? 1 : 0) + (close > sm + step * 2 ? 1 : 0) + (close > sm + step * 3 ? 1 : 0)
bear = (close < sm - step ? 1 : 0) + (close < sm - step * 2 ? 1 : 0) + (close < sm - step * 3 ? 1 : 0)
raw_score = (bull - bear) * 10.0 / 3.0
adjusted_score = raw_score * slope_weight
adjusted_score := adjusted_score > 10.0 ? 10.0 : adjusted_score < -10.0 ? -10.0 : adjusted_score
adjusted_score
sm = ta.sma(ta.ema(close, length), length)
sm_prev = ta.sma(ta.ema(close[1], length), length)
step = ta.atr(100)
sm_bull = (close > sm + step ? 1 : 0) + (close > sm + step * 2 ? 1 : 0) + (close > sm + step * 3 ? 1 : 0)
sm_bear = (close < sm - step ? 1 : 0) + (close < sm - step * 2 ? 1 : 0) + (close < sm - step * 3 ? 1 : 0)
sm_score = (sm_bull - sm_bear) * 10.0 / 3.0
slope = sm - sm_prev
slope_ratio = slope / step
slope_ratio := slope_ratio > 2.0 ? 2.0 : slope_ratio < -2.0 ? -2.0 : slope_ratio
slope_weight = 1.0 + slope_ratio * 0.25
adjusted_sm_score = sm_score * slope_weight
adjusted_sm_score := adjusted_sm_score > 10.0 ? 10.0 : adjusted_sm_score < -10.0 ? -10.0 : adjusted_sm_score
//plot(show_deviation_lines ? sm + step * 3 : na, color=get_band_color(sm + step * 3, close, adjusted_sm_score, true, color_bull, color_bear))
//plot(show_deviation_lines ? sm + step * 2 : na, color=get_band_color(sm + step * 2, close, adjusted_sm_score, true, color_bull, color_bear))
plot(show_deviation_lines ? sm + step : na, color=get_band_color(sm + step , close, adjusted_sm_score, true, color_bull, color_bear))
//plot(sm, color=get_dynamic_color(adjusted_sm_score, 0), title="SMEMA", linewidth=2)
plot(show_deviation_lines ? sm - step : na, color=get_band_color(sm - step , close, adjusted_sm_score, false, color_bull, color_bear))
//plot(show_deviation_lines ? sm - step * 2 : na, color=get_band_color(sm - step * 2, close, adjusted_sm_score, false, color_bull, color_bear))
//plot(show_deviation_lines ? sm - step * 3 : na, color=get_band_color(sm - step * 3, close, adjusted_sm_score, false, color_bull, color_bear))
/////////////////
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Darkoexe
//@version=6
ATRwithTrendFactor = input(4.5, 'ATR with trend factor')
ATRagainstTrendFactor = input(1.5, 'ATR against trend factor')
ATRperiod = input(14, 'ATR period')
color ColorStartUpTrend = input.color(color.green, 'Start Up Trend Color')
color ColorStartDownTrend = input.color(color.red, 'Start Down Trend Color')
color ColorEndTrend = input.color(color.purple, 'End Trend Color')
color ColorBoth = input.color(color.gray, 'Color when start and end trend are the same')
var bool endTrend = false
var float fullTrendChecker = 0.0
var float counterTrendChecker = close - close[1] > 0.0 ? 0.1 : -0.1
var bool UpTrend = false
var bool DownTrend = false
var StartTrendBarTime = time
var EndTrendBarTime = time
var float previous_EndTrendBarTime = time
var float EndTrendClose = close
var bool reversal = false
if bar_index > 1
fullTrendChecker := fullTrendChecker + close - close[1]
fullTrendChecker
if UpTrend and reversal
counterTrendChecker := counterTrendChecker + close - close[1]
counterTrendChecker
else if UpTrend and close - close[1] < 0.0 and counterTrendChecker == 0.1
counterTrendChecker := close - close[1]
EndTrendBarTime := time[1]
reversal := true
EndTrendClose := close[1]
endTrend := true
endTrend
if DownTrend and reversal
counterTrendChecker := counterTrendChecker + close - close[1]
counterTrendChecker
else if DownTrend and close - close[1] > 0.0 and counterTrendChecker == -0.1
counterTrendChecker := close - close[1]
EndTrendBarTime := time[1]
reversal := true
EndTrendClose := close[1]
endTrend := true
endTrend
var float endTrendATR = 0
endTrendATR := endTrend ? ta.atr(ATRperiod)[1] : endTrendATR
endTrend := false
var float startTrendATR = 0
var upWick = 0.0
var downWick = 0.0
if bar_index > 1
if close - close[1] > 0.0
upWick := high - close
upWick
else
upWick := high - close
upWick
if close - close[1] < 0.0
downWick := low - close
downWick
else
downWick := low - close
downWick
findIndex(TIME) =>
int i = 0
while true
if time[i] == TIME
findIndex = i
break
i := i + 1
i
if counterTrendChecker + upWick >= ATRagainstTrendFactor * endTrendATR and DownTrend //Checks if the trend has ended
fullTrendChecker := fullTrendChecker + EndTrendClose - close
if fullTrendChecker <= -ATRwithTrendFactor * startTrendATR //Checks if the trend was atleast the size of "ATRwithTrendFactor" multiplied by the ATR at the start of the trend
if StartTrendBarTime == previous_EndTrendBarTime
label.new(point = chart.point.from_time(StartTrendBarTime, close[findIndex(StartTrendBarTime)]), style = label.style_label_down, xloc = xloc.bar_time, size = size.small, text = 'Trend Kontrol', color = ColorBoth)
label.new(point = chart.point.from_time(EndTrendBarTime, close[findIndex(EndTrendBarTime)]), style = label.style_label_up, xloc = xloc.bar_time, size = size.small, text = 'Trend Devam', color = ColorEndTrend)
// line.new(x1=StartTrendBarTime, y1=1, x2=StartTrendBarTime, y2=2, extend=extend.both, color=ColorBoth, width=4, xloc=xloc.bar_time)
// line.new(x1=EndTrendBarTime, y1=1, x2=EndTrendBarTime, y2=2, extend=extend.both, color=ColorEndTrend, width=2, xloc=xloc.bar_time)
else
label.new(point = chart.point.from_time(StartTrendBarTime, close[findIndex(StartTrendBarTime)]), style = label.style_label_down, xloc = xloc.bar_time, size = size.small, text = 'Düþüþ Baþladý', color = ColorStartDownTrend)
label.new(point = chart.point.from_time(EndTrendBarTime, close[findIndex(EndTrendBarTime)]), style = label.style_label_up, xloc = xloc.bar_time, size = size.small, text = 'Düþüþ Bitti', color = ColorEndTrend)
// line.new(x1=StartTrendBarTime, y1=1, x2=StartTrendBarTime, y2=2, extend=extend.both, color=lineColorStartTrend, width=2, xloc=xloc.bar_time)
// line.new(x1=EndTrendBarTime, y1=1, x2=EndTrendBarTime, y2=2, extend=extend.both, color=ColorEndTrend, width=2, xloc=xloc.bar_time)
previous_EndTrendBarTime := EndTrendBarTime
previous_EndTrendBarTime
//ATR := ta.atr(ATRperiod)
if counterTrendChecker < 0.0
StartTrendBarTime := time[1]
startTrendATR := ta.atr(ATRperiod)[1]
fullTrendChecker := close - open
counterTrendChecker := -0.1
reversal := false
reversal
else
StartTrendBarTime := EndTrendBarTime
startTrendATR := endTrendATR
fullTrendChecker := counterTrendChecker
counterTrendChecker := 0.1
UpTrend := true
DownTrend := false
reversal := false
reversal
else if counterTrendChecker + downWick <= -(ATRagainstTrendFactor * endTrendATR) and UpTrend //Checks if the trend has ended
fullTrendChecker := fullTrendChecker + EndTrendClose - close
if fullTrendChecker >= ATRwithTrendFactor * startTrendATR //Checks if the trend was atleast the size of "ATRwithTrendFactor" multiplied by the ATR at the start of the trend
if StartTrendBarTime == previous_EndTrendBarTime
label.new(point = chart.point.from_time(StartTrendBarTime, close[findIndex(StartTrendBarTime)]), style = label.style_label_up, xloc = xloc.bar_time, size = size.small, text = 'Trend Kontrol', color = ColorBoth)
label.new(point = chart.point.from_time(EndTrendBarTime, close[findIndex(EndTrendBarTime)]), style = label.style_label_down, xloc = xloc.bar_time, size = size.small, text = 'Trend Devam', color = ColorEndTrend)
// line.new(x1=StartTrendBarTime, y1=1, x2=StartTrendBarTime, y2=2, extend=extend.both, color=ColorBoth, width=4, xloc=xloc.bar_time)
// line.new(x1=EndTrendBarTime, y1=1, x2=EndTrendBarTime, y2=2, extend=extend.both, color=ColorEndTrend, width=2, xloc=xloc.bar_time)
else
label.new(point = chart.point.from_time(StartTrendBarTime, close[findIndex(StartTrendBarTime)]), style = label.style_label_up, xloc = xloc.bar_time, size = size.small, text = 'Yükseliþ Baþladý', color = ColorStartUpTrend)
label.new(point = chart.point.from_time(EndTrendBarTime, close[findIndex(EndTrendBarTime)]), style = label.style_label_down, xloc = xloc.bar_time, size = size.small, text = 'Yükseliþ Bitti', color = ColorEndTrend)
// line.new(x1=StartTrendBarTime, y1=1, x2=StartTrendBarTime, y2=2, extend=extend.both, color=lineColorStartTrend, width=2, xloc=xloc.bar_time)
// line.new(x1=EndTrendBarTime, y1=1, x2=EndTrendBarTime, y2=2, extend=extend.both, color=ColorEndTrend, width=2, xloc=xloc.bar_time)
previous_EndTrendBarTime := EndTrendBarTime
previous_EndTrendBarTime
//ATR := ta.atr(ATRperiod)
if counterTrendChecker > 0.0
StartTrendBarTime := time[1]
startTrendATR := ta.atr(ATRperiod)[1]
fullTrendChecker := close - open
counterTrendChecker := 0.1
reversal := false
reversal
else
StartTrendBarTime := EndTrendBarTime
startTrendATR := endTrendATR
fullTrendChecker := counterTrendChecker
counterTrendChecker := -0.1
DownTrend := true
UpTrend := false
reversal := false
reversal
if reversal and UpTrend and close - close[1] > 0.0 and counterTrendChecker > 0.0
reversal := false
counterTrendChecker := 0.1
counterTrendChecker
else if reversal and DownTrend and close - close[1] < 0.0 and counterTrendChecker < 0.0
reversal := false
counterTrendChecker := -0.1
counterTrendChecker
if fullTrendChecker > 0.0
UpTrend := true
DownTrend := false
DownTrend
else if fullTrendChecker < 0.0
UpTrend := false
DownTrend := true
DownTrend
/////////////////
görüntünün kodu bu.....
-