Joker
Joker
//
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
// ---------------------------------------------- User Inputs
-----------------------------------------------------
// Parkinson Volatility
f_park(period, sqrtAnnual) =>
var LOG2 = math.log(2)
powLogHighLow = math.pow(math.log(high / low), 2)
sqrtAnnual * math.sqrt(1.0 / period * math.sum(1.0 / (4.0 * LOG2) *
powLogHighLow, period))
// Rescale Function
f_rescale(_src, _size) =>
math.max(0, math.min(_size, int(_src / 100 * _size)))
// Round Function
Round(src, digits) =>
p = math.pow(10, digits)
math.round(math.abs(src) * p) / p * math.sign(src)
// Settings
Haman = EWMA
period = 10
Annual = 365
a = 1.34
Plen = 365
Pco = ON
sma = ON
malen = 55
bsg = OFF
stl = CL
lT = 3
i_invert = OFF
bg = OFF
sp = OFF
// Hv Stats
avgHV = ta.sma(Hv, malen)
HVP = ta.percentrank(Hv, Plen)
NearZero = HVP < 1.5 ? 1 : 0
HV50 = ta.percentile_nearest_rank(Hv, Plen, 50)
// Custom MAs
maa = avgHV / 100 * 140
mab = avgHV / 100 * 180
mac = avgHV / 100 * 240
mad = avgHV / 100 * 60
mae = avgHV / 100 * 20
// Basic Settings
signalPreset = input.string('None', 'Signal Preset', ['None', 'Trend Only'],
group='basic settings')
signalLogic = input.string('Pro Scalper', 'Signal Logic', ['Pro Scalper',
'Normal'], group='basic settings')
signalStyle = input.string('Normal', 'Signal Style', ['Normal', 'Minimal'],
group='basic settings')
signalAgility = input.string('Auto Pilot', 'Agility%', ['Auto Pilot', 'Manual'],
group='basic settings')
signalMode = signalStyle == 'Normal' ? 'Simple Entry + Exits' : 'Minimized Entry +
Exits'
normalsensitivity = input.float(15, "Normal Sensitivity", 5.1, 50.1, step=0.1,
group="basic settings", tooltip='Change Your Signal Sensitivity And Accuracy')
sensitivity = input.float(5, "Pro Scalper Sensitivity", 0.6, 15.1, step=0.1,
group="basic settings", tooltip='Change Your Signal Sensitivity And Accuracy')
strongSignalOnly = signalPreset == 'Trend Only' ? true : false
noRepainting = true
auto_button = signalAgility == 'Auto Pilot' ? true : false
// EK Cloud
gr_MA = "📈Moving Average Settings📈"
Timeframe = ''
Repaint = false
MA_T1 = "Ehlers Kaufman"
MA_S1_Input = close
MA_L1 = 200
MA_T2 = "Ehlers Kaufman"
MA_S2_Input = close
MA_L2 = 350
MA_S1 = request.security(syminfo.tickerid, Timeframe, MA_S1_Input[Repaint ? 0 :
barstate.isrealtime ? 1 : 0])[Repaint ? 0 : barstate.isrealtime ? 0 : 1]
MA_S2 = request.security(syminfo.tickerid, Timeframe, MA_S2_Input[Repaint ? 0 :
barstate.isrealtime ? 1 : 0])[Repaint ? 0 : barstate.isrealtime ? 0 : 1]
MA_1 = switch MA_T1
"Simple" => ta.sma(MA_S1, MA_L1)
"Exponential" => ta.ema(MA_S1, MA_L1)
"Double Exponential" => 2 * ta.ema(MA_S1, MA_L1) - ta.ema(ta.ema(MA_S1, MA_L1),
MA_L1)
"Triple Exponential" => 3 * (ta.ema(MA_S1, MA_L1) - ta.ema(ta.ema(MA_S1,
MA_L1), MA_L1)) + ta.ema(ta.ema(ta.ema(MA_S1, MA_L1), MA_L1), MA_L1)
"Quadruple Exponential" => 5 * ta.ema(MA_S1, MA_L1) - 10 * ta.ema(ta.ema(MA_S1,
MA_L1), MA_L1) + 10 * ta.ema(ta.ema(ta.ema(MA_S1, MA_L1), MA_L1), MA_L1) - 5 *
ta.ema(ta.ema(ta.ema(ta.ema(MA_S1, MA_L1), MA_L1), MA_L1), MA_L1) +
ta.ema(ta.ema(ta.ema(ta.ema(ta.ema(MA_S1, MA_L1), MA_L1), MA_L1), MA_L1), MA_L1)
"Weighted" => ta.wma(MA_S1, MA_L1)
"Volume-weighted" => ta.vwma(MA_S1, MA_L1)
"Hull" => ta.hma(MA_S1, MA_L1)
"Symmetrical" => ta.swma(MA_S1)
"Arnaud Legoux" => ta.alma(MA_S1, MA_L1, 0.85, 6)
"Least Squares" => ta.linreg(MA_S1, MA_L1, 0)
"Relative Strength" => ta.rma(MA_S1, MA_L1)
"Welles Wilder" =>
Wilder_MA1 = .0
Wilder_MA1 := 1 / MA_L1 * MA_S1 + (1 - 1 / MA_L1) * nz(Wilder_MA1[1])
"Triangular" => ta.sma(ta.sma(MA_S1, MA_L1), MA_L1)
"Ehlers Kaufman" =>
KA_D1 = .0
for int i = 0 to 80 - 1 by 1
KA_D1 += math.abs(nz(MA_S1[i]) - nz(MA_S1[i + 1]))
KA_EF1 = KA_D1 != 0 ? math.min(math.abs(MA_S1 - nz(MA_S1[80 - 1])) / KA_D1,
1) : 0
KAMA1 = .0
KAMA1 := (math.pow((0.6667 * KA_EF1) + 0.0645, 2) * MA_S1) + ((1 -
math.pow((0.6667 * KA_EF1) + 0.0645, 2)) * nz(KAMA1[1]))
//
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
// ----------------------------------------------- Buy & Sell
-----------------------------------------------------
src = close
smoothrng(x, t, m) =>
wper = t * 2 - 1
avrng = ta.ema(math.abs(x - x[1]), t)
smoothrng = ta.ema(avrng, wper) * m
smoothrng
smrng = smoothrng(close, 100, sensitivity)
rngfilt(x, r) =>
rngfilt = x
rngfilt := x > nz(rngfilt[1]) ? x - r < nz(rngfilt[1]) ? nz(rngfilt[1]) : x - r
: x + r > nz(rngfilt[1]) ? nz(rngfilt[1]) : x + r
rngfilt
filt = rngfilt(src, smrng)
upward = 0.0
upward := filt > filt[1] ? nz(upward[1]) + 1 : filt < filt[1] ? 0 : nz(upward[1])
downward = 0.0
downward := filt < filt[1] ? nz(downward[1]) + 1 : filt > filt[1] ? 0 :
nz(downward[1])
longCond = bool(na)
shortCond = bool(na)
longCond := src > filt and src > src[1] and upward > 0 or src > filt and src <
src[1] and upward > 0
shortCond := src < filt and src < src[1] and downward > 0 or src < filt and src >
src[1] and downward > 0
CondIni = 0
CondIni := longCond ? 1 : shortCond ? -1 : CondIni[1]
// Candle Rating
TM_Long = ta.cci(close, 20) > 50
TM_Short = ta.cci(close, 20) < -50
lenadx = 21
lensig = 21
limadx = 34
ADX_up = ta.change(high)
ADX_down = -ta.change(low)
trur = ta.rma(ta.tr, lenadx)
plus = fixnan(100 * ta.rma(ADX_up > ADX_down and ADX_up > 0 ? ADX_up : 0, lenadx) /
trur)
minus = fixnan(100 * ta.rma(ADX_down > ADX_up and ADX_down > 0 ? ADX_down : 0,
lenadx) / trur)
sum = plus + minus
adx = 100 * ta.rma(math.abs(plus - minus) / (sum == 0 ? 1 : sum), lensig)
macol = adx > limadx and plus > minus ? color.lime : adx > limadx and plus <
minus ? color.red : color.black
entry_long = true
entry_short = true
Long_Signal_Strength = 0
Short_Signal_Strength = 0
if entry_long
if TM_Long
Long_Signal_Strength += 1
if ADX_Long
Long_Signal_Strength += 1
if ACC_Long
Long_Signal_Strength += 1
if MFI_Long
Long_Signal_Strength += 1
if MOML_Long
Long_Signal_Strength += 1
if entry_short
if TM_Short
Short_Signal_Strength += 1
if ADX_Short
Short_Signal_Strength += 1
if ACC_Short
Short_Signal_Strength += 1
if MFI_Short
Short_Signal_Strength += 1
if MOML_Short
Short_Signal_Strength += 1
// Trend Detecting
length = 20
incr = 100
resetOn = 'CHoCH'
showMS = false
bullCss = color.teal
bearCss = color.red
retCss = #ff5d00
areaTransp = 100
n = bar_index
ph = ta.pivothigh(length, length)
pl = ta.pivotlow(length, length)
if ph
ph_y := ph
ph_x := n - length
ph_cross := false
if pl
pl_y := pl
pl_x := n - length
pl_cross := false
if ms == 1
maxaman := close
else if ms == -1
minaman := close
else
maxaman := math.max(close, maxaman)
minaman := math.min(close, minaman)
if noRepainting
buyCond := buyCond and barstate.isconfirmed
strongBuyCond1 := strongBuyCond1 and barstate.isconfirmed
sellCond := sellCond and barstate.isconfirmed
strongSellCond1 := strongSellCond1 and barstate.isconfirmed
//
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
// ------------------------------------------------ Candle Color
----------------------------------------------------
barcolor = src > filt and src > src[1] and upward > 0 ? color.new(#00db0a, 5) : src
> filt and src < src[1] and upward > 0 ? color.new(#00db05, 5) : src < filt and src
< src[1] and downward > 0 ? color.new(#c90505, 5) : src < filt and src > src[1] and
downward > 0 ? color.new(#ff0000, 5) : color.new(#3ebe48, 5)
barcolor(CandleColor == 'Gradient Confirmation' ? barcolor : na, title='Candle
Colors')
//
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
// ------------------------------------------------ Reversal Cloud
--------------------------------------------------
//
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
// ------------------------------------------------- Trend Catcher
--------------------------------------------------
filtcolor = upward > 0 ? color.rgb(0, 255, 85) : downward > 0 ? color.new(#ff0000,
0) : color.new(#56328f, 0)
plot(TrendTracer ? filt : na, color=filtcolor, linewidth=3, title='Trend Tracer')
//
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
// ------------------------------------------------ Frequency Cloud
--------------------------------------------------
//
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
// ---------------------------------------------- Order Blocks
------------------------------------------------
type bar
float o = open
float h = high
float l = low
float c = close
float v = volume
int i = bar_index
int t = time
type ob
float top
float btm
float avg
int loc
color css
float vol
int dir
int move
int blPOS
int brPOS
int xlocbl
int xlocbr
type alert
bool created = false
bool inside = false
bool mitigated = false
type cross
bool reset = false
bar b = bar.new()
alert blal = alert.new()
alert bral = alert.new()
var cross blIS = cross.new()
var cross brIS = cross.new()
fnOB() =>
var ob[] blob = array.new<ob>()
var ob[] brob = array.new<ob>()
var int dir = 0
up = ta.highest(len)
dn = ta.lowest(len)
pv = ta.pivothigh(b.v, len, len)
dir := b.h[len] > up ? -1 : b.l[len] < dn ? 1 : dir[1]
atr = ta.atr(len)
btmP = obmode == "Length" ? (b.h[len] - 1 * atr[len]) < b.l[len] ? b.l[len] :
(b.h[len] - 1 * atr[len]) : b.l[len]
topP = obmode == "Length" ? (b.l[len] + 1 * atr[len]) > b.h[len] ? b.h[len] :
(b.l[len] + 1 * atr[len]) : b.h[len]
if pv and dir == 1
blob.unshift(ob.new(topP, b.l[len], math.avg(topP, b.l[len]), b.t[len],
obupcs, b.v[len], b.c[len] > b.o[len] ? 1 : -1, 1, 0, 0, b.t[len]))
blal.created := true
blIS.reset := false
if pv and dir == -1
brob.unshift(ob.new(b.h[len], btmP, math.avg(btmP, b.h[len]), b.t[len],
obdncs, b.v[len], b.c[len] > b.o[len] ? 1 : -1, 1, 0, 0, b.t[len]))
bral.created := true
brIS.reset := false
if blob.size() > 0 and barstate.isconfirmed
for [i, ob] in blob
for j = 0 to len - 1
if obmiti == "Close" ? math.min(b.c[j], b.o[j]) < ob.btm : obmiti
== "Wick" ? b.l < ob.btm : obmiti == "Avg" ? b.l < ob.avg : na
blob.remove(i)
blal.mitigated := true
break
if brob.size() > 0 and barstate.isconfirmed
for [i, ob] in brob
for j = 0 to len - 1
if obmiti == "Close" ? math.max(b.c[j], b.o[j]) > ob.top : obmiti
== "Wick" ? b.h > ob.top : obmiti == "Avg" ? b.h > ob.avg : na
brob.remove(i)
bral.mitigated := true
break
if blob.size() > 0
for [i, metric] in blob
metric.umt()
if brob.size() > 0
for [i, metric] in brob
metric.umt()
if overlap
blob.overlap()
brob.overlap()
if barstate.isconfirmed
if blob.size() > 0
ob = blob.get(0)
if low < ob.top and blIS.reset == false
blal.inside := true
blIS.reset := true
if brob.size() > 0
ob = brob.get(0)
if high > ob.btm and brIS.reset == false
bral.inside := true
brIS.reset := true
if barstate.islast
for bx in box.all
bx.delete()
for ln in line.all
ln.delete()
for lbl in label.all // Réactivé pour supprimer toutes les étiquettes
anciennes
label.delete(lbl)
if blob.size() > 0
for i = 0 to math.min(oblast - 1, blob.size() - 1)
blob.get(i).display(blob, i)
if brob.size() > 0
for i = 0 to math.min(oblast - 1, brob.size() - 1)
brob.get(i).display(brob, i)
if obshow
fnOB()