LRLR Indicator

LRLR Indicator

Introduction

The LRLR indicator was originally presented by its creator Lukapex in a post where he described it as a tool to identify Low Resistance Liquidity Runs (LRLR) by detecting zones where the price remains above or below a reference line for at least one hour. Based on this logic, the indicator generates “LRLR” text signals directly on the chart.

In this article, we will explore the details of the indicator, highlight some interesting technical aspects of the code, and present an additional perspective: its use in detecting divergences with price, which can be a key function for many technical traders.

Indicator Inspiration

According to the author’s post, the primary purpose of the indicator is to replicate low-resistance areas. To achieve this, it uses the slope of a moving average and verifies whether this slope remains positive or negative for a defined period of time (one hour, in the original example), which then triggers the visual “LRLR” signal.

Beyond the utility described by its original creator, I would like to highlight another potential application of the indicator: detecting divergences between price and the slope of the moving average. This approach allows traders to identify zones where the market’s momentum and price behavior could be disconnected, which could signal potential reversals.

Technical Highlight: Variable Assignment Based on Timeframe

Although the indicator’s code is simple, I decided to create this article because it includes an interesting feature that could be useful for other indicators: the dynamic assignment of variable values based on the chart’s timeframe. The following code snippet demonstrates this concept:

This method automatically adjusts the number of bars per hour according to the chart’s timeframe, which simplifies the development of flexible and scalable indicators. Other programmers can use this technique when building indicators or strategies that need to adapt dynamically without manual intervention.

How the LRLR Indicator Works

The indicator combines the slope of a moving average with market volatility (measured using the Average True Range) to generate visual signals when trend changes are detected. Here’s a breakdown of the main steps:

  1. Calculating the moving average slope:
    The typical price (Open+High+Low+Close)/4 is averaged over a user-defined period (default is 56).
  2. Normalizing with the ATR:
    The difference between the current and previous moving average values is divided by the ATR to get a relative slope.
  3. Detecting slope changes:
    The indicator detects when the slope switches from negative to positive (bullish change) or from positive to negative (bearish change).
  4. Generating the “LRLR” signal:
    If the slope remains positive or negative for the required number of bars, the indicator draws the “LRLR” signal on the chart.

Interpreting the Indicator: Divergence Detection with Price

Although the author initially designed the LRLR indicator to identify dynamic support and resistance zones, I believe its true power lies in its ability to help detect divergences. Divergences occur when the price moves in one direction while the slope of the moving average indicates the opposite direction, signaling a potential loss of market momentum and a possible trend reversal.

  • Bearish divergence: Price continues to rise, but the moving average slope starts to decline.
  • Bullish divergence: Price continues to fall, but the slope of the moving average turns positive.

These signals works in all timeframes charts.

Conclusion

The LRLR indicator not only provides an effective tool for detecting trend changes, but it also opens new possibilities for technical analysis through divergence detection. Additionally, the dynamic variable assignment feature showcased in the code is an excellent example for developers looking to create adaptable and flexible indicators.

Share this

Risk disclosure:

No information on this site is investment advice or a solicitation to buy or sell any financial instrument. Past performance is not indicative of future results. Trading may expose you to risk of loss greater than your deposits and is only suitable for experienced investors who have sufficient financial means to bear such risk.

ProRealTime ITF files and other attachments : How to import ITF files into ProRealTime platform?

PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials

  1. roccafragius • 63 days ago #

    Thank you Ivan, very Useful! I would like translation of Trading View CCI_S Indicator, How I can ask you it? Thankk you in advance! Franco

  2. Iván • 62 days ago #

    hi, you can ask here: https://www.prorealcode.com/free-code-conversion/

avatar
Register or

Likes

