J’ai fais ça mais j’ai des doutes cela n’a pas trop l’air effectif ?!
// DIVERGENCES TDI TRADER DYNAMIC INDEX by Nicolas modifié DID
// TDI by Nicolas
//parameters
// lengthRSI = 13 perso =12
lengthband = 34
// lengthrsipl = 2
lengthtradesl = 7
r = rsi[lengthrsi](close)
ma = average[lengthband](r)
offs = (1.6185 * std[lengthband](r))
up = ma+offs
dn = ma-offs
mid = (up+dn)/2
mab = average[lengthrsipl](r)
mbb = average[lengthtradesl](r)
lineup = 68
linemid = 50
linedown = 32
//RETURN lineup as "line up", linemid as "line mid", linedown as "line down", up //coloured(0,238,238) as "up", dn coloured(0,238,238) as "dn", mid coloured(255,165,0) as //"mid", mab coloured(0,255,0), mbb coloured(255,0,0)
//////////////////////////////////////////////////////////////////////////////////////
//PRC_AnotherRSIdivergences | indicator //25.02.2019
//Nicolas @ www.prorealcode.com //Sharing ProRealTime knowledge
// --- settings
TDIp=12 //TDI period perso = 12
obLevel=68 //overbought level
osLevel=32 //oversold level
minimalBars=5 //minimal count of bars where TDI is ob or os
// --- end of settings
// irsi = rsi[RSIp]
itdi = mab[TDIp]
ob = itdi>obLevel
os = itdi<osLevel
if ob then
if not ob[1] then
maxmab = 0
maxprice = 0
firstobbar = barindex
endif
maxtdi=max(maxmab,itdi)
maxprice=max(maxprice,high)
if maxtdi<>maxtdi[1] then
maxtdibar=barindex
endif
endif
if os then
if not os[1] then
mintdi = 100
minprice = close*100
firstosbar = barindex
endif
mintdi=min(mintdi,itdi)
minprice=min(minprice,low)
if mintdi<>mintdi[1] then
mintdibar=barindex
endif
endif
divsell=0
if itdi crosses under obLevel then
//verif divergence
div = maxprice>oldmaxprice and maxtdi<oldmaxtdi and (barindex-firstobbar)>=minimalBars
if div then
drawsegment(oldmaxtdibar,oldmaxtdi,maxtdibar,maxtdi) coloured(200,0,0)
drawarrowdown(maxtdibar,maxtdi) coloured(200,0,0)
divsell=osLevel
endif
oldmaxtdi = maxtdi
oldmaxprice = maxprice
oldmaxtdibar = maxtdibar
endif
divbuy=0
if itdi crosses over osLevel then
//verif divergence
div = minprice<oldminprice and mintdi>oldmintdi and (barindex-firstosbar)>=minimalBars
if div then
drawsegment(oldmintdibar,oldmintdi,mintdibar,mintdi) coloured(0,200,0)
drawarrowup(mintdibar,mintdi) coloured(0,200,0)
divbuy=osLevel
endif
oldmintdi = mintdi
oldminprice = minprice
oldmintdibar = mintdibar
endif
return itdi style(line,2) as "TDI",obLevel coloured(168,168,168) style(dottedline,1) as "overbought level", osLevel coloured(168,168,168) style(dottedline,1) as "oversold level", divsell coloured(200,0,0) style(histogram) as "sell divergence", divbuy coloured(0,200,0) style(histogram) as "buy divergence"
////////////////////////////////////////////////////////////////////////////////////////////////////////