OPEN-SOURCE SCRIPT
Aggiornato

AmazingGPT

67
//version=6
indicator("AmazingGPT", shorttitle="AmazingGPT", overlay=true, max_lines_count=500, max_labels_count=500)
// ─────────────────────────── Inputs
group_ma = "SMMA"
group_avwap = "AVWAP"
group_fibo = "Fibo"
group_toler = "Yakınlık (2/3)"
group_trig = "Trigger & Onay"
group_misc = "Görsel/HUD"

// SMMA
len21 = input.int(21, "SMMA 21", group=group_ma, minval=1)
len50 = input.int(50, "SMMA 50", group=group_ma, minval=1)
len200 = input.int(200, "SMMA 200", group=group_ma, minval=1)

// AVWAP
const int anchorDefault = timestamp("2025-06-13T00:00:00")
anchorTime = input.time(anchorDefault, "AVWAP Anchor (tarih)", group=group_avwap)





bandMode = input.string("ATR", "Band mode", options=["ATR","VW-Stdev"], group=group_avwap)
band1K = input.float(1.0, "Band 1 (×Unit)", step=0.1, group=group_avwap)
band2K = input.float(0.0, "Band 2 (×Unit)", step=0.1, group=group_avwap)

// Fibo
useAutoFib = input.bool(false, "Auto Fib (son 252 bar HL)", group=group_fibo)
fibL_in = input.float(0.0, "Swing Low (fiyat)", group=group_fibo, step=0.01)
fibH_in = input.float(0.0, "Swing High (fiyat)", group=group_fibo, step=0.01)

// Yakınlık (2/3) – ayrı eşikler
tolMA = input.float(1.00, "Yakınlık eşiği – SMMA (×ATR)", minval=0.0, step=0.05, group=group_toler)
tolAV = input.float(0.80, "Yakınlık eşiği – AVWAP (×ATR)", minval=0.0, step=0.05, group=group_toler)
tolFibo = input.float(0.60, "Yakınlık eşiği – Fibo (×ATR)", minval=0.0, step=0.05, group=group_toler)
starterTolMA = input.float(1.00, "Starter SMMA eşiği (×ATR)", minval=0.0, step=0.05, group=group_toler)

// Trigger & Onay
useDailyLock = input.bool(true, "Lock core calcs to Daily (1D)", group=group_trig)
triggerSrc = input.string("Auto", "Trigger Source", options=["Auto","D-1 High","H3 High","CH3 Close"], group=group_trig)
useCH3auto = input.bool(true, "Auto: CH3 fallback ON", group=group_trig)
fallbackBars = input.int(3, "Fallback after N bars", minval=1, group=group_trig)
tamponTL = input.float(0.10, "Tampon (TL)", step=0.01, group=group_trig)
tamponATRf = input.float(0.15, "Tampon (×ATR)", step=0.01, group=group_trig)
capATR = input.float(0.60, "Cap (kovalama) ≤ ×ATR", step=0.05, group=group_trig)
vetoATR = input.float(1.00, "Veto (asla kovala) ≥ ×ATR", step=0.05, group=group_trig)
useRSIbreak = input.bool(false, "RSI≥50 (sadece kırılımda)", group=group_trig)
nearCloseStarter = input.bool(true, "Starter (reclaim gününde) ENABLE", group=group_trig)

// Görsel
showHud = input.bool(true, "HUD göster", group=group_misc)
showBands = input.bool(true, "AVWAP bantlarını göster", group=group_misc)

// ─────────────────────────── Daily sources (lock)
smma21D = request.security(syminfo.tickerid, "D", ta.rma(close, len21))
smma50D = request.security(syminfo.tickerid, "D", ta.rma(close, len50))
smma200D = request.security(syminfo.tickerid, "D", ta.rma(close, len200))
atrD = request.security(syminfo.tickerid, "D", ta.atr(14))
rsiD = request.security(syminfo.tickerid, "D", ta.rsi(close, 14))
v20D = request.security(syminfo.tickerid, "D", ta.sma(volume, 20))
dHighD = request.security(syminfo.tickerid, "D", high)
h3HighD = request.security(syminfo.tickerid, "D", ta.highest(high, 3))
ch3CloseD= request.security(syminfo.tickerid, "D", ta.highest(close, 3))

