LRLR Pine to Proreal

Forums ProRealTime English forum ProBuilder support LRLR Pine to Proreal

Viewing 3 posts - 1 through 3 (of 3 total)
  • #243534
    Hello! I made this indicator to replicate when we have low resistance liquidity runs- basically diagonal support and resistance. It does not show diagonal lines, but it shows a line in a separate window, which after 1h of staying bellow or above the zero line writes ‘LRLR’. You can see how it looks on the picture. Thank You in advance!!

    //@version=5
    strategy(“LRLR”, overlay=false, initial_capital=10000, default_qty_type=strategy.percent_of_equity, default_qty_value=100, commission_type=strategy.commission.percent, commission_value=0.0)
    src = input(ohlc4, title=”source”)
    // definition of “Jurik Moving Average”, by Everget
    jma(_src,_length,_phase,_power) =>
        phaseRatio = _phase < -100 ? 0.5 : _phase > 100 ? 2.5 : _phase / 100 + 1.5
        beta = 0.45 * (_length – 1) / (0.45 * (_length – 1) + 2)
        alpha = math.pow(beta, _power)
        var float jma = 0.0
        var float e0 = 0.0
        var float e1 = 0.0
        var float e2 = 0.0
        e0 := (1 – alpha) * _src + alpha * nz(e0[1])
        e1 := (_src – e0) * (1 – beta) + beta * nz(e1[1])
        e2 := (e0 + phaseRatio * e1 – nz(jma[1])) * math.pow(1 – alpha, 2) + math.pow(alpha, 2) * nz(e2[1])
        jma := e2 + nz(jma[1])
        jma
    //// //// Determine Angle by KyJ //// ////
    angle(_src) =>
        rad2degree = 180/3.14159265359  //pi
        rad2degree * math.atan((_src[0] – _src[1])/ta.atr(14))
    jma_line = jma(src,10,50,1)
    ma = ta.ema(src,input.int(56))
    jma_slope = angle(jma_line)
    ma_slope = angle(ma)
    ///////////// Rate Of Change /////////////
    source = close
    roclength = input.int(12, minval=1)
    pcntChange = input.int(2, minval=1)
    roc = 100 * (source – source[roclength]) / source[roclength]
    emaroc = ta.ema(roc, roclength / 2)
    isMoving() => emaroc > (pcntChange / 2) or emaroc < (0 – (pcntChange / 2))
    ///////////// LRLR Detection /////////////
    var int bars_per_hour = 0
    var bool valid_timeframe = false
    // Određivanje broja svećica po satu samo za dozvoljene timeframe-ove
    if timeframe.period == “1”
        bars_per_hour := 60
        valid_timeframe := true
    else if timeframe.period == “3”
        bars_per_hour := 20
        valid_timeframe := true
    else if timeframe.period == “5”
        bars_per_hour := 12
        valid_timeframe := true
    else if timeframe.period == “15”
        bars_per_hour := 4
        valid_timeframe := true
    else if timeframe.period == “30”
        bars_per_hour := 2
        valid_timeframe := true
    // Detekcija promene boje (prelaska iznad/ispod 0)
    changed_above = ma_slope >= 0 and ma_slope[1] < 0
    changed_below = ma_slope <= 0 and ma_slope[1] > 0
    // Brojanje svećica od promene
    var int count_since_change = 0
    count_since_change := changed_above or changed_below ? 0 : count_since_change + 1
    // Praćenje trenutnog stanja (iznad/ispod 0)
    var bool is_above = false
    is_above := changed_above ? true : changed_below ? false : is_above
    // LRLR signali – prikazuju se SAMO kada se navrši tačno 1h
    show_above_lrlr = valid_timeframe and is_above and count_since_change == bars_per_hour
    show_below_lrlr = valid_timeframe and not is_above and count_since_change == bars_per_hour
    ///////////// Plotting /////////////
    hline(0, title=’Zero line’, color=color.white, linewidth=1)
    plot(ma_slope, title=”ma slope”, linewidth=2, color=ma_slope>=0?color.lime:color.red)
    // LRLR Labels
    if show_above_lrlr
        label.new(bar_index, ma_slope, text=”LRLR”, color=color.lime, style=label.style_label_down, textcolor=color.white)
    if show_below_lrlr
        label.new(bar_index, ma_slope, text=”LRLR”, color=color.red, style=label.style_label_up, textcolor=color.white)
    #243564

    Here it is:

    1 user thanked author for this post.
    #243567

    Thank you very much! <3

Viewing 3 posts - 1 through 3 (of 3 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login