Divergencia Bollinger %B

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #232400 quote
    Maricarmen
    Participant
    Average

    Buenas Tardes:

    Podrían adaptar este  MACD que facilito a continuación  a un screener  de  divergencia Bollinger %B.

    ///////////////////////////////////////////////////////////
    // MACD divergences on price
    //by Jose Callao
    // twitter @jose7674
    // attach this indicator to the chart
    N=40///N is the number of bars to look back for a divergence. Normal values are 20-40. Must be the same in both indicators
    //using any other indicator is as easy as changing the values
    miMACD = exponentialAverage[12](close) – exponentialAverage[26](close)
    Signal = 0
    IF (BarIndex > 10+1+N) THEN
    //we look for bearish divergences
    IF (miMACD[1]>miMACD AND miMACD[1]>miMACD[2]) THEN
    extremum2=miMACD[1]
    extremum1=highest[N](miMACD)
    preciomax2=close[1]
    preciomax=Highest[N](close)
    IF(extremum2<extremum1 AND preciomax2>preciomax[1]) THEN
    for i=1 to N
    if close[i]=preciomax[1] then
    //zz=i
    Signal = 2
    //drawsegment (barindex[1], close[1], barindex[zz], close[zz]) coloured(200,0,0)
    endif
    next
    endif
    endif
    //we look for bullish divergences
    IF (miMACD[1]<miMACD AND miMACD[1]<miMACD[2]) THEN
    extremum22=miMACD[1]
    extremum11=lowest[N](miMACD)
    preciomin2=close[1]
    preciomin=lowest[N](close)
    IF(extremum22>extremum11 AND preciomin2<preciomin[1]) THEN
    for i2=1 to N
    if close[i2]=preciomin[1] then
    //zz2=i2
    Signal = 1
    //drawsegment(barindex[1], close[1], barindex[zz2], close[zz2]) coloured(0,200,0)
    endif
    next
    endif
    endif
    endif
    SCREENER[Signal](Signal AS “1=↑, 2=↓”)

    Gracias,

    #232417 quote
    Iván González
    Moderator
    Master

    hola
    Aquí tienes

    N=40
    
    bollUp=BollingerUp[20](close)
    bollDw=BollingerDown[20](close)
    Pboll = (close-bolldw)/(bollUp-bollDw )*100
    
    Signal = 0
    IF (BarIndex > 10+1+N) THEN
     
    ///divergencia bajista
    IF (Pboll[1]>Pboll AND Pboll[1]>Pboll[2]) THEN
    extremum2=Pboll[1]
    extremum1=highest[N](Pboll)
     
    preciomax2=close[1]
    preciomax=Highest[N](close)
     
    IF(extremum2<extremum1 AND preciomax2>preciomax[1]) THEN
    for i=1 to N
    if Pboll[i]=extremum1 then
    signal=2
    endif
    next
     
    endif
    endif
     
    ///divergencia alcista
    IF (Pboll[1]<Pboll AND Pboll[1]<Pboll[2]) THEN
    extremum22=Pboll[1]
    extremum11=lowest[N](Pboll)
     
    preciomin2=close[1]
    preciomin=lowest[N](close)
     
    IF(extremum22>extremum11 AND preciomin2<preciomin[1]) THEN
    for i2=1 to N
    if Pboll[i2]=extremum11[1] then
    signal=1
    endif
    next
    ENDIF
     
    ENDIF
    endif
    screener[signal](Signal AS "1=↑, 2=↓")
    
    #232433 quote
    Maricarmen
    Participant
    Average

    Gracias por la contentación tan rapida, voy a probarlo.

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

Divergencia Bollinger %B


ProScreener: Buscadores de Mercado y Rastreo

New Reply
Author
author-avatar
Maricarmen @maricarmen Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by Maricarmen
1 year, 10 months ago.

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