// ─────────────────────────── Core calcs (lock uygulanmış)
smma21 = useDailyLock ? smma21D : ta.rma(close, len21)
smma50 = useDailyLock ? smma50D : ta.rma(close, len50)
smma200 = useDailyLock ? smma200D : ta.rma(close, len200)
atr = useDailyLock ? atrD : ta.atr(14)
rsi = useDailyLock ? rsiD : ta.rsi(close, 14)
v20 = useDailyLock ? v20D : ta.sma(volume, 20)

// ─────────────────────────── AVWAP (anchor sonrası)
tp = hlc3
isAfter = time >= anchorTime
var float cumV = na
var float cumTPV = na
var float cumTP2V = na

if isAfter
cumV := nz(cumV[1]) + volume
cumTPV := nz(cumTPV[1]) + tp * volume
cumTP2V := nz(cumTP2V[1]) + (tp*tp) * volume
else
cumV := na
cumTPV := na
cumTP2V := na

avwap = isAfter ? (cumTPV / cumV) : na

// Band birimi: ATR veya VWAP-σ
vwVar = isAfter ? math.max(0.0, cumTP2V/cumV - avwap*avwap) : na
vwStd = isAfter ? math.sqrt(vwVar) : na
bandUnit = bandMode == "ATR" ? atr : nz(vwStd, 0)

upper1 = isAfter and showBands ? avwap + band1K*bandUnit : na
lower1 = isAfter and showBands ? avwap - band1K*bandUnit : na
upper2 = isAfter and showBands and band2K>0 ? avwap + band2K*bandUnit : na
lower2 = isAfter and showBands and band2K>0 ? avwap - band2K*bandUnit : na

// ─────────────────────────── Fibo (manuel/auto)
var float swingL = na
var float swingH = na
if useAutoFib
swingL := ta.lowest(low, 252)
swingH := ta.highest(high, 252)
else
swingL := fibL_in
swingH := fibH_in

float L = na(swingL) or na(swingH) ? na : math.min(swingL, swingH)
float H = na(swingL) or na(swingH) ? na : math.max(swingL, swingH)

fib382 = na(L) ? na : H - 0.382 * (H - L)
fib500 = na(L) ? na : H - 0.500 * (H - L)
fib618 = na(L) ? na : H - 0.618 * (H - L)

// ─────────────────────────── 2/3 yakınlık (ayrı eşikler)
d21ATR = math.abs(close - smma21) / atr
dAVATR = na(avwap) ? 10e6 : math.abs(close - avwap) / atr
dFATR = na(fib382) ? 10e6 : math.min(math.abs(close - fib382), math.min(math.abs(close - fib500), math.abs(close - fib618))) / atr

near21 = d21ATR <= tolMA
nearAV = dAVATR <= tolAV
nearFib = dFATR <= tolFibo

countConfluence = (near21?1:0) + (nearAV?1:0) + (nearFib?1:0)
twoOfThree = countConfluence >= 2

// ─────────────────────────── Trigger (Auto → CH3 fallback)
d1High = useDailyLock ? dHighD[1] : high[1]
h3High = useDailyLock ? h3HighD[1] : ta.highest(high, 3)[1]
ch3Close = useDailyLock ? ch3CloseD[1] : ta.highest(close, 3)[1]

stretch = d21ATR
grindCond = close > smma21 and close > avwap and close[1] > smma21[1] and close[1] > avwap[1] and close[2] > smma21[2] and close[2] > avwap[2] and stretch <= 0.6
reclaimCond = (close >= smma21) and (close >= avwap) and twoOfThree

tampon = math.max(tamponTL, tamponATRf*atr)

manualHigh =
triggerSrc == "D-1 High" ? d1High :
triggerSrc == "H3 High" ? h3High : na
manualTrig = not na(manualHigh) ? math.ceil((manualHigh + tampon)/syminfo.mintick)*syminfo.mintick :
triggerSrc == "CH3 Close" ? math.ceil((ch3Close + tampon)/syminfo.mintick)*syminfo.mintick : na

baseHighAuto = grindCond ? h3High : d1High
brokeHigh = high > baseHighAuto
barsNoBreak = ta.barssince(brokeHigh)
useCH3 = useCH3auto and reclaimCond and (barsNoBreak >= fallbackBars)

autoTrig = useCH3 ? math.ceil((ch3Close + tampon)/syminfo.mintick)*syminfo.mintick
: math.ceil((baseHighAuto + tampon)/syminfo.mintick)*syminfo.mintick

trigger = triggerSrc == "Auto" ? autoTrig : manualTrig

// Mesafe filtreleri (cap/veto) ve RSI kırılım filtresi
dist = close - trigger
okCap = dist <= capATR*atr
veto = dist >= vetoATR*atr
rsiOK = not useRSIbreak or (rsi >= 50)

// Starter (sadece reclaim gününde, cap'e değil SMMA yakınlığına bakar)
starterToday = nearCloseStarter and reclaimCond and (d21ATR <= starterTolMA) and (volume >= v20*1.0)

// ─────────────────────────── Plots
plot(smma21, "SMMA21", color=color.new(color.white, 0), linewidth=2)
plot(smma50, "SMMA50", color=color.new(color.blue, 0), linewidth=2)
plot(smma200, "SMMA200", color=color.new(color.red, 0), linewidth=2)

plot(avwap, "AVWAP", color=color.new(color.orange, 0), linewidth=2)
pU1 = plot(upper1, "AVWAP Band1+", color=color.new(color.lime, 40))
pL1 = plot(lower1, "AVWAP Band1-", color=color.new(color.lime, 40))

pU2 = plot(upper2, "AVWAP Band2+", color=color.new(color.green, 70))
pL2 = plot(lower2, "AVWAP Band2-", color=color.new(color.green, 70))


trigColor = okCap ? color.teal : (veto ? color.red : color.gray)
plot(trigger, "Trigger", color=color.new(trigColor, 0), style=plot.style_circles, linewidth=2)

// İşaretler
plotshape(starterToday, title="Starter", style=shape.triangleup, location=location.belowbar, color=color.new(color.teal, 0), size=size.tiny, text="Starter")
breakoutNow = (close >= trigger) and okCap and rsiOK
plotshape(breakoutNow, title="Breakout", style=shape.triangledown, location=location.abovebar, color=color.new(color.fuchsia, 0), size=size.tiny, text="BRK")

// ─────────────────────────── Alerts
alertcondition(starterToday, title="Starter_Ready", message="Starter: reclaim + Δ21 ≤ starterTolMA + v≥v20")
alertcondition(breakoutNow, title="Trigger_Breakout", message="Trigger üstü kapanış (cap OK, RSI filtresi OK)")

// ─────────────────────────── HUD
var label hudLbl = na
if barstate.islast and showHud
hudTxt = "2/3:" + (twoOfThree ? "✅" : "❌") +
" Trg:" + str.tostring(trigger, format.mintick) +
" ATR:" + str.tostring(atr, format.mintick) +
" Δ21:" + str.tostring(d21ATR, "#.##") + "≤" + str.tostring(tolMA, "#.##") +
" ΔAV:" + str.tostring(dAVATR, "#.##") + "≤" + str.tostring(tolAV, "#.##") +
" ΔF:" + str.tostring(dFATR, "#.##") + "≤" + str.tostring(tolFibo, "#.##") +
" RSI50:" + (rsiOK ? "✅" : "❌") +
" Cap:" + (okCap ? "≤"+str.tostring(capATR, "#.##")+" OK" : (veto ? "≥"+str.tostring(vetoATR, "#.##")+" VETO" : ">"+str.tostring(capATR, "#.##")+" FAR"))
if not na(hudLbl)
label.delete(hudLbl)
hudLbl := label.new(bar_index, high, hudTxt, style=label.style_label_upper_left, textcolor=color.white, color=color.new(color.black, 60))
Note di rilascio
AmazingGPT — Minimal, Regular Entry Assistant

Core: SMMA(21/50/200) + single AVWAP (manual anchor) + Fibo (for account).

Philosophy: “Less is more” — 2/3 proximity + clear trigger + risk frames.

What does it do?

Proximity (2/3) count: Measures how close the price is to SMMA21/50, AVWAP, and Fibo(38/50/61.8) levels in ATR terms; if at least two criteria are close, the “zone” breaks out.

Initiator signal (retracement): Small starts when close to support.

Exit signal: Trigger in progress (+ gate: gate ≤ 0.6×ATR).

Automatic trigger source: normally D-1 High; if there is a “grind,” H3 High. If the breakout is delayed, the CH (closing trades) system will fall early (reversal).

Signals (chart effects)

Starter (triangle ↑, bar bottom):
Recovery (Close ≥ SMMA21 and AVWAP) + 2/3 proximity + Δ21 ≤ starterTolMA (default 1.0 ATR) + volume ≥ 20g avg.
→ Small ticket; space is reserved for adding breakouts.

Breakout (triangle ↓, bar top):
Close ≥ Trigger and (Close − Trigger) ≤ cap×ATR (default 0.6×ATR) + (RSI ≥ 50).
→ Main entry/addition. 2/3 is not mandatory (to avoid missing the moment).

How does Trigger (Auto) work?

Base: H3 High if Grind, otherwise D-1 High + buffer (max {0.10 TL, 0.15×ATR}).

Fallback (N): If the base level fails to break for N consecutive days, the monthly trigger is CH Close (highest of the last N continuations) + buffer. (Default N=1 → becomes earlier.)

Daily Lock: The trigger level for the day remains fixed; intraday is used only for confirmation.

HUD (header)

Δ21 / ΔAV / ΔF: Distance from SMMA21, AVWAP, Fibo in ATR.

2/3: Proximity count result.

Cap/Veto: Trigger based on "chase" (≤0.6×ATR good; ≥1.0×ATR veto).

(Optional) RSI, Stretch (|Close−SMMA21|/ATR).

Basic settings (recommended)

SMMA21/50/200: Trend and position.

AVWAP announcer: Manual (update after bottom/gap/ex-date).

Proximity equivalents: SMMA=1.0 ATR, AVWAP=0.8 ATR, Fibo=0.6 ATR.

Start: Open; starterTolMA=1.0 (≤1 ATR close to SMMA21).

Breakout limit: 0.6×ATR (veto 1.0×ATR).

RSI≥50 filter: Only available on breakout.

Fibo lines: Hidden if desired; sufficient for the account.

Usage data (summary)

In 2/3 zone and if there is a recovery → Start (small).

When the breakout occurs (cap ≤ 0.6×ATR) → Add/Major.

If the diameter is above (chase) → Hold; wait for a pullback/reclaim or CH fallback.

Below SMMA200: Wait for a full length; Only the starter reclaim is very small. The main entry is a 200 retracement and retest.

Alerts

This is a timing/helper tool; fundamental analysis does not need to be modified.

Loss prevention/staggering rights are reserved (e.g., below AVWAP or ~1.5xATR).

This is not financial advice; past performance does not guarantee future performance.

Tip: Set the alarm separately for Breakout and Starter; keep it fixed intraday, triggered by "Daily-Lock ON", and breakout with 5/15 min candles.
Note di rilascio
GPT

Declinazione di responsabilità

Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.