Initial Commit ...

This commit is contained in:
2024-01-25 04:07:49 +03:30
commit e24b73106d
76 changed files with 9457 additions and 0 deletions
+35
View File
@@ -0,0 +1,35 @@
//
// @author LazyBear
// List of my public indicators: http://bit.ly/1LQaPK8
// List of my app-store indicators: http://blog.tradingview.com/?p=970
//
study("Hurst Cycle Channel Clone Oscillator [LazyBear]", shorttitle="HCCCO_LB", overlay=false)
scl_t = input(10, title="Short Cycle Length?")
mcl_t = input(30, title="Medium Cycle Length?")
scm = input(1.0, title="Short Cycle Multiplier?")
mcm = input(3.0, title="Medium Cycle Multiplier?")
src=input(close, title="Source")
scl = scl_t/2, mcl = mcl_t/2
ma_scl=rma(src,scl)
ma_mcl=rma(src,mcl)
scm_off = scm*atr(scl)
mcm_off = mcm*atr(mcl)
scl_2=scl/2, mcl_2=mcl/2
sct = nz(ma_scl[scl_2], src)+ scm_off
scb = nz(ma_scl[scl_2], src)- scm_off
mct = nz(ma_mcl[mcl_2], src)+ mcm_off
mcb = nz(ma_mcl[mcl_2], src)- mcm_off
scmm=avg(sct,scb)
ul=plot(1.0, title="UpperLine", color=gray), ml=plot(0.5, title="MidLine", color=gray), ll=plot(0.0, title="LowerLine", color=gray)
fill(ll,ml,color=red), fill(ul,ml,color=green)
omed=(scmm-mcb)/(mct-mcb)
oshort=(src-mcb)/(mct-mcb)
plot(omed>=1.0?omed:na, histbase=1.0, style=histogram, color=purple, linewidth=2, title="MediumCycleOB")
plot(omed<=0.0?omed:na, histbase=0.0, style=histogram, color=purple, linewidth=2, title="MediumCycleOS")
plot(oshort>=1.0?oshort:na, histbase=1.0, style=histogram, color=purple, linewidth=2, title="ShortCycleOB")
plot(oshort<=0.0?oshort:na, histbase=0.0, style=histogram, color=purple, linewidth=2, title="ShortCycleOS")
plot(oshort, color=red, linewidth=2, title="FastOsc")
plot(omed, color=green, linewidth=2, title="SlowOsc")
ebc=input(false, title="Enable bar colors")
bc=(oshort>0.5)?(oshort>1.0?purple:(oshort>omed?lime:green)):(oshort<0?purple:(oshort<omed?red:orange))
barcolor(ebc?bc:na)
+124
View File
@@ -0,0 +1,124 @@
// This work is licensed under a Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0) https://creativecommons.org/licenses/by-nc-sa/4.0/
// © LuxAlgo
//@version=5
indicator("Hull Butterfly Oscillator [LuxAlgo]", "Hull Butterfly Oscillator [LuxAlgo]")
//-----------------------------------------------------------------------------}
//Settings
//----------------------------------------------------a-------------------------{
length = input(14)
mult = input(2., 'Levels Multiplier')
src = input(close)
//Style
bull_css_0 = input.color(color.new(#0cb51a, 50), 'Bullish Gradient'
, inline = 'inline0'
, group = 'Style')
bull_css_1 = input.color(#0cb51a, ''
, inline = 'inline0'
, group = 'Style')
bear_css_0 = input.color(color.new(#ff1100, 50), 'Bearish Gradient'
, inline = 'inline1'
, group = 'Style')
bear_css_1 = input.color(#ff1100, ''
, inline = 'inline1'
, group = 'Style')
//-----------------------------------------------------------------------------}
//Normalization variables
//-----------------------------------------------------------------------------{
var short_len = int(length / 2)
var hull_len = int(math.sqrt(length))
var den1 = short_len * (short_len + 1) / 2
var den2 = length * (length + 1) / 2
var den3 = hull_len * (hull_len + 1) / 2
//-----------------------------------------------------------------------------}
//Hull coefficients
//-----------------------------------------------------------------------------{
var lcwa_coeffs = array.new_float(hull_len, 0)
var hull_coeffs = array.new_float(0)
if barstate.isfirst
//Linearly combined WMA coeffs
for i = 0 to length-1
sum1 = math.max(short_len - i, 0)
sum2 = length - i
array.unshift(lcwa_coeffs, 2 * (sum1 / den1) - (sum2 / den2))
//Zero padding of linearly combined WMA coeffs
for i = 0 to hull_len-2
array.unshift(lcwa_coeffs, 0)
//WMA convolution of linearly combined WMA coeffs
for i = hull_len to array.size(lcwa_coeffs)-1
sum3 = 0.
for j = i-hull_len to i-1
sum3 += array.get(lcwa_coeffs, j) * (i - j)
array.unshift(hull_coeffs, sum3 / den3)
//-----------------------------------------------------------------------------}
//Hull squeeze oscillator
//-----------------------------------------------------------------------------{
var os = 0
var len = array.size(hull_coeffs)-1
hma = 0.
inv_hma = 0.
for i = 0 to len
hma += src[i] * array.get(hull_coeffs, i)
inv_hma += src[len-i] * array.get(hull_coeffs, i)
hso = hma - inv_hma
cmean = ta.cum(math.abs(hso)) / bar_index * mult
os := ta.cross(hso, cmean) or ta.cross(hso, -cmean) ? 0
: hso < hso[1] and hso > cmean ? -1
: hso > hso[1] and hso < -cmean ? 1
: os
//-----------------------------------------------------------------------------}
//Plot
//-----------------------------------------------------------------------------{
//Colors
css0 = color.from_gradient(hso, 0, cmean, bull_css_0, bull_css_1)
css1 = color.from_gradient(hso, -cmean, 0, bear_css_1, bear_css_0)
css = hso > 0 ? css0 : css1
//Oscillator line/histogram
plot(hso, 'Hull Butterfly', css
, style = plot.style_histogram)
plot(hso, 'Hull Butterfly', chart.fg_color)
//Dots
plot(os > os[1] and os == 1 ? hso : na, 'Bullish Dot'
, bull_css_1
, 2
, plot.style_circles)
plot(os < os[1] and os == -1 ? hso : na, 'Bearish Dot'
, bear_css_1
, 2
, plot.style_circles)
//Levels
plot(cmean, color = color.gray, editable = false)
plot(cmean / 2, color = color.gray, editable = false)
plot(-cmean / 2, color = color.gray, editable = false)
plot(-cmean, color = color.gray, editable = false)
//-----------------------------------------------------------------------------}
+36
View File
@@ -0,0 +1,36 @@
//
// @author LazyBear
//
// List of my public indicators: http://bit.ly/1LQaPK8
// List of my app-store indicators: http://blog.tradingview.com/?p=970
//
//
study("Impulse MACD [LazyBear]", shorttitle="IMACD_LB", overlay=false)
lengthMA = input(34)
lengthSignal = input(9)
calc_smma(src, len) =>
smma=na(smma[1]) ? sma(src, len) : (smma[1] * (len - 1) + src) / len
smma
calc_zlema(src, length) =>
ema1=ema(src, length)
ema2=ema(ema1, length)
d=ema1-ema2
ema1+d
src=hlc3
hi=calc_smma(high, lengthMA)
lo=calc_smma(low, lengthMA)
mi=calc_zlema(src, lengthMA)
md=(mi>hi)? (mi-hi) : (mi<lo) ? (mi - lo) : 0
sb=sma(md, lengthSignal)
sh=md-sb
mdc=src>mi?src>hi?lime:green:src<lo?red:orange
plot(0, color=gray, linewidth=1, title="MidLine")
plot(md, color=mdc, linewidth=2, title="ImpulseMACD", style=histogram)
plot(sh, color=blue, linewidth=2, title="ImpulseHisto", style=histogram)
plot(sb, color=maroon, linewidth=2, title="ImpulseMACDCDSignal")
ebc=input(false, title="Enable bar colors")
barcolor(ebc?mdc:na)
@@ -0,0 +1,728 @@
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Lupown
//@version=4
study(shorttitle="Multiple strategies [LPWN]", title="Multpile strategies [LUPOWN]", overlay=false)
//squeeze momoentum by lazy bear
show_Momen = input(true, title="-----------Show squeeze momentum-------")
int lengthM = input(20, title="MOM Length", minval=1, step=1)
srcM = input(close, title="MOM Source", type=input.source)
int length = input(20, title="SQZ Length", minval=1, step=1)
src = input(close, title="SQZ Source", type=input.source)
//Momentum
sz = linreg(srcM - avg(avg(highest(high, lengthM), lowest(low, lengthM)), sma(close, lengthM)), lengthM, 0)
//Momentum Conditions
sc1 = sz >= 0
sc2 = sz < 0
sc3 = sz >= sz[1]
sc4 = sz < sz[1]
clr = sc1 and sc3 ? #00FF00 : sc1 and sc4 ? #008000 :
sc2 and sc4 ? #FF0000 : sc2 and sc3 ? #800000 : color.gray
plot(show_Momen ? sz : na, title="Squeeze Momentum", color=clr, style=plot.style_area)
//SQUEEZE
lengths = input(20, title="BB Length")
mult = input(2.0,title="BB MultFactor")
lengthKC=input(20, title="KC Length")
multKC = input(1.5, title="KC MultFactor")
scale = input(75.0, title = "General scale")
useTrueRange = true
// Calculate BB
source = close
basis = sma(source, lengths)
dev = multKC * stdev(source, lengths)
upperBB = basis + dev
lowerBB = basis - dev
// Calculate KC
ma = sma(source, lengthKC)
range = useTrueRange ? tr : (high - low)
rangema = sma(range, lengthKC)
upperKC = ma + rangema * multKC
lowerKC = ma - rangema * multKC
sqzOn = (lowerBB > lowerKC) and (upperBB < upperKC)
sqzOff = (lowerBB < lowerKC) and (upperBB > upperKC)
noSqz = (sqzOn == false) and (sqzOff == false)
scolor = noSqz ? color.blue : sqzOn ? #000000 : color.gray
//plotshape(show_Momen? true : na, color=scolor, style=shape.xcross)
plot(show_Momen ? 0 : na, title="Squeeze Zero Line", color=scolor, linewidth=2, style=plot.style_cross, transp=0)
//plotshape(show_Momen?0:na,style=shape.xcross,color=scolor,location=location.absolute)
///// ADX
show_ADX = input(true, title = "------------Show ADX------------")
scaleADX = input(2.0, title = "ADX scale")
show_di = input(false, title = " Show +DI -DI")
show_aa = input(false, "Mostrar punto 23 aparte", inline="adx line")
far = input(-7, "Separacion", inline="adx line")
adxlen = input(14, title = "ADX Smoothing")
dilen = input(14, title = "DI Length")
keyLevel = input(23, title = "Key level for ADX")
show_bg = input (false, title = "Show bg color")
dirmov(len) =>
up = change(high)
down = -change(low)
truerange = rma(tr, len)
plus = fixnan(100 * rma(up > down and up > 0 ? up : 0, len) / truerange)
minus = fixnan(100 * rma(down > up and down > 0 ? down : 0, len) / truerange)
[plus, minus]
adx(dilen, adxlen) =>
[plus, minus] = dirmov(dilen)
sum = plus + minus
adx = 100 * rma(abs(plus - minus) / (sum == 0 ? 1 : sum), adxlen)
[adx, plus, minus]
[adxValue, diplus, diminus] = adx(dilen, adxlen)
///////////////////////////////////////////////////////////////
//[diplus, diminus, adxValue] = dmi(dilen, adxlen)
biggest(series) =>
max = 0.0
max := nz(max[1], series)
if series > max
max := series
max
// Calculate ADX Scale
ni = biggest(sz)
far1=far* ni/scale
adx_scale = (adxValue - keyLevel) * ni/scale
adx_scale2 = (adxValue - keyLevel+far) * ni/scale
dip= (diplus - keyLevel) * ni/scale
dim= (diminus - keyLevel) * ni/scale
plot (show_di ? dip * scaleADX :na, color=color.green, title="DI+")
plot (show_di ? dim * scaleADX :na, color=color.red, title="DI-")
color_ADX = adxValue > adxValue[1] ? #ffffff : #a09a9a
bgcolor(adxValue > adxValue[1] and adxValue > 23 and show_Momen and show_bg? clr : na, transp=95)
/////////////////WHALE BY BLACKCAT1404
show_whale = input(false,title = "Show Whale detector")
//functions
xrf(values, length) =>
r_val = float(na)
if length >= 1
for i = 0 to length by 1
if na(r_val) or not na(values[i])
r_val := values[i]
r_val
r_val
xsa(src,len,wei) =>
sumf = 0.0
ma = 0.0
out = 0.0
sumf := nz(sumf[1]) - nz(src[len]) + src
ma := na(src[len]) ? na : sumf/len
out := na(out[1]) ? ma : (src*wei+out[1]*(len-wei))/len
out
//trend follower algorithm
var2 = xrf(low,1)
var3 = xsa(abs(low-var2),3,1)/xsa(max(low-var2,0),3,1)*100
var4 = ema(iff(close*1.2,var3*10,var3/10),3)
var5 = lowest(low,30)
var6 = highest(var4,30)
var7 = iff(lowest(low,58),1,0)
var8 = ema(iff(low<=var5,(var4+var6*2)/2,0),3)/618*var7
//whale pump detector
//plotcandle(0,var8 * (ni/scale) ,0,var8* (ni/scale),color= var8 > 0 and show_whale ?color.yellow:na)
plot(show_whale? var8 * (ni/scale) : na, title = "whale" , style = plot.style_columns,color=color.yellow, transp=80)
///////////////////
//RSI
show_rsi = input(true, title="------------Show RSI---------")
show_RSIfondo=input(true, title="Show RSI background")
rsiApart = input(0,title="RSI separation")
len = input(14, minval=1, title="Length RSI ")
upperR = input (70,title="Upper band")
middleR = input (50,title="Middle band")
lowerR = input(30,title="Lower band")
rsi = rsi(src, len)
rsiColor = rsi <= lowerR ? color.green : rsi >= upperR ? color.red : #da00ff
rsi_scale=(rsi+rsiApart)* ni/scale
b1s=(rsiApart+upperR) * ni/scale
bm= (rsiApart+middleR) * ni/scale
b0s=(rsiApart+lowerR) * ni/scale
/////otro RSI DIVERGENCE
show_rsi2 = input (true,title = "Show RSI DIVERGENCE")
farRSI = input(70,title = "Adjust RSI DIVERGENCE")
src_fast = close, len_fast = input(5, minval=1, title="Length Fast RSI")
src_slow = close, len_slow = input(14,minval=1, title="Length Slow RSI")
up_fast = rma(max(change(src_fast), 0), len_fast)
down_fast = rma(-min(change(src_fast), 0), len_fast)
rsi_fast = down_fast == 0 ? 100 : up_fast == 0 ? 0 : 100 - (100 / (1 + up_fast / down_fast))
up_slow = rma(max(change(src_slow), 0), len_slow)
down_slow = rma(-min(change(src_slow), 0), len_slow)
rsi_slow = down_slow == 0 ? 100 : up_slow == 0 ? 0 : 100 - (100 / (1 + up_slow / down_slow))
//plotfast = plot(rsi_fast, color=blue)
//plotslow = plot(rsi_slow, color=orange)
divergence = rsi_fast - rsi_slow
//plotdiv = plot(divergence, color = divergence > 0 ? color.lime:color.red, linewidth = 2)
divergence_scale = divergence * (ni/scale)
rsiColor2 = divergence > 0 ? color.lime:color.red
plot(show_rsi ? rsi_scale : show_rsi2 ? divergence_scale + (farRSI * ni/scale) : na, "RSI", color=show_rsi ? rsiColor : show_rsi2 ? rsiColor2 :na)
//////
/////////
/////// estocastico
show_stoch=input(false,title="-------Show Stochastic------")
periodK = input(14, title="%K Length", minval=1)
smoothK = input(1, title="%K Smoothing", minval=1)
periodD = input(3, title="%D Smoothing", minval=1)
k = sma(stoch(close, high, low, periodK), smoothK)
d = sma(k, periodD)
k1=k* ni/scale
d1=d* ni/scale
plot(show_stoch?k1:na, title="%K", color=#2962FF)
plot(show_stoch?d1:na, title="%D", color=#FF6D00)
upS=input(80,title = "Upper band")
lowS=input(20,title = "Lower band")
h1s=upS * ni/scale
h0s=lowS * ni/scale
//plot(show_stoch? h1s : na,color=bar_index % 2 == 0 ? color.white : #00000000,transp=60)
//plot(show_stoch? h0s : na,color=bar_index % 2 == 0 ? color.white : #00000000,transp=60)
//band1 = plot(show_rsi? b1s : show_stoch? h1s: na,color=bar_index % 2 == 0 ? color.white : #00000000,transp=60)
//bandm = plot(show_rsi? bm : na,color=bar_index % 2 == 0 ? color.white : #00000000,transp=70)
//band0 = plot(show_rsi? b0s : show_stoch ? h0s: na,color=bar_index % 2 == 0 ? color.white : #00000000,transp=60)
///////
/////////////////AWESOME
show_ao = input(false, title="-----------Show AO-------")
show_aoF = input(true, title = "Show ao away 0 point")
farAO = input(-30 , title = "Away from 0 point")
fastLength = input(5,title="Fast Length")
slowLength = input(34,title="Slow Length")
ao = sma(hl2, fastLength) - sma(hl2, slowLength)
//nia = biggest(aoN)
//ao = aoN*nia/scale
ao_f = ao + (farAO * ni /scale)
aoColor = ao >= 0 ? (ao[1] < ao ? #26A69A : #B2DFDB) : (ao[1] < ao ? #FFCDD2 : #EF5350)
aoPlot = plot(show_aoF and show_ao ? ao_f : show_ao ? ao : na, title="AO", style= show_aoF ? plot.style_line : show_ao ? plot.style_area: plot.style_area , color=aoColor, transp=0) //
bandA = plot(show_aoF and show_ao ? farAO * ni /scale : na, color=color.white,transp=60)
fill(aoPlot,bandA, color= show_aoF and show_ao ? aoColor : na,transp=90,title="AO Fill")
/////////////////////
////////////////////////////////////
///////MACD
/////////////////////////////
show_macd = input(false, title="-----------Show MACD-------")
show_macdF = input (true, title = "Show MACD area away 0 point")
show_macdLF = input(true, title = "Show MACD lines away 0 point")
macdF = input(-30 , title = "Away 0 point")
show_macdL= input(false, title="Show MACD lines")
fast_length = input(title="Fast Length", type=input.integer, defval=12)
slow_length = input(title="Slow Length", type=input.integer, defval=26)
//src = input(title="Source", type=input.source, defval=close)
signal_length = input(title="Signal Smoothing", type=input.integer, minval = 1, maxval = 50, defval = 9)
sma_source = input(title="Oscillator MA Type", type=input.string, defval="EMA", options=["SMA", "EMA"])
sma_signal = input(title="Signal Line MA Type", type=input.string, defval="EMA", options=["SMA", "EMA"])
macdScale = input(2,title="MACD scale")
//calculating
fast_ma = sma_source == "SMA" ? sma(src, fast_length) : ema(src, fast_length)
slow_ma = sma_source == "SMA" ? sma(src, slow_length) : ema(src, slow_length)
macd1 = fast_ma - slow_ma
signal = sma_signal == "SMA" ? sma(macd1, signal_length) : ema(macd1, signal_length)
hist = (macd1 - signal)
//color
macdColor = hist >= 0 ? (hist[1] < hist ? #26A69A : #B2DFDB) : (hist[1] < hist ? #FFCDD2 : #EF5350)
histo = hist * macdScale
macd=macd1*macdScale
sign = signal * macdScale
histo_f = histo + (macdF * ni /scale)
colorlineMACD = macd > sign ? color.green : color.red
histoA = plot(show_macdF and show_macd ? histo_f : show_macd ? histo : na, title="Histogram", style=show_macdF and show_macd ? plot.style_line : show_macd ? plot.style_columns : plot.style_columns , color=macdColor)
plot(show_macdLF and show_macdL ? macd + (macdF * ni /scale) : show_macdL ? macd : na, title="MACD", color=colorlineMACD)
plot(show_macdLF and show_macdL ? sign + (macdF * ni /scale) : show_macdL ? sign : na, title="Signal", color=color.orange)
band_macd = plot(show_macdF and show_macd ? macdF * ni /scale : na, color=color.white,transp=60)
fill(histoA,band_macd, color= show_macdF and show_macd ? macdColor : na,transp=90,title="MACD Fill")
////////////////////////////////////////
//////////////////////END MACD
/////////////////////////////////
////////////////////////////////////////
////////////////////// KONOCORDE "Koncorde Inversiones en el Mundo by lkdml all the credits for them
/////////////////////////////////
show_K = input(false, title = "---------------Show Koncorde-------------")
scaleK= input(8,title = "Koncorde scale")
showKF = input(true, title = "Show Koncorde away 0 point")
fark= input (-30 , title = "Away from 0 point")
show_KD = input(false, title = "Show Koncorde Diamond")
kon_pos = input (30, title = "Position diamonds Bull")
kon_posn = input (-30, title = "Position diamonds Bear")
srcTprice = input(ohlc4, title="Fuente para Precio Total")
srcMfi = input(hlc3, title="Fuente MFI", group="Money Flow Index")
tprice=srcTprice
//lengthEMA = input(255, minval=1)
m=input(15, title="Media Exponencial")
longitudPVI=input(90, title="Longitud PVI")
longitudNVI=input(90, title="Longitud NVI")
longitudMFI=input(14, title="Longitud MFI")
multK=input(2.0, title="Multiplicador para derivacion estandar" , group="Bollinger Oscillator")
boLength=input(25, title="Calculation length ", group="Bollinger Oscillator" )
pvim = ema(pvi, m)
pvimax = highest(pvim, longitudPVI)
pvimin = lowest(pvim, longitudPVI)
oscp = (pvi - pvim) * 100/ (pvimax - pvimin)
nvim = ema(nvi, m)
nvimax = highest(nvim, longitudNVI)
nvimin = lowest(nvim, longitudNVI)
azul =( (nvi - nvim) * 100/ (nvimax - nvimin) )
xmf = mfi(srcMfi, longitudMFI)
// Bands Calculation
basisK = sma(tprice, boLength) //Find the 20-day moving average average (n1 + n2 ... + n20)/20
devK = mult * stdev(tprice, boLength) //Find the standard deviation of the 20-days
upper = basisK + devK //Upper Band = 20-day Moving Average + (2 x standard deviation of the 20-days)
lower = basisK - devK //Lower Band = 20-day Moving Average - (2 x standard deviation of the 20-days)
OB1 = (upper + lower) / 2.0
OB2 = upper - lower
BollOsc = ((tprice - OB1) / OB2 ) * 100 // percent b
xrsi = rsi(tprice, 14)
calc_stoch(src, length,smoothFastD ) =>
ll = lowest(low, length)
hh = highest(high, length)
k = 100 * (src - ll) / (hh - ll)
sma(k, smoothFastD)
stoc = calc_stoch(tprice, 21, 3)
marron =( (xrsi + xmf + BollOsc + (stoc / 3))/2 )
verde = (marron + oscp)
media = ema(marron,m)
bandacero= showKF ? fark*ni/scale : 0
scaleK1 = (ni/scale)/scaleK
//vl=plot(show_K ? verde *scaleK1: na, color=#66FF66, style=plot.style_area, title="verde")// COLOURED(102,255,102) as “verde” , GREEN
//ml=plot(show_K ? marron *scaleK1: na, color= #FFCC99, style=plot.style_area, title="marron", transp=0) // COLOURED(255,204,153) as"marron" , BEIGE
//al=plot(show_K ? azul *scaleK1: na, color=#126bd6, style=plot.style_area, title="azul") // COLOURED(0,255,255) as “azul” ,
lk1 = plot(show_K and showKF ? (marron *scaleK1) + (fark * ni /scale) : show_K ? marron *scaleK1: na, color= #330000, style=plot.style_line, linewidth=3, title="lmarron") // COLOURED(51,0,0) as “lmarron” ,
lk2 = plot(show_K and showKF ? (verde *scaleK1) + (fark * ni /scale) : show_K ? verde *scaleK1: na, color=#006600, style=plot.style_line, linewidth=3, title="lineav") // COLOURED(0,102,0) as “lineav” ,
lk3 = plot(show_K and showKF ? (azul *scaleK1) + (fark * ni /scale): show_K ? azul *scaleK1: na, color=#000066, style=plot.style_line, title="lazul" ) // COLOURED(0,0,102) as “lazul” ,
plot(show_K and showKF ? (media *scaleK1) + (fark * ni /scale) : show_K ? media *scaleK1: na, color=color.red, title="media", style=plot.style_line, linewidth=2) // COLOURED(255,0,0) as “media” ,
band0k = plot(show_K ? bandacero : na , color=color.black, title="cero")
fill(lk2,band0k,color = show_K ? #66FF66 : na , title = "verde", transp = 50)
fill(lk1,band0k,color = show_K ? #FFCC99 : na , title = "marron", transp = 50)
fill(lk3,band0k,color = show_K ? #00FFFF : na , title = "azul", transp = 50)
konBull = crossover(marron,media) and show_KD
konBear = crossunder(marron,media) and show_KD
konlBull=kon_pos * ni/scale
konlBear=kon_posn * ni/scale
plotchar(konBull ? konlBull : konBear ? konlBear : na, title = 'Koncorde diamond', char='◆', color = konBull ? color.lime : konBear ? color.maroon : color.white, location = location.absolute, size = size.tiny, transp = 0)
////////////////////////////////////////
////////////////////// END KONCORDE
/////////////////////////////////
////////////////////////////////////////
////////////////////// CCI
/////////////////////////////////
show_cci = input(false, title="------------Show CCI---------")
cci_len = input(14, "CCI length")
cci_src = input(close, "CCI source")
upperCCI = input(100, "CCI Upper band")
lowerCCI = input(-100, "CCI lower band")
b1cci = (upperCCI * ni/scale)*30/100
b0cci = (lowerCCI * ni/scale) *30/100
cci = cci(cci_src, cci_len)
cci_scale = (30) * ((cci) * ni/scale) / 100
//cci_scale=((cci * ni/scale)/scale) *scale_cci
//(cci / (ni * scale) ) + (50*ni/scale)
//cci_color = c1 ? #F8B856 : c2 ? #F6AD3C : c3 ? #F5A21B : #F39800
plot(show_cci ? cci_scale : na, color=color.blue, transp=0, linewidth=2, title="CCI")
////////////////////////////////////////
////////////////////// END CCI
/////////////////////////////////
///////////////////
////////
////////////////////
colorcm = show_cci ? color.blue : color.white
band1 = plot(show_rsi? b1s : show_stoch? h1s : na,color=bar_index % 2 == 0 ? color.white : #00000000,transp=60)
band0 = plot(show_rsi? b0s : show_stoch ? h0s: show_cci ? b0cci : na,color=bar_index % 2 == 0 ? color.white : #00000000,transp=60)
bandm = plot(show_cci ? b1cci : show_rsi? bm : show_rsi2 ? (farRSI * ni/scale): na,color=bar_index % 2 == 0 ? colorcm : #00000000,transp=70)
band00 = plot(show_cci? b0cci : na, color=bar_index % 2 == 0 ? color.blue : #00000000,transp=60)
fill(band1,band0, color= show_rsi and show_RSIfondo? color.purple : na,transp=90,title="RSI background")
//////////////
////////
/////////////////////\/
/////////////MFI i got the code fo=rom the CIPHER indicator by vumanchu
//////////////////////
rsiMFIShow = input(true, title = '----------Show MFI---------', type = input.bool)
rsiMFIperiod = input(60,title = 'MFI Period', type = input.integer)
rsiMFIMultiplier = input(150, title = 'MFI Area multiplier', type = input.float)
rsiMFIPosY = input(2.5, title = 'MFI Area Y Pos', type = input.float)
// RSI+MFI
f_rsimfi(_period, _multiplier, _tf) => security(syminfo.tickerid, _tf, sma(((close - open) / (high - low)) * _multiplier, _period) - rsiMFIPosY)
rsiMFI = f_rsimfi(rsiMFIperiod, rsiMFIMultiplier, timeframe.period)
rsiMFIColor1 = #ffffff
rsiMFIColor2 = #d1d4dc
rsiMFIColor = rsiMFI >= 0 ? rsiMFIColor1: rsiMFI < 0 ? rsiMFIColor2 : na
rsiMFIplot = plot(rsiMFIShow ? rsiMFI * ni/scale: na, title = 'RSI+MFI Area', color =rsiMFIColor , transp = 80,style=plot.style_area)
/////////////////////
/////////
//////////////////////
//WT the cipher dots use a indicator by lazy bear
show_cphr = input(true,title = "------------Show Cipher dots---------")
n1 = input(9, title = "Channel Length")
n2 = input(12, title = "Average Length")
smooth = input(3, title = "Smooth Factor")
//wt
CALC(n1, n2, smooth) =>
ap = hlc3
esa = ema(ap, n1)
dw = ema(abs(ap - esa), n1)
ci = (ap - esa) / (0.015 * dw)
tci = ema(ci, n2)
wt1 = tci
wt2 = sma(wt1,smooth)
wave = wt1 - wt2
wavecolor = wave >=0? color.lime : color.red
[wave, wavecolor]
//CIPHERR
[wave, wavecolor] = CALC(n1, n2, smooth)
middle = 0
condWt = cross(wave,middle) ? true : na
wtjeje= show_Momen ? sz : show_ao ? ao : show_macd ? macd : na
plot(condWt and show_cphr ? wtjeje : na, title = 'Buy and sell circle', color = wavecolor, style = plot.style_circles, linewidth = 3, transp = 15)
/////plot ADX
plot(show_aa ? far1 *scaleADX : na,color=color.white, title="Punto 23")
p1 = plot(show_aa ? adx_scale2 * scaleADX : show_ADX ? adx_scale * scaleADX : na, color = color_ADX, title = "ADX", linewidth = 2)
///
///////////////
// ESTADOOO
show_status = input(true, title = "------Show STATUS----------")
dist= input(10,title="Distancia del monitor")
dashColor = input(color.new(#696969, 90), "label Color", inline="Dash Line")
dashTextColor = input(color.new(#ffffff, 0), "Text Color", inline="Dash Line")
if(adxValue > adxValue[1] and adxValue > 23)
iadx='ADX con pendiente positiva por encima punto 23'
if(adxValue > adxValue[1] and adxValue < 23)
iadx='ADX con pendiente positiva por debajo punto 23'
if(adxValue < adxValue[1] and adxValue < 23)
iadx='ADX con pendiente negativa por debajo punto 23'
if(adxValue < adxValue[1] and adxValue > 23)
iadx='ADX con pendiente negativa por encima punto 23'
a1=adxValue >= 23
a2=adxValue < 23
a3=adxValue >= adxValue[1]
a4=adxValue < adxValue[1]
iAdx = a1 and a3 ? 'Pendiente positiva ↑ 23' : a1 and a4 ? 'Pendiente negativa ↑ 23' :
a2 and a4 ? 'Pendiente negativa ↓ 23' : a2 and a3 ? 'Pendiente positiva ↓ 23' : '-'
iMom = sc1 and sc3 ? 'Direccionalidad alcista' : sc1 and sc4 ? 'Direccionalidad bajista' :
sc2 and sc4 ? 'Direccionalidad bajista' : sc2 and sc3 ? 'Direccinalidad alcista' : '-'
igral = a1 and a3 and sc1 and sc3 ? 'Fuerte movimiento alcista' : a1 and a3 and sc1 and sc4 ? 'Monitor muestra rango-caida pero\nel movimiento tiene fuerza':
a1 and a3 and sc2 and sc4 ? 'Fuerte movimiento bajista' : a1 and a3 and sc2 and sc3 ? 'Monitor muestra rango-subida pero\nel movimiento tiene fuerza':
a1 and a4 and sc1 and sc3 ? 'Movimiento alcista sin fuerza' : a1 and a4 and sc1 and sc4 ? 'Monitor muestra rango-caida\n pendiente negativa en ADX ':
a1 and a4 and sc2 and sc4 ? 'Movimiento bajista sin fuerza' : a1 and a4 and sc2 and sc3 ? 'Monitor muestra rango-subida con \npendiente negativa en ADX ':
a2 and a4 and sc1 and sc3 ? 'Movimiento alcista sin fuerza' : a2 and a4 and sc1 and sc4 ? 'Monitor muestra rango-caida sin fuerza ':
a2 and a4 and sc2 and sc4 ? 'Movimiento bajista sin fuerza' : a2 and a4 and sc2 and sc3 ? 'Monitor muestra rango-subida sin fuerza ':
a2 and a3 and sc1 and sc3 ? 'Movimiento alcista que \n quiere agarrar fuerza' : a2 and a3 and sc1 and sc4 ? 'Monitor muestra rango-caida,\n el movimiento quiere agarrar fuerza':
a2 and a3 and sc2 and sc4 ? 'Movimiento bajista que \n quiere agarrar fuerza' : a2 and a3 and sc2 and sc3 ? 'Monitor muestra rango-subida,\n el movimiento quiere agarrar fuerza': '-'
s='\n'
scr_label='Info ADX: '+iAdx+s+'Info monitor: '+iMom+s+'Info general:'+s+igral
// Plot Label on the chart
// Plot Label on the chart
if show_status
lab_l = label.new(
bar_index + dist, 0, '\t Estatus segun estrategia\n\t' + scr_label,
color = dashColor,
textcolor = dashTextColor,
style = label.style_label_left,
yloc = yloc.price)
label.delete(lab_l[1])
// Send alert only if screener is not empty
if (scr_label != '')
alert('Estatus segun estrategia\n' + scr_label, freq = alert.freq_once_per_bar_close )
//////////////////////////////////
//DIVERGENCIAS BUENNNNNNNAS
show_div=input(true,title="------Divergencias--------")
lbR = input(title="Pivot Lookback Right", defval=1)
lbL = input(title="Pivot Lookback Left", defval=1)
rangeUpper = input(title="Max of Lookback Range", defval=60)
rangeLower = input(title="Min of Lookback Range", defval=1)
plotBull = input(title="Plot Bullish", defval=true)
plotHiddenBull = input(title="Plot Hidden Bullish", defval=true)
plotBear = input(title="Plot Bearish", defval=true)
plotHiddenBear = input(title="Plot Hidden Bearish", defval=true)
bearColor = #ff0000
bullColor = #1bff00
hiddenBullColor = #a4ff99
hiddenBearColor = #ff9e9e
textColor = color.white
noneColor = color.new(color.white, 100)
//FUNCTIONS
plFound(osc) => na(pivotlow(osc, lbL, lbR)) ? false : true
phFound(osc) => na(pivothigh(osc, lbL, lbR)) ? false : true
_inRange(cond) =>
bars = barssince(cond == true)
rangeLower <= bars and bars <= rangeUpper
_findDivRB(osc)=>
// Osc: Higher Low
oscHL = osc[lbR] > valuewhen(plFound(osc), osc[lbR], 1) and _inRange(plFound(osc)[1])
// Price: Lower Low
priceLL = low[lbR] < valuewhen(plFound(osc), low[lbR], 1)
bullCond = plotBull and priceLL and oscHL and plFound(osc)
//------------------------------------------------------------------------------
// Hidden Bullish
// Osc: Lower Low
oscLL = osc[lbR] < valuewhen(plFound(osc), osc[lbR], 1) and _inRange(plFound(osc)[1])
// Price: Higher Low
priceHL = low[lbR] > valuewhen(plFound(osc), low[lbR], 1)
hiddenBullCond = plotHiddenBull and priceHL and oscLL and plFound(osc)
//------------------------------------------------------------------------------
// Regular Bearish
// Osc: Lower High
oscLH = osc[lbR] < valuewhen(phFound(osc), osc[lbR], 1) and _inRange(phFound(osc)[1])
// Price: Higher High
priceHH = high[lbR] > valuewhen(phFound(osc), high[lbR], 1)
bearCond = plotBear and priceHH and oscLH and phFound(osc)
//------------------------------------------------------------------------------
// Hidden Bearish
// Osc: Higher High
oscHH = osc[lbR] > valuewhen(phFound(osc), osc[lbR], 1) and _inRange(phFound(osc)[1])
// Price: Lower High
priceLH = high[lbR] < valuewhen(phFound(osc), high[lbR], 1)
hiddenBearCond = plotHiddenBear and priceLH and oscHH and phFound(osc)
[bullCond,hiddenBullCond,bearCond,hiddenBearCond]
[sz_bullCond,sz_hiddenBullCond,sz_bearCond,sz_hiddenBearCond]=_findDivRB(sz)
foundDivBSZ = plFound(sz) and show_Momen and show_div ? true : false
colordivBSZ = sz_bullCond ? bullColor : sz_hiddenBullCond ? hiddenBullColor : noneColor
foundDivBeSZ = phFound(sz) and show_Momen and show_div ? true : false
colordivBeSZ = sz_bearCond ? bearColor : sz_hiddenBearCond ? hiddenBearColor : noneColor
plot(
foundDivBSZ ? sz[lbR] : na,
offset=-lbR,
title="Regular Bullish",
linewidth=1,
color=colordivBSZ,
transp=0
)
plot(
foundDivBeSZ ? sz[lbR] : na,
offset=-lbR,
title="Regular Bullish",
linewidth=1,
color=colordivBeSZ,
transp=0
)
////////////////////RSI DIV//////////////////
[rsi_bullCond,rsi_hiddenBullCond,rsi_bearCond,rsi_hiddenBearCond]=_findDivRB(rsi_scale)
foundDivBRSI = plFound(rsi_scale) and show_rsi and show_div ? true : false
colordivBRSI = rsi_bullCond ? bullColor : rsi_hiddenBullCond ? hiddenBullColor : noneColor
foundDivBeRSI = phFound(rsi_scale) and show_rsi and show_div ? true : false
colordivBeRSI = rsi_bearCond ? bearColor : rsi_hiddenBearCond ? hiddenBearColor : noneColor
plot(
foundDivBRSI ? rsi_scale[lbR] : na,
offset=-lbR,
title="Regular Bullish",
linewidth=1,
color=colordivBRSI,
transp=0
)
plot(
foundDivBeRSI ? rsi_scale[lbR] : na,
offset=-lbR,
title="Regular Bullish",
linewidth=1,
color=colordivBeRSI,
transp=0
)
+140
View File
@@ -0,0 +1,140 @@
//@version=3
study(title="TRIX Histogram R2.1 by JustUncleL", shorttitle="TRIXHIS R2")
// Author: JustUncleL
// Revision: R2
//
// Description:
// This study is an implementation of the Standard TRIX indicator, shown
// in coloured histogram format by default, with optional Bar colouring of TRIX zero
// and signal crossovers. Other options include showing TRIX as a linegraph instead
// of histogram and optional TRIX signal line with difference histogram.
// Have a look at Internet references below for some examples of how TRIX can be used.
//
// Candle Colouring:
// - Aqua = TRIX zero crossing from below to above zero.
// - Blue = TRIX zero crossing from above to below zero.
// - Gold = TRIX signal line crossing TRIX line from above to below.
// - Fuchsia= TRIX signal line crossing TRIX line from below to above.
//
// References:
// - http://forex-indicators.net/momentum-indicators/trix
// - http://www.dolphintrader.com/3-ma-exponential-moving-average-trix-forex-strategy/
// - "TRIX MA" by munkeefonix
//
// Revisions:
// R2 - Added Signal line crossover bar colouring and all TRIX crosses highlighted.
// - Changed Signal line crosses to "+", instead of arrow for better visibility.
// - Added Alerts for crossovers.
// - Added Implied GPL Copyright notice.
//
// R1 - Original version.
//
//
// -----------------------------------------------------------------------------
// Copyright 2014 munkeefonix
// Copyright 2017,2018 JustUncleL
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// The GNU General Public License can be found here
// <http://www.gnu.org/licenses/>.
//
// -----------------------------------------------------------------------------
//
// --- INPUTS ---
//
length = input(12, minval=1, title="TRIX length")
signallen = input(8, minval=1, title="Signal Length")
showSignal= input(true, title="Show Signal line")
showLine = input(false, title="Show TRIX as Line instead of Histogram")
showZeroX = input(false, title="Show TRIX Zero cross overs")
showTrixX = input(false, title="Show TRIX Signal cross overs")
showBars = input(false, title="Colour Crossover Candles")
//
// --- /INPUTS ---
// --- CONSTANTS ---
//
BLUE = #0000FFFF
AQUA = #00FFFFFF
GOLD = #FFD700FF
gold = #FFD700
BLACK = #000000FF
GRAY = #808080FF
DARKGRAY= #696969FF
PURPLE = #800080FF
FUCHSIA = #FF00FFFF
MAROON = #8B0000FF
GREEN = #008000FF
//
scaleup = 2
//
// --- /CONSTANTS
// --- FUNCTIONS ---
//
// Triple EMA function
tema(a, b)=>ema(ema(ema(a, b), b), b)
// TRIX function
trix(a, b)=>
t = tema(a,b)
10000* ((t-t[1]) / t[1])
// --- /FUNCTIONS ---
// --- SERIES ---
//
TRIX = trix(close,length)
TRIXsig = ema(TRIX,signallen)
TRIXdiff= (TRIX - TRIXsig) * scaleup
//
signalX = crossover(TRIXsig,TRIX) ? -1 : crossunder(TRIXsig,TRIX) ? 1 : 0
//
trixZX = crossover(TRIX,0)? 1 : crossunder(TRIX,0)? -1: 0
//
// --- /SERIES ---
// --- PLOTTING
//
hline(0, title="Zero")
plot(showLine?na:TRIX, title="TRIX Histogram", color = TRIX>=0 ? rising(TRIX,3)?lime:green : falling(TRIX,3)?maroon:red, style=histogram, linewidth=4, transp=10)
plot(showLine?TRIX:na, title="TRIX Line", color = TRIX>=0 ? rising(TRIX,3)?lime:green : falling(TRIX,3)?maroon:red, style=line, linewidth=2, transp=10)
plot(showSignal?TRIXsig:na, title="TRIX Signal", color = orange, style=circles, join=true, linewidth=2, transp=10)
plot(showSignal?TRIXdiff:na, title="TRIX Diff", color = gray, style=area, linewidth=1, transp=70)
plot(showSignal and showTrixX and signalX!=0?TRIXsig:na, style=cross, title="Signal X Highlight", color=black, transp=20, linewidth=5)
plot(showSignal and showTrixX and signalX==1?TRIXsig:na, style=cross, title="Signal X up", color=gold, transp=0, linewidth=4)
plot(showSignal and showTrixX and signalX==-1?TRIXsig:na, style=cross, title="Signal X down", color=fuchsia, transp=20, linewidth=4)
plot(showZeroX and trixZX!=0?TRIX:na, style=circles, title="Zero X Highlight", color=black, transp=20, linewidth=5)
plot(showZeroX and trixZX==1?TRIX:na, style=circles, title="Zero X up", color=aqua, transp=10, linewidth=4)
plot(showZeroX and trixZX==-1?TRIX:na, style=circles, title="Zero X down", color=blue, transp=10, linewidth=4)
bclr = showZeroX? trixZX==1? AQUA: trixZX==-1? BLUE: na : na
bclr := not na(bclr)? bclr : showSignal and showTrixX ? signalX==-1? FUCHSIA : signalX==1? GOLD : na : na
barcolor(showBars?bclr:na,title="TRIX Zero X Bar")
// --- /PLOTTING ---
// --- ALERTING ---
alertcondition(trixZX==1,title="ZERO X Up Alert",message="ZERO X UP")
alertcondition(trixZX==-1,title="ZERO X Down Alert",message="ZERO X DOWN")
alertcondition(signalX==1,title="Signal X Up Alert",message="SIGNAL X UP")
alertcondition(signalX==-1,title="Signal X Down Alert",message="SIGNAL X DOWN")
// --- /ALERTING ---
// eof
+165
View File
@@ -0,0 +1,165 @@
//@version=3
study(title="Ultra RSI [DW]", overlay=false)
//by Donovan Wall
//This is an RSI Variation with six different averaging methods to choose from.
//The averaging methods I've included in this script are:
//-Exponential Moving Average
//-Simple Moving Average
//-Smoothed Moving Average
//-Weighted Moving Average
//-Volume Weighted Moving Average
//-Arnaud Legoux Moving Average
//Each method produces a different, yet significant gauge of relative strength.
//Custom bar colors are included.
//-----------------------------------------------------------------------------------------------------------------------------------------------------------------
//Updates:
// - Added two more averages, Coefficient of Variation Weighted Moving Average and Kaufman's Adaptive Moving Average, to the available averaging methods.
// - Added a Laguerre mode to the script, which calculates the RSI using the Laguerre method instead of the conventional method when enabled.
//-----------------------------------------------------------------------------------------------------------------------------------------------------------------
//Updates:
//Updated the filter types for RSI calculation
//The available filters for RSI calculation are:
//-> Exponential Moving Average
//-> Double Exponential Moving Average
//-> Simple Moving Average
//-> Smoothed Moving Average
//-> Weighted Moving Average
//-> Volume Weighted Moving Average
//-> Arnaud Legoux Moving Average
//-> Coefficient of Variation Moving Average
//-> Kaufman's Adaptive Moving Average
//The filter type and RSI type are selectable via easy to use dropdown menus.
//-----------------------------------------------------------------------------------------------------------------------------------------------------------------
//Inputs
//-----------------------------------------------------------------------------------------------------------------------------------------------------------------
//Source
src = input(defval=close, title="Source")
//Periods
per = input(defval=14, minval=1, title="Sampling Period")
//Filter Type
ftype = input(defval="EMA", options=["EMA", "DEMA", "SMA", "SMMA", "WMA", "VWMA", "ALMA", "COVWMA", "KAMA"], title="Filter Type")
//RSI Type
rsitype = input(defval="Standard", options=["Standard", "Laguerre"], title="RSI Type")
//Volume Type
voltype = input(defval="Default", options=["Default", "Tick"], title="Volume Type")
//ALMA Offset and Sigma
aoff = input(defval=0.85, step=0.01, minval=0, title="Offset (if ALMA)")
sigma = input(defval=6, minval=0, title="Sigma (if ALMA)")
//KAMA
fast = input(defval=0.666, step=0.001, title="Smoothing Constant Fast End (if KAMA)")
slow = input(defval=0.0645, step=0.0001, title="Smoothing Constant Slow End (if KAMA)")
//Thresholds
obt = input(defval=70, title="Overbought Threshold")
ost = input(defval=30, title="Oversold Threshold")
//Laguerre Mode
gamma = input(defval=0.75, minval=0.1, step=0.01, maxval=0.9, title="Gamma (if Laguerre Mode is Active)")
//-----------------------------------------------------------------------------------------------------------------------------------------------------------------
//Definitions
//-----------------------------------------------------------------------------------------------------------------------------------------------------------------
//Gains and Losses
srcu = src > src[1] ? src - src[1] : 0
srcd = src < src[1] ? abs(src - src[1]) : 0
//DEMA
dema(x, t)=>
dema = 2*ema(x, t) - ema(ema(x, t), t)
dema
//VWMA
VWMA(x, t)=>
tick = syminfo.mintick
rng = close - open
tickrng = tick
tickrng := abs(rng) < tick ? nz(tickrng[1]) : rng
tickvol = abs(tickrng)/tick
vol = voltype=="Default" ? (volume==na ? tickvol : volume) : tickvol
vmp = x*vol
VWMA = sum(vmp, t)/sum(vol, t)
VWMA
//SMMA
smma(x, t)=>
smma = x
smma := na(smma[1]) ? sma(x, t) : (nz(smma[1])*(t - 1) + x)/t
smma
//COVWMA
covwma(x, t) =>
cov = stdev(x, t)/sma(x, t)
cw = x*cov
covwma = sum(cw, t)/sum(cov, t)
covwma
//KAMA
kama(x, t)=>
dist = abs(x[0] - x[1])
signal = abs(x - x[t])
noise = sum(dist, t)
effr = noise != 0 ? signal/noise : 1
sc = pow(effr*(fast - slow) + slow, 2)
kama = x
kama := nz(kama[1]) + sc*(x - nz(kama[1]))
kama
//Filters
mau = ftype=="EMA" ? ema(srcu, per) : ftype=="DEMA" ? dema(srcu, per) : ftype=="SMA" ? sma(srcu, per) : ftype=="SMMA" ? smma(srcu, per) : ftype=="WMA" ? wma(srcu, per) : ftype=="VWMA" ? VWMA(srcu, per) : ftype=="ALMA" ? alma(srcu, per, 0.85, 6) : ftype=="COVWMA" ? covwma(srcu, per) : kama(srcu, per)
mad = ftype=="EMA" ? ema(srcd, per) : ftype=="DEMA" ? dema(srcd, per) : ftype=="SMA" ? sma(srcd, per) : ftype=="SMMA" ? smma(srcd, per) : ftype=="WMA" ? wma(srcd, per) : ftype=="VWMA" ? VWMA(srcd, per) : ftype=="ALMA" ? alma(srcd, per, 0.85, 6) : ftype=="COVWMA" ? covwma(srcd, per) : kama(srcd, per)
//Laguerre RSI
l0 = src
l0 := (1 - gamma)*src + gamma*nz(l0[1])
l1 = l0
l1 := -gamma*l0 + nz(l0[1]) + gamma*nz(l1[1])
l2 = l1
l2 := -gamma*l1 + nz(l1[1]) + gamma*nz(l2[1])
l3 = l2
l3 := -gamma*l2 + nz(l2[1]) + gamma*nz(l3[1])
cu = (l0 > l1 ? l0 - l1 : 0) + (l1 > l2 ? l1 - l2 : 0) + (l2 > l3 ? l2 - l3 : 0)
cd = (l0 < l1 ? l1 - l0 : 0) + (l1 < l2 ? l2 - l1 : 0) + (l2 < l3 ? l3 - l2 : 0)
lrsi = 100*((cu + cd)==0 ? -1 : (cu + cd)==-1 ? 0 : cu/((cu + cd)==0 ? -1 : cu + cd))
//RSI
rs = mau/mad
rsi = rsitype=="Laguerre" ? lrsi : 100 - (100/(1 + rs))
//Color
rsicolor = (rsi > 50) and (src > src[1]) ? lime : (rsi > 50) and (src <= src[1]) ? green : (rsi < 50) and (src < src[1]) ? red : (rsi < 50) and (src >= src[1]) ? maroon : orange
//-----------------------------------------------------------------------------------------------------------------------------------------------------------------
//Plots
//-----------------------------------------------------------------------------------------------------------------------------------------------------------------
//Thresholds
obplot = plot(obt, color=lime, title="Overbought Threshold")
mplot = plot(50, color=orange, title="Midline")
osplot = plot(ost, color=red, title="Oversold Threshold")
//RSI
rsiplot = plot(rsi, color=rsicolor, transp=0, title="RSI")
//Fill
fill(rsiplot, mplot, color=rsicolor, transp=60, title="RSI Fill")
//Bar Color
barcolor(rsicolor, title="Bar Colors")
+36
View File
@@ -0,0 +1,36 @@
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Shuttle_Club
//@version=4
study('Volume fight')
ma = input(24, 'Search_range', minval=1,tooltip='The range of estimation of the predominance of bullish or bearish volume (quantity bars). The smaller the TF, the higher the range value should be used to filter out false signals.\n\nДиапазон оценки преобладания бычьего или медвежьего объема (количество баров). Чем меньше ТФ, тем выше следует использовать значение диапазона, чтобы отфильтровать ложные сигналы.')
delta = input(15, 'Smoothing_for_flat,%', step=0.5, minval=0,tooltip='Smoothing to reduce false signals and highlight the flat zone. If you set the percentage to zero, the flat zones will not be highlighted, but there will be much more false signals, since the indicator becomes very sensitive when the smoothing percentage decreases.\n\nСглаживание для уменьшения ложных сигналов и выделения зоны флета. Если выставить процент равным нулю, то зоны флета выделяться не будут, но будет гораздо больше ложных сигналов, так как индикатор становится очень чувствительным при снижении процента сглаживания')
bgshow = input(false, 'Show background zones',tooltip='Show the color background of the current trading zone.\n\nПоказывать цветовой фон текущей торговой зоны.')
all_signal_show = input(false, 'Show each setup in zone',tooltip='Show and use signals every time in trading zone.\n\nПоказывать и использовать каждый сигнал в торговой зоне.')
///// CALCULATION
bull_vol = open<close ? volume : volume*(high-open)/(high-low) //determine the share of bullish volume
bear_vol = open>close ? volume : volume*(open-low)/(high-low) //determine the share of bearish volume
avg_bull_vol = vwma(bull_vol,ma), avg_bear_vol = vwma(bear_vol,ma) //determine vwma
diff_vol = sma((avg_bull_vol/volume-1)-(avg_bear_vol/volume-1),ma) //normalize and smooth the values
vol_flat = abs(avg_bull_vol+avg_bear_vol)/2 //determine average value for calculation flat-filter
///// SIGNALS
up = int(na), up := nz(up[1]), dn = int(na), dn := nz(dn[1]) //variables
bull = avg_bull_vol>avg_bear_vol and vol_flat/avg_bull_vol<(1-delta/100) //determine up zones
bear = avg_bull_vol<avg_bear_vol and vol_flat/avg_bear_vol<(1-delta/100) //determine dn zones
if bull
up += 1, dn := 0
if bear
dn += 1, up := 0
if not bull and not bear and all_signal_show
up :=0, dn := 0
alertcondition(bull and up==1,'UP','UP - Bullish movement') //UP - alert
alertcondition(bear and dn==1,'DN','DN - Bearish movement') //DN - alert
///// PLOTTING
plotshape(bull and up==1, 'UP', location=location.bottom, style = shape.triangleup, color=color.green, size=size.tiny)
plotshape(bear and dn==1, 'DN', location=location.top, style = shape.triangledown, color=color.red, size=size.tiny)
bgcolor(title='Trading zones',color = bgshow and avg_bull_vol>avg_bear_vol and vol_flat/avg_bull_vol<(1-delta/100) ? color.new(color.green,85) : bgshow and avg_bull_vol<avg_bear_vol and vol_flat/avg_bear_vol<(1-delta/100) ? color.new(color.red,85) : na)
plot(diff_vol, 'Volume difference', style=plot.style_area, color = avg_bull_vol>avg_bear_vol and vol_flat/avg_bull_vol<(1-delta/100) ? color.new(color.green,0) : avg_bull_vol<avg_bear_vol and vol_flat/avg_bear_vol<(1-delta/100) ? color.new(color.red,0) : color.new(color.gray,50))