avatar avatar avatar avatar avatar avatar
Related users ' posts
ottimo Thank you Nicolas, great indicator, N. 1
tikigai Merci Nicolas! First Happy new Year 2020. Very good indicator BUT (yes the french "oui, m...
Nicolas Whats prorealtime version? Did you try in version prior to v11? indicator's call and loop ca...
Nicolas Yes, that's how it goes when using loops..
JosephFelix Hi, Could I please have help with adding these indicators 'on price'? Every indicator that I...
Nicolas Just add it on price by clicking the wrench on the left upper side of the price chart.
leoulve Hello, I uploaded correctly the screener and it is not selecting any. Is it normal? cheers
Oliviertrader2020 Hello, where do you find the ZeroLagMACDWeek indicator? You only posted the mtf-macd-diverge...
MJZTrader Good morning! I was trying to tweek the code in the way as to set it for intraday (1 Min to ...
cfta Hi Fulvio, many thanks for sharing this clever indicator, much appreciated. As Pepsmile ment...
cfta Sorry adding the PRT to code didn't work in the above comment so I guess we will have to set...
juanj Something appears to be wrong with this formula as graphing t shows t to almost never be wit...
Nicolas Apply it on the price chart. The indicator plot just one single line. There are two in the...
jamesoc Hi Nicolas, do you happen to know if there is an indicator that can be applied to charts, to...
gustavobp Buenos dias Nicolas, al agregar tu indicador no me reconoce la variable Price ni en la linea...
tradingpro salve io faccio spread trading e volevo sapere come impostare un profitto da chiudere in a...
Nicolas Per favore non fare domande generali, non correlate al post. Usa invece il forum.
Bard Incredible, that is the clearest depiction of the trend I've ever seen Nicolas. (I just chan...
Appsoluxions Hi Nicolas, do you have the MT4 version of the indicator? I am not sure if these kind of que...
Nicolas Hi, don't have one sorry. But you can still ask for private coding through our programming s...
Appsoluxions Cool. Thanks for the response.
GUCCI ONE Bonjour, Nicolas. Pourriez-vous m'aider à transformer cet indicateur en screener, svp ? Merci
Nicolas disponible ici: https://www.prorealcode.com/topic/divergences-screener/
julien1978 hello to all, i recently discovered this indicator. would it be possible to add the detectio...
rama I want to use this indicator in trading system, it says zig zag is obsolete and not supported
Nicolas Right, due to its repainting behavior, the zigzag is not allowed in automated trading with r...
rama I noticed it changes as time progress, I am 7 as the average, how many period it wont chang...
Gordon101 Hi when I added your Guppy indicator to my chart it went below the chart beside the oscilla...
Nicolas Add it on the price by using the wrench located on the left upper side of your price chart.
Gordon101 Thanks Nicolas, worked a treat.
Rafa And the PriceMAPeriod? aren´t the same?
Nicolas The PriceMAPeriod is the period to make the average of all the last X medianprice found.
Rafa Thanks a lot Nicolás. Have a nice day
ak5hay2 Works like crazy on bitcoin. Use different timeframes. Thanks a lot Doc!!!
richyowen Hi, great code thanks. Very new to this forum. Is there a way to add a 100point target on an...
lisamitch50 Morning all, Just backtested on quite a few instruments, worked well on backtesting, but tel...
GenesisEX Thank you all for your contributions this is a great submission. Thanks for your inputs.
tino Bonjour nicolas. Je ne parviens pas à recopier le screener de l'indicateur. Auriez vous la g...
Nicolas Quel screener svp? C'est dans un des sujets du forum? Merci de fournir le lien.
MaoRai54 Hi, first of all Happy New Year. Well, I've inserted your indicator in DAX 1h but I cann...
Vinks_o_7 Hi Mao Happy New Year ! This is just an improved RSI where you plot a standard price momen...
Angel Perez Ciao Francesco. First of all thanks for the indicator and also fro the screener. I do have a...
PSIDIO Ciao to you all, I also have a question and would be very happy for a helpful comment. I a...
SpreadBetMH Hi there, I have V11.1. I get the Indicator but no Arrows on the price. Kind Regards...
Alai-n Ciao Francesco, sei ancora in giro?
Metodi97 This indicator is great but can someone create strategy based on the same indicator it will ...
Giuseppe68 ciao, ho provato l'indicatore e mi sembra interessante, ma in fase di backtest non riesco ad...
poldoposta veramente bello.....complimenti

Top