EMA_short, EMA_long → computed from price series
clamp = "Restricts (or "clamps") a value to fall within a specified range [min, max]"
AverageTrueRange = “On average, how much does the price move per candle?”
closes_above_shortEMA = 7, LookbackCandleCount = 10, means: 7 out of last 10 candles closed above EMA_short
Close(t) = closing price of the candle at time t
GC_probability =
0.26 * (1 - clamp(|EMA_short(t) - EMA_long(t)| / (1.5 * AverageTrueRange(14), 0, 1))
# measures how close the two EMAs are (distance to cross)
# normalized by 1.5 * AverageTrueRange → defines “relevant distance”
# → very close EMAs → value approaches 1
# → far apart EMAs → value approaches 0
+ 0.24 * clamp(((EMA_short(t) - EMA_long(t)) - (EMA_short(t-1) - EMA_long(t-1))) / (0.2 * AverageTrueRange(14)), 0, 1)
# measures how fast the EMA gap is closing (velocity)
# normalized by 20% of a typical candle move (AverageTrueRange)
# → if gap is closing fast → value approaches 1
# → if slow or negative → value approaches 0
+ 0.16 * clamp((((EMA_short(t) - EMA_long(t)) - (EMA_short(t-1) - EMA_long(t-1))) - ((EMA_short(t-1) - EMA_long(t-1)) - (EMA_short(t-2) - EMA_long(t-2)))) / (0.1 * AverageTrueRange(14)), 0, 1)
# measures how the speed of the EMA gap change is evolving (acceleration)
# normalized by 10% of a typical candle move (AverageTrueRange)
# → accelerating toward the cross → value approaches 1
# → slowing down or reversing → value approaches 0
+ 0.14 * (closes_above_shortEMA / LookbackCandleCount)
# closes_above_shortEMA = number of recent candles that closed above EMA_short → computed input (from your candle data)
# LookbackCandleCount = total number of recent candles checked (e.g. 10) → measures how consistently price stays above the short EMA
# → more closes above → value approaches 1 (strong support)
# → fewer closes above → value approaches 0 (weak support)
+ 0.12 * clamp(((EMA_long(t) - EMA_long(t-1)) + (0.05 * AverageTrueRange(14))) / (2 * (0.05 * AverageTrueRange(14))), 0, 1)
# measures the slope of the long EMA (trend resistance)
# remapped using ±5% of AverageTrueRange as a “flat zone” threshold
# → falling long EMA → value approaches 0 (resistance still strong)
# → flat long EMA → value ≈ 0.5 (neutral)
# → rising long EMA → value approaches 1 (trend turning favorable)
+ 0.08 * ((abs(Close(t) - Close(t - LookbackCandleCount)) / sum(abs(Close(i) - Close(i-1)) for i in last LookbackCandleCount))* clamp((AverageTrueRange(14) / Close(t)) / 0.02, 0, 1))
# LookbackCandleCount = total number of recent candles checked (e.g. 10)
# trend_efficiency:
# straight movement / total movement → smooth trend vs noisy
# volatility_support:
# ATR relative to price, scaled so normal volatility → ~1
# Close(t) = closing price of the candle at time t
# Close(t-1) = closing price of previous candle
# Close(t-2) = closing price two candles ago
# comes directly from your candle data (KuCoin API)
# example:
# candle = { open, high, low, close }
# Close(t) = candle.close
GC_probability = clamp(GC_Prob * 100, 0, 100)
# =========================
# COMPUTED INPUTS (from data)
# =========================
# EMA_short(t), EMA_short(t-1), EMA_short(t-2) → computed from price series
# EMA_long(t), EMA_long(t-1), EMA_long(t-2) → computed from price series
# AverageTrueRange(14) → computed from candle data (volatility)
# Close(t), Close(t-1), Close(t-2), ... → directly from candle data
# closes_above_shortEMA → computed by counting closes above EMA_short over recent candles
# =========================
# FIXED PARAMETERS (tunable)
# =========================
# 0.26 → weight of distance term
# |EMA_short - EMA_long| / (1.5 * AverageTrueRange)
# 1.5 → defines how far EMAs can be and still be “close”
# 0.24 → weight of velocity term
# velocity / (0.2 * AverageTrueRange)
# 0.2 → defines what counts as strong gap closing speed
# 0.16 → weight of acceleration term
# acceleration / (0.1 * AverageTrueRange)
# 0.1 → defines what counts as strong increase in speed
# 0.14 → weight of structure term
# closes_above_shortEMA / LookbackCandleCount
# LookbackCandleCount = 10 → number of candles checked
# 0.12 → weight of long EMA slope term
# ((EMA_long(t) - EMA_long(t-1)) + (0.05 * ATR)) / (2 * 0.05 * ATR)
# 0.05 → defines “flat zone” for long EMA
# 0.08 → weight of volatility/efficiency term
# (AverageTrueRange / Close) / 0.02
# 0.02 → defines “normal volatility” level
# =========================
# DERIVED (internal calculations)
# =========================
# EMA gaps, velocity, acceleration
# trend_efficiency
# volatility_support
# → all computed inside the formula from the above inputs