Traduzione codice TW Bill Williams divergent bars

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #245725 quote
    Msport71
    Participant
    Junior

    Buongiorno,

     

    gradirei testare  questo indicatore  che pur stand alone , viene utilizzato in abbinamento all’indicatore Alligator sempre di Williams (presente nella libreria PRT).

    Grazie per il consueto aiuto.

     

    https://it.tradingview.com/script/lLgCdjag-Bill-Williams-Divergent-Bars/

     

    // Bill William Bull/Bear divergent bars
    // See: Book, Trading Chaos by Bill Williams
    //
    // Coded by polyclick
    //
    // A bullish (green) divergent bar, signals a trend switch from bear -> bull
    // -> The current bar has a lower low than the previous bar, but closes in the upper half of the candle.
    // -> This means the bulls are pushing from below and are trying to take over, potentially resulting in a trend switch to bullish.
    // -> We also check if this bar is below the three alligator lines to avoid false positives.
    //
    // A bearish (red) divergent bar, signals a trend switch from bull -> bear
    // -> The current bar has a higher high than the previous bar, but closes in the lower half of the candle.
    // -> This means the bears are pushing the price down and are taking over, potentially resulting in a trend switch to bearish.
    // -> We also check if this bar is above the three alligator lines to avoid false positives.
    //
    // Best used in combination with the Bill Williams Alligator indicator.
    //
    study(title=”Divergent Bars”)

    // utility function for smoothed average
    smma(src, length) =>
    smma = na(smma[1]) ? sma(src, length) : (smma[1] * (length – 1) + src) / length
    smma

    // teeth (bill w red line)
    lips = smma(hl2, 5)[3]
    teeth = smma(hl2, 8)[5]
    jaw = smma(hl2, 13)[8]

    // signals
    bullDivSignal = low < low[1] and close > hl2 and high < lips and high < teeth and high < jaw
    bearDivSignal = high > high[1] and close < hl2 and low > lips and low > teeth and low > jaw

    // plot
    plot(bullDivSignal, title=”Bullish divergent bars”, style=histogram, linewidth=3, color=green)
    plot(bearDivSignal, title=”Bearish divergent bars”, style=histogram, linewidth=3, color=red)

    #245732 quote
    Iván González
    Moderator
    Master
    //----------------------------------------------//
    //PRC_Bill Williams Divergent Bars
    //version = 0
    //08.04.2025
    //Iván González @ www.prorealcode.com
    //Sharing ProRealTime knowledge
    //----------------------------------------------//
    // Inputs
    //----------------------------------------------//
    src=(high+low)/2
    lengthLips=5
    lengthTeeth=8
    lengthJaw=13
    //----------------------------------------------//
    // Teeth (Bill Williams Red line)
    //----------------------------------------------//
    // Smma
    if barindex<=max(lengthLips,max(lengthTeeth,lengthJaw)) then
    Smmalips=average[lengthLips](src)
    SmmaTeeth=average[lengthTeeth](src)
    SmmaJaw=average[lengthJaw](src)
    else
    Smmalips=(Smmalips[1]*(lengthLips-1)+src)/lengthLips
    SmmaTeeth=(SmmaTeeth[1]*(lengthTeeth-1)+src)/lengthTeeth
    SmmaJaw=(SmmaJaw[1]*(lengthJaw-1)+src)/lengthJaw
    endif
    // Lips, teeth, Jaw
    lips=smmaLips[3]
    teeth=SmmaTeeth[5]
    jaw=SmmaJaw[8]
    //----------------------------------------------//
    // Signals
    //----------------------------------------------//
    bullDivSignal=low<low[1] and close>src and high<lips and high<teeth and high<jaw
    bearDivSignal=high>high[1] and close<src and low>lips and low>teeth and low>jaw
    //----------------------------------------------//
    return bullDivSignal style(histogram)coloured("green"), bearDivSignal style(histogram)coloured("red")
    Msport71 thanked this post
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.

Traduzione codice TW Bill Williams divergent bars


ProBuilder: Indicatori & Strumenti Personalizzati

New Reply
Author
author-avatar
Msport71 @carlo-pasca Participant
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by Iván González
10 months ago.

Topic Details
Forum: ProBuilder: Indicatori & Strumenti Personalizzati
Language: Italian
Started: 04/08/2025
Status: Active
Attachments: 1 files
Logo Logo
Loading...