Smart Money Concept

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #246905 quote
    NicoGB67
    Participant
    Junior

    Hola, me gustaría que pudieran hacer un Proscreener  del indicador Smart Money Concepts. Lo que me gustaría tener es que me avisara cuando hubiese un cambio de estructura con un ChoCH ya sea alcista o bajista, y que fuera el showStructure y no el showInternal (ya que en el indicador se dan ambos cambios de estructura pero le doy más importancia a la primera).

    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]
    endif

    if os=0 and os[1]<>0 then
    mytop=high[length]
    else
    mytop=0
    endif

    if 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]
    endif

    if os1=0 and os1[1]<>0 then
    itop=high[5]
    else
    itop=0
    endif

    if os1=1 and os1[1]<>1 then
    ibot=low[5]
    else
    ibot=0
    endif
    //——————————————————————————–//
    //—–Pivot High—————————————————————–//
    if mytop then
    topcross=1

    if 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
    endif

    topy=mytop
    topx=n-length

    trailup=mytop
    trailupx=n-length
    endif

    if itop then
    itopcross=1

    itopy=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=1

    if 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
    endif

    boty=mybot
    botx=n-length

    traildn=mybot
    traildnx=n-length
    endif

    if ibot then
    ibotcross=1

    iboty=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+1

    endif

    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
    endif

    for 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
    endif

    if showStructure then

    $topx[g+1]=topx
    $topy[g+1]=topy
    $topchoch[g+1]=choch
    $right[g+1]=barindex
    g=g+1

    endif
    //order block
    if showOB then
    minim=9999999999
    maxim=0
    idx=1
    if obFilter=1 then
    obthreshold=atr
    else
    obthreshold=cmeanRange
    endif

    for 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
    endif

    topcross=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+1

    endif

    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
    endif

    for 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
    endif

    if showStructure then

    $botx[w+1]=botx
    $boty[w+1]=boty
    $botchoch[w+1]=choch
    $botright[w+1]=barindex
    w=w+1

    endif
    //order block
    if showOB then
    minim=9999999999
    maxim=0
    idx=1
    if obFilter=1 then
    obthreshold=atr
    else
    obthreshold=cmeanRange
    endif

    for 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
    endif

    botcross=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(“brown”,0)fillcolor(“brown”,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(“brown”,0)fillcolor(“brown”,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(“white”)
    else
    drawtext(“LH”,$phx[i],$phy[i]+atr*0.5)coloured(“orange”)
    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(“orange”)
    else
    drawtext(“HL”,$plx[i],$ply[i]-atr*0.5)coloured(“white”)
    endif
    next
    //—————————————————————————–//
    //——Draw Internal Structure————————————————//
    //—————————————————————————–//
    for i=m downto 0 do
    drawsegment($itopx[i],$itopy[i],$iright[i],$itopy[i])style(dottedline)coloured(“white”)
    if $ichoch[i]=1 then
    drawtext(“CHoCH”,($itopx[i]+$iright[i])/2,$itopy[i]+0.25*atr)coloured(“white”)
    else
    drawtext(“BOS”,($itopx[i]+$iright[i])/2,$itopy[i]+0.25*atr)coloured(“white”)
    endif
    next
    //—————————————————————————–//
    for i=s downto 0 do
    drawsegment($ibotx[i],$iboty[i],$ibotright[i],$iboty[i])style(dottedline)coloured(“orange”)
    if $ibotchoch[i]=1 then
    drawtext(“CHoCH”,($ibotx[i]+$ibotright[i])/2,$iboty[i]-0.25*atr)coloured(“orange”)
    else
    drawtext(“BOS”,($ibotx[i]+$ibotright[i])/2,$iboty[i]-0.25*atr)coloured(“orange”)
    endif
    next
    //—————————————————————————–//
    //——Draw Structure———————————————————//
    //—————————————————————————–//
    for i=g downto 0 do
    drawsegment($topx[i],$topy[i],$right[i],$topy[i])style(line)coloured(“white”)
    if $topchoch[i]=1 then
    drawtext(“CHoCH”,($topx[i]+$right[i])/2,$topy[i]+0.25*atr)coloured(“white”)
    else
    drawtext(“BOS”,($topx[i]+$right[i])/2,$topy[i]+0.25*atr)coloured(“white”)
    endif
    next
    //—————————————————————————–//
    for i=w downto 0 do
    drawsegment($botx[i],$boty[i],$botright[i],$boty[i])style(line)coloured(“orange”)
    if $botchoch[i]=1 then
    drawtext(“CHoCH”,($botx[i]+$botright[i])/2,$boty[i]+0.25*atr)coloured(“orange”)
    else
    drawtext(“BOS”,($botx[i]+$botright[i])/2,$boty[i]+0.25*atr)coloured(“orange”)
    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
    //——————————————————————————–//
    return

    #246931 quote
    Iván González
    Moderator
    Master

    Aquí tienes. Sólo tienes que cambiar las líneas 11 y 12 para mostrar un tipo y otro (o ambos):

    //--------------------------------------------------------------------------------//
    //Screener_Smart Money Concepts
    //version = 1
    //29.07.2024
    //Iván González @ www.prorealcode.com
    //Sharing ProRealTime knowledge
    //--------------------------------------------------------------------------------//
    //-----Inputs---------------------------------------------------------------------//
    length=50
    
    showbull=3//1=all 2=bos 3=CHoCH
    showbear=3//1=all 2=bos 3=CHoCH
    
    //--------------------------------------------------------------------------------//
    //-----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]
    endif
    
    if os=0 and os[1]<>0 then
    mytop=high[length]
    else
    mytop=0
    endif
    
    if os=1 and os[1]<>1 then
    mybot=low[length]
    else
    mybot=0
    endif
    //--------------------------------------------------------------------------------//
    //-----Pivot High-----------------------------------------------------------------//
    if mytop then
    topcross=1
    topy=mytop
    endif
    //--------------------------------------------------------------------------------//
    //-----Pivot Low------------------------------------------------------------------//
    if mybot then
    botcross=1
    boty=mybot
    endif
    //Detect bullish Structure
    signalLong=0
    if close crosses over topy and topcross then
    choch=undefined
    if trend<0 then
    choch=1
    endif
    
    if showbull=1 or (showbull=2 and not choch) or (showbull=3 and choch) then
    signalLong=1
    endif
    
    topcross=0
    trend=1
    endif
    
    //Detect Bullish Strcuture
    signalshort=0
    if close crosses under boty and botcross then
    choch=undefined
    if trend>0 then
    choch=1
    endif
    
    if showbear=1 or (showbear=2 and not choch) or (showbear=3 and choch) then
    signalshort=1
    endif
    
    botcross=0
    trend=-1
    endif
    
    screener[signalLong or signalShort](signalLong as "long",signalShort as "short")
    
    NicoGB67 thanked this post
    #246940 quote
    NicoGB67
    Participant
    Junior

    Buenas, muchísimas gracias Iván, pedazo ProScreener has hecho, espero que me de buenas plusvalías y me acordaré (agradecerte) que sin tu trabajo no lo hubiera conseguido…

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.

Smart Money Concept


ProScreener: Buscadores de Mercado y Rastreo

New Reply
Author
author-avatar
NicoGB67 @nicogb67 Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by NicoGB67
9 months, 3 weeks ago.

Topic Details
Forum: ProScreener: Buscadores de Mercado y Rastreo
Language: Spanish
Started: 05/08/2025
Status: Active
Attachments: No files
Logo Logo
Loading...