LRLR Pine to Proreal
Forums › ProRealTime English forum › ProBuilder support › LRLR Pine to Proreal
- This topic has 2 replies, 2 voices, and was last updated 2 weeks ago by
lukapex.
Viewing 3 posts - 1 through 3 (of 3 total)
-
-
02/06/2025 at 12:34 AM #243534Hello! 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=5strategy(“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 Evergetjma(_src,_length,_phase,_power) =>phaseRatio = _phase < -100 ? 0.5 : _phase > 100 ? 2.5 : _phase / 100 + 1.5beta = 0.45 * (_length – 1) / (0.45 * (_length – 1) + 2)alpha = math.pow(beta, _power)var float jma = 0.0var float e0 = 0.0var float e1 = 0.0var float e2 = 0.0e0 := (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 //pirad2degree * 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 = closeroclength = 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 = 0var bool valid_timeframe = false// Određivanje broja svećica po satu samo za dozvoljene timeframe-oveif timeframe.period == “1”bars_per_hour := 60valid_timeframe := trueelse if timeframe.period == “3”bars_per_hour := 20valid_timeframe := trueelse if timeframe.period == “5”bars_per_hour := 12valid_timeframe := trueelse if timeframe.period == “15”bars_per_hour := 4valid_timeframe := trueelse if timeframe.period == “30”bars_per_hour := 2valid_timeframe := true// Detekcija promene boje (prelaska iznad/ispod 0)changed_above = ma_slope >= 0 and ma_slope[1] < 0changed_below = ma_slope <= 0 and ma_slope[1] > 0// Brojanje svećica od promenevar int count_since_change = 0count_since_change := changed_above or changed_below ? 0 : count_since_change + 1// Praćenje trenutnog stanja (iznad/ispod 0)var bool is_above = falseis_above := changed_above ? true : changed_below ? false : is_above// LRLR signali – prikazuju se SAMO kada se navrši tačno 1hshow_above_lrlr = valid_timeframe and is_above and count_since_change == bars_per_hourshow_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 Labelsif show_above_lrlrlabel.new(bar_index, ma_slope, text=”LRLR”, color=color.lime, style=label.style_label_down, textcolor=color.white)if show_below_lrlrlabel.new(bar_index, ma_slope, text=”LRLR”, color=color.red, style=label.style_label_up, textcolor=color.white)02/06/2025 at 4:07 PM #243564
Here it is:
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768//-------------------------------------------////PRC_LRLR//version = 0//06.02.2025//Iván González @ www.prorealcode.com//Sharing ProRealTime knowledge//-------------------------------------------//// Inputs//-------------------------------------------//showLRLR=1//Bars per hourif gettimeframe=60 thenbarsPerHour=60elsif gettimeframe=180 thenbarsPerHour=20elsif gettimeframe=300 thenbarsPerHour=12elsif gettimeframe=600 thenbarsPerHour=6elsif gettimeframe=900 thenbarsPerHour=4elsif gettimeframe=1800 thenbarsPerHour=2elsebarsPerHour=undefinedshowLRLR=0endif//moving averageperiod=56src=(open+high+low+close)/4//-------------------------------------------//// Determine Angle//-------------------------------------------//atr=averagetruerange[14](close)ma=average[period,1](src)maSlope=atan((ma-ma[1])/atr)//-------------------------------------------//// LRLR Detection//-------------------------------------------//changedAbove=maSlope>=0 and maSlope[1]<0changedBelow=maSlope<=0 and maSlope[1]>0countSinceChange=barssince(changedAbove or changedBelow)if changedAbove thenisAbove=1isBelow=0r=0g=255b=0elsif changedBelow thenisAbove=0isBelow=1r=255g=0b=0endifif showLRLR and countSinceChange=barsPerHour thenif isAbove thendrawtext("LRLR",barindex,maSlope+0.2*maSlope)coloured(r,g,b)elsedrawtext("LRLR",barindex,maSlope-0.2*maSlope)coloured(r,g,b)endifendif//-------------------------------------------//return maSlope coloured(r,g,b)style(line,2),0 style(dottedline)1 user thanked author for this post.
02/06/2025 at 9:48 PM #243567 -
AuthorPosts
Viewing 3 posts - 1 through 3 (of 3 total)