SMC proScreener
Forums › ProRealTime foro Español › Soporte ProScreener › SMC proScreener
- This topic has 5 replies, 2 voices, and was last updated 2 weeks ago by
Iván.
-
-
03/04/2025 at 12:30 PM #244627
Hola, me gustaría un ProScreener sobre el indicador SMC que hizo Iván hace unos meses, en concreto me gustaría que me pudiera avisar del valor que entrara en un bloque activo (cuando se pone de color amarillo) ya sea alcista o bajista, y que la vela que en cuestión indicara una posible reversión con un dogi o martillo alcista o bajista según la situación en ese momento, el código del indicador es el siguiente:
defparam drawonlastbaronly=true
//——————————————————————————–//
//PRC_Smart Money Concepts
//version = 1
//29.07.2024
//Iván González @ http://www.prorealcode.com
//Sharing ProRealTime knowledge
//——————————————————————————–//
//—–Inputs———————————————————————//
//length=50
n=barindex
//showswings=1
//showHLswings=1
//showinternals=1
//showStructure=1
//showOB=1
//showiOB=1
//showlastOB=5
//ifilterConfluence=0
//obFilter=1 //1=ATR 0=Cumulative mean Range
//——————————————————————————–//
//——————————————————————————–//
atr=averagetruerange[200](close)
cmeanrange=summation[max(1,n)](high-low)/n
//——————————————————————————–//
//—–Swings———————————————————————//
//—Swing length
os=0
upper=highest[length](high)
lower=lowest[length](low)if high[length]>upper then
os=0
elsif low[length]<lower then
os=1
else
os=os[1]
endifif os=0 and os[1]<>0 then
mytop=high[length]
else
mytop=0
endifif os=1 and os[1]<>1 then
mybot=low[length]
else
mybot=0
endif
//—Swing 5
os1=0
upper1=highest[5](high)
lower1=lowest[5](low)if high[5]>upper1 then
os1=0
elsif low[5]<lower1 then
os1=1
else
os1=os1[1]
endifif os1=0 and os1[1]<>0 then
itop=high[5]
else
itop=0
endifif os1=1 and os1[1]<>1 then
ibot=low[5]
else
ibot=0
endif
//——————————————————————————–//
//—–Pivot High—————————————————————–//
if mytop then
topcross=1if showswings then
if mytop>topy then
$phy[z+1]=mytop
$phx[z+1]=n-length
$phtype[z+1]=1
z=z+1
else
$phy[z+1]=mytop
$phx[z+1]=n-length
$phtype[z+1]=-1
z=z+1
endif
endiftopy=mytop
topx=n-lengthtrailup=mytop
trailupx=n-length
endifif itop then
itopcross=1itopy=itop
itopx=n-5
endif//Trailing maximun
trailup=max(high,trailup)
if trailup=high then
trailupx=n
else
trailupx=trailupx
endif//——————————————————————————–//
//—–Pivot Low——————————————————————//
if mybot then
botcross=1if showswings then
if mybot<boty then
$ply[k+1]=mybot
$plx[k+1]=n-length
$pltype[k+1]=1
k=k+1
else
$ply[k+1]=mybot
$plx[k+1]=n-length
$pltype[k+1]=-1
k=k+1
endif
endifboty=mybot
botx=n-lengthtraildn=mybot
traildnx=n-length
endifif ibot then
ibotcross=1iboty=ibot
ibotx=n-5
endif//Trailing maximun
traildn=min(low,traildn)
if traildn=low then
traildnx=n
else
traildnx=traildnx
endif
//——————————————————————————–//
//—–Pivot High BOS/CHoCH——————————————————-//
bullConcordant=1
if ifilterConfluence then
bullConcordant=high-max(close,open)>min(close,open-low)
endif
//Detect internal bullish structure
if close crosses over itopy and itopcross and topy<>itopy and bullConcordant then
choch=undefined
if itrend<0 then
choch=1
bullichochalert=1
else
bullibosalert=1
endif
if showinternals then$itopx[m+1]=itopx
$itopy[m+1]=itopy
$ichoch[m+1]=choch
$iright[m+1]=barindex
m=m+1endif
itopcross=0
itrend=1//Internal order block
if showiOB then
minim=9999999999
maxim=0
idx=1
if obFilter=1 then
obthreshold=atr
else
obthreshold=cmeanRange
endiffor i=1 to (n-itopx)-1 do
if (high[i]-low[i])<obthreshold[i]*2 then
minim=min(low[i],minim)
if minim=low[i] then
maxim=high[i]
idx=i
else
maxim=maxim
idx=idx
endif
endif
next$itargetTop[t+1]=maxim
$itargetBot[t+1]=minim
$itargetLeft[t+1]=barindex[idx]
$itargetRight[t+1]=n
$itargetType[t+1]=1
t=t+1
endif
endif
//Detect bullish Structure
if close crosses over topy and topcross then
choch=undefined
if trend<0 then
choch=1
endifif showStructure then
$topx[g+1]=topx
$topy[g+1]=topy
$topchoch[g+1]=choch
$right[g+1]=barindex
g=g+1endif
//order block
if showOB then
minim=9999999999
maxim=0
idx=1
if obFilter=1 then
obthreshold=atr
else
obthreshold=cmeanRange
endiffor i=1 to (n-topx)-1 do
if (high[i]-low[i])<obthreshold[i]*2 then
minim=min(low[i],minim)
if minim=low[i] then
maxim=high[i]
idx=i
else
maxim=maxim
idx=idx
endif
endif
next$targetTop[r+1]=maxim
$targetBot[r+1]=minim
$targetLeft[r+1]=barindex[idx]
$targetRight[r+1]=n
$targetType[r+1]=1
r=r+1
endiftopcross=0
trend=1
endif
//——————————————————————————–//
//—–Pivot Low BOS/CHoCH——————————————————–//
bearConcordant=1
if ifilterConfluence then
bearConcordant=high-max(close,open)<min(close,open-low)
endif
//Detect internal bearish Structure
if close crosses under iboty and ibotcross and boty<>iboty and bearConcordant then
choch=0
if itrend>0 then
choch=1
bearichochalert=1
else
bearichochalert=1
endif
if showinternals then$ibotx[s+1]=ibotx
$iboty[s+1]=iboty
$ibotchoch[s+1]=choch
$ibotright[s+1]=barindex
s=s+1endif
ibotcross=0
itrend=-1//Internal order block
if showiOB then
minim=9999999999
maxim=0
idx=1
if obFilter=1 then
obthreshold=atr
else
obthreshold=cmeanRange
endiffor i=1 to (n-ibotx)-1 do
if (high[i]-low[i])<obthreshold[i]*2 then
maxim=max(high[i],maxim)
if maxim=high[i] then
minim=low[i]
idx=i
else
minim=minim
idx=idx
endif
endif
next$itargetTop[t+1]=maxim
$itargetBot[t+1]=minim
$itargetLeft[t+1]=barindex[idx]
$itargetRight[t+1]=n
$itargetType[t+1]=-1
t=t+1
endif
endif
//Detect Bullish Strcuture
if close crosses under boty and botcross then
choch=undefined
if trend>0 then
choch=1
bearchochalert=1
else
bearbosalert=1
endifif showStructure then
$botx[w+1]=botx
$boty[w+1]=boty
$botchoch[w+1]=choch
$botright[w+1]=barindex
w=w+1endif
//order block
if showOB then
minim=9999999999
maxim=0
idx=1
if obFilter=1 then
obthreshold=atr
else
obthreshold=cmeanRange
endiffor i=1 to (n-botx)-1 do
if (high[i]-low[i])<obthreshold[i]*2 then
maxim=max(high[i],maxim)
if maxim=high[i] then
minim=low[i]
idx=i
else
minim=minim
idx=idx
endif
endif
next$targetTop[r+1]=maxim
$targetBot[r+1]=minim
$targetLeft[r+1]=barindex[idx]
$targetRight[r+1]=n
$targetType[r+1]=-1
r=r+1
endifbotcross=0
trend=-1
endif
//——————————————————————————–//
//—–Order Blocks—————————————————————//
//——————————————————————————–//
//Delete internal Order Blocks
for j=t downto 0 do
if close < $itargetBot[j] and $itargetType[j]=1 then
$itargetTop[j]=0
$itargetBot[j]=0
$itargetLeft[j]=0
$itargetRight[j]=0
$itargetType[j]=undefined
elsif close > $itargetTop[j] and $itargetType[j]=-1 then
$itargetTop[j]=0
$itargetBot[j]=0
$itargetLeft[j]=0
$itargetRight[j]=0
$itargetType[j]=0
endif
next
//Delete structural Order Blocks
for j=r downto 0 do
if close < $targetBot[j] and $targetType[j]=1 then
$targetTop[j]=0
$targetBot[j]=0
$targetLeft[j]=0
$targetRight[j]=0
$targetType[j]=undefined
elsif close > $targetTop[j] and $targetType[j]=-1 then
$targetTop[j]=0
$targetBot[j]=0
$targetLeft[j]=0
$targetRight[j]=0
$targetType[j]=0
endif
next
//Plot Order Blocks if not broken
countiOB=0
countOB=0
if islastbarupdate then
//—Internal Order Blocks
for i=t downto 0 do
if $itargetBot[i]=0 then
countiOB=countiOB
else
countiOB=countiOB+1
if countiOB = showlastOB then
break
else
if close > $itargetTop[i] then
drawrectangle($itargetLeft[i],$itargetBot[i],n+20,$itargetTop[i])coloured(“blue”,0)fillcolor(“blue”,50)
elsif close <$itargetBot[i] then
drawrectangle($itargetLeft[i],$itargetBot[i],n+20,$itargetTop[i])coloured(“red”,0)fillcolor(“red”,50)
else
drawrectangle($itargetLeft[i],$itargetBot[i],n+20,$itargetTop[i])coloured(“yellow”,0)fillcolor(“yellow”,50)
endif
endif
endif
next
//—Structural Order Blocks
for i=r downto 0 do
if $targetBot[i]=0 then
countOB=countOB
else
countOB=countOB+1
if countOB = showlastOB then
break
else
if close > $targetTop[i] then
drawrectangle($targetLeft[i],$targetBot[i],n+20,$targetTop[i])coloured(“blue”,0)fillcolor(“blue”,100)
elsif close <$targetBot[i] then
drawrectangle($targetLeft[i],$targetBot[i],n+20,$targetTop[i])coloured(“red”,0)fillcolor(“red”,100)
else
drawrectangle($targetLeft[i],$targetBot[i],n+20,$targetTop[i])coloured(“yellow”,0)fillcolor(“yellow”,100)
endif
endif
endif
next
//—————————————————————————–//
//——Draw Pivot Points——————————————————//
//—————————————————————————–//
//—Pivot High
for i=z downto 0 do
if $phtype[i]=1 then
drawtext(“HH”,$phx[i],$phy[i]+atr*0.5)coloured(“black”)
else
drawtext(“LH”,$phx[i],$phy[i]+atr*0.5)coloured(“black”)
endif
next
//—Pivot Low
for i=k downto 0 do
if $pltype[i]=1 then
drawtext(“LL”,$plx[i],$ply[i]-atr*0.5)coloured(“black”)
else
drawtext(“HL”,$plx[i],$ply[i]-atr*0.5)coloured(“black”)
endif
next
//—————————————————————————–//
//——Draw Internal Structure————————————————//
//—————————————————————————–//
for i=m downto 0 do
drawsegment($itopx[i],$itopy[i],$iright[i],$itopy[i])style(dottedline)coloured(“green”)
if $ichoch[i]=1 then
drawtext(“CHoCH”,($itopx[i]+$iright[i])/2,$itopy[i]+0.25*atr)coloured(“green”)
else
drawtext(“BOS”,($itopx[i]+$iright[i])/2,$itopy[i]+0.25*atr)coloured(“green”)
endif
next
//—————————————————————————–//
for i=s downto 0 do
drawsegment($ibotx[i],$iboty[i],$ibotright[i],$iboty[i])style(dottedline)coloured(“red”)
if $ibotchoch[i]=1 then
drawtext(“CHoCH”,($ibotx[i]+$ibotright[i])/2,$iboty[i]-0.25*atr)coloured(“red”)
else
drawtext(“BOS”,($ibotx[i]+$ibotright[i])/2,$iboty[i]-0.25*atr)coloured(“red”)
endif
next
//—————————————————————————–//
//——Draw Structure———————————————————//
//—————————————————————————–//
for i=g downto 0 do
drawsegment($topx[i],$topy[i],$right[i],$topy[i])style(line)coloured(“green”)
if $topchoch[i]=1 then
drawtext(“CHoCH”,($topx[i]+$right[i])/2,$topy[i]+0.25*atr)coloured(“green”)
else
drawtext(“BOS”,($topx[i]+$right[i])/2,$topy[i]+0.25*atr)coloured(“green”)
endif
next
//—————————————————————————–//
for i=w downto 0 do
drawsegment($botx[i],$boty[i],$botright[i],$boty[i])style(line)coloured(“red”)
if $botchoch[i]=1 then
drawtext(“CHoCH”,($botx[i]+$botright[i])/2,$boty[i]+0.25*atr)coloured(“red”)
else
drawtext(“BOS”,($botx[i]+$botright[i])/2,$boty[i]+0.25*atr)coloured(“red”)
endif
next
//—————————————————————————–//
//—–Top and Bottom extension————————————————//
//—————————————————————————–//
if showhlswings then
drawsegment(traildnx,traildn,n+20,traildn)coloured(“black”)
drawsegment(trailupx,trailup,n+20,trailup)coloured(“black”)
if trend>0 then
drawtext(“Strong Low”,(traildnx+n+20)/2,traildn-0.35*atr)coloured(“black”)
drawtext(“Weak High”,(trailupx+n+20)/2,trailup+0.35*atr)coloured(“black”)
else
drawtext(“Weak Low”,(traildnx+n+20)/2,traildn-0.35*atr)coloured(“black”)
drawtext(“Strong High”,(trailupx+n+20)/2,trailup+0.35*atr)coloured(“black”)
endif
endif
endif
//——————————————————————————–//
return03/04/2025 at 1:19 PM #244629Hola de nuevo, quería hacer un inciso en mi propuesta, con que el proScreener avisara cuando un bloque se pusiera de color amarillo (es decir que el precio entrara en dicho bloque ya sea alcista o bajista) me vendría bien, porque lo menos importante es como en ese momento se forme la vela, pues ya estaría alerta de la situación y vería como termina la vela en cuestión al final del día, gracias por la atención.
03/04/2025 at 5:29 PM #244646Buenas. Aquí tendrías un primer screener.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351//--------------------------------------------------------------------------------////PRC_Smart Money Concepts//version = 1//29.07.2024//Iván González @ www.prorealcode.com//Sharing ProRealTime knowledge//--------------------------------------------------------------------------------////-----Inputs---------------------------------------------------------------------//n=barindexshowOB=1showiOB=1showlastOB=5ifilterConfluence=0obFilter=1 //1=ATR 0=Cumulative mean Rangelength=50//--------------------------------------------------------------------------------////--------------------------------------------------------------------------------//atr=averagetruerange[200](close)cmeanrange=summation[max(1,n)](high-low)/n//--------------------------------------------------------------------------------////-----Swings---------------------------------------------------------------------////---Swing lengthos=0upper=highest[length](high)lower=lowest[length](low)if high[length]>upper thenos=0elsif low[length]<lower thenos=1elseos=os[1]endifif os=0 and os[1]<>0 thenmytop=high[length]elsemytop=0endifif os=1 and os[1]<>1 thenmybot=low[length]elsemybot=0endif//---Swing 5os1=0upper1=highest[5](high)lower1=lowest[5](low)if high[5]>upper1 thenos1=0elsif low[5]<lower1 thenos1=1elseos1=os1[1]endifif os1=0 and os1[1]<>0 thenitop=high[5]elseitop=0endifif os1=1 and os1[1]<>1 thenibot=low[5]elseibot=0endif//--------------------------------------------------------------------------------////-----Pivot High-----------------------------------------------------------------//if mytop thentopcross=1topy=mytoptopx=n-lengthendifif itop thenitopcross=1itopy=itopitopx=n-5endif//--------------------------------------------------------------------------------////-----Pivot Low------------------------------------------------------------------//if mybot thenbotcross=1boty=mybotbotx=n-lengthendifif ibot thenibotcross=1iboty=ibotibotx=n-5endif//--------------------------------------------------------------------------------////-----Pivot High BOS/CHoCH-------------------------------------------------------//bullConcordant=1if ifilterConfluence thenbullConcordant=high-max(close,open)>min(close,open-low)endif//Detect internal bullish structureif close crosses over itopy and itopcross and topy<>itopy and bullConcordant thenitopcross=0//itrend=1//Internal order blockif showiOB thenminim=9999999999maxim=0idx=1if obFilter=1 thenobthreshold=atrelseobthreshold=cmeanRangeendiffor i=1 to (n-itopx)-1 doif (high[i]-low[i])<obthreshold[i]*2 thenminim=min(low[i],minim)if minim=low[i] thenmaxim=high[i]idx=ielsemaxim=maximidx=idxendifendifnext$itargetTop[t+1]=maxim$itargetBot[t+1]=minim$itargetLeft[t+1]=barindex[idx]$itargetRight[t+1]=n$itargetType[t+1]=1t=t+1endifendif//Detect bullish Structureif close crosses over topy and topcross then//order blockif showOB thenminim=9999999999maxim=0idx=1if obFilter=1 thenobthreshold=atrelseobthreshold=cmeanRangeendiffor i=1 to (n-topx)-1 doif (high[i]-low[i])<obthreshold[i]*2 thenminim=min(low[i],minim)if minim=low[i] thenmaxim=high[i]idx=ielsemaxim=maximidx=idxendifendifnext$targetTop[r+1]=maxim$targetBot[r+1]=minim$targetLeft[r+1]=barindex[idx]$targetRight[r+1]=n$targetType[r+1]=1r=r+1endiftopcross=0//trend=1endif//--------------------------------------------------------------------------------////-----Pivot Low BOS/CHoCH--------------------------------------------------------//bearConcordant=1if ifilterConfluence thenbearConcordant=high-max(close,open)<min(close,open-low)endif//Detect internal bearish Structureif close crosses under iboty and ibotcross and boty<>iboty and bearConcordant thenibotcross=0//itrend=-1//Internal order blockif showiOB thenminim=9999999999maxim=0idx=1if obFilter=1 thenobthreshold=atrelseobthreshold=cmeanRangeendiffor i=1 to (n-ibotx)-1 doif (high[i]-low[i])<obthreshold[i]*2 thenmaxim=max(high[i],maxim)if maxim=high[i] thenminim=low[i]idx=ielseminim=minimidx=idxendifendifnext$itargetTop[t+1]=maxim$itargetBot[t+1]=minim$itargetLeft[t+1]=barindex[idx]$itargetRight[t+1]=n$itargetType[t+1]=-1t=t+1endifendif//Detect Bullish Structureif close crosses under boty and botcross then//order blockif showOB thenminim=9999999999maxim=0idx=1if obFilter=1 thenobthreshold=atrelseobthreshold=cmeanRangeendiffor i=1 to (n-botx)-1 doif (high[i]-low[i])<obthreshold[i]*2 thenmaxim=max(high[i],maxim)if maxim=high[i] thenminim=low[i]idx=ielseminim=minimidx=idxendifendifnext$targetTop[r+1]=maxim$targetBot[r+1]=minim$targetLeft[r+1]=barindex[idx]$targetRight[r+1]=n$targetType[r+1]=-1r=r+1endifbotcross=0//trend=-1endif//--------------------------------------------------------------------------------////-----Order Blocks---------------------------------------------------------------////--------------------------------------------------------------------------------////Delete internal Order Blocksfor j=t downto 0 doif close < $itargetBot[j] and $itargetType[j]=1 then$itargetTop[j]=0$itargetBot[j]=0$itargetLeft[j]=0$itargetRight[j]=0$itargetType[j]=undefinedelsif close > $itargetTop[j] and $itargetType[j]=-1 then$itargetTop[j]=0$itargetBot[j]=0$itargetLeft[j]=0$itargetRight[j]=0$itargetType[j]=0endifnext//Delete structural Order Blocksfor j=r downto 0 doif close < $targetBot[j] and $targetType[j]=1 then$targetTop[j]=0$targetBot[j]=0$targetLeft[j]=0$targetRight[j]=0$targetType[j]=undefinedelsif close > $targetTop[j] and $targetType[j]=-1 then$targetTop[j]=0$targetBot[j]=0$targetLeft[j]=0$targetRight[j]=0$targetType[j]=0endifnext//Plot Order Blocks if not brokencountiOB=0countOB=0ipriceonblock=0priceonblock=0if islastbarupdate then//---Internal Order Blocksfor i=t downto 0 doif $itargetBot[i]=0 thencountiOB=countiOBelsecountiOB=countiOB+1if countiOB = showlastOB thenbreakelseif close > $itargetTop[i] thenipriceonblock=0elsif close <$itargetBot[i] thenipriceonblock=0elseipriceonblock=1endifendifendifnext//---Structural Order Blocksfor i=r downto 0 doif $targetBot[i]=0 thencountOB=countOBelsecountOB=countOB+1if countOB = showlastOB thenbreakelseif close > $targetTop[i] thenpriceonblock=0elsif close <$targetBot[i] thenpriceonblock=0elsepriceonblock=1endifendifendifnextendifscreener[priceonblock=1 or ipriceonblock=1](priceonblock as "o",ipriceonblock as "i")2 users thanked author for this post.
03/04/2025 at 8:02 PM #244652Hola Iván, te agradezco tu esfuerzo por hacer el trabajo, pero cuando hago la búsqueda no me da el resultado previsto, me salen 11 valores de los cuáles solo 1 tiene la condición que pedí, que es que el precio se encuentre dentro de una zona de soporte o resistencia (color amarillo), no sé si hay algo que se pasó y no da el fruto previsto, saludos
03/11/2025 at 4:14 PM #244836Hola Iván, por problemas personales no he podido entrar en el foro hasta ahora, cuando escribí el post de más arriba no estaba con el tiempo real y puede que por ello me diera fallo. Hoy sí que estoy con tiempo real y me va mejor, me salen 4 acciones que cumplen con la condición de que el precio se encuentre en un bloque de color amarillo, no obstante echando un vistazo a los gráficos veo que hay otros 2 valores que se encuentran en un bloque amarillo y no me salen en el Proscreener, la razón no la sé, de todas maneras, gracias por todo.
03/12/2025 at 11:27 AM #244864Buenas. El problema también puede estar en el ATR.
Los screeners tienen la limitación de 256 barras (versión completa) y 1024 barras (version premium). El problema es que para calcular un ATR de 200 periodos necesitas más barras todavía ya que el cáclulo del ATR llea implícito una media de Wilder que necesita 10 veces más velas de los periodos del ATR.
Así que si el ATR o cualquier otro indicador necesita más velas para el cálculo, el screener no dará buenos resultados. -
AuthorPosts
Find exclusive trading pro-tools on