Range Detector Indicator

Range Detector Indicator

Discovering Market Ranges with the Range Detector Indicator

The ability to accurately identify market ranges can provide a significant advantage when trading. Whether for strategies that benefit from market volatility or those that capitalize on periods of consolidation, understanding when and how these ranges form is crucial. The “Range Detector” emerges as an essential tool specifically designed to highlight these critical periods in a visual and accessible manner.

How the Range Detector Works

The mechanics behind the “Range Detector” are based on a clever combination of standard technical indicators and specific mathematical calculations. It uses the Average True Range (ATR), a well-established indicator that measures market volatility, along with a moving average of the closing price, to identify and visually mark price ranges on a chart.

The heart of the indicator lies in its ability to calculate the difference between the current closing price and a moving average, comparing it afterward with the ATR adjusted by a multiplicative factor. This approach allows the “Range Detector” to outline boxes that enclose periods where the price consolidates within a range defined by these parameters. When the closing price deviates significantly beyond the adjusted ATR, it is interpreted as a range expansion, triggering a change in the visual representation of the indicator.

Through this method, the “Range Detector” not only signals the presence of a consolidation range but also provides visual cues about price expansion, which may be a precursor to a significant market movement. The use of colors in the boxes drawn by the indicator offers a quick and clear interpretation: a box of a specific color can indicate consolidation, while a change to another color signals an expansion or range breakout.

Indicator Parameters

A distinctive feature of the “Range Detector” is its flexibility, granted by the possibility to adjust its parameters. This allows traders to adapt the indicator to different markets and trading styles. The adjustable parameters include:

length: Defines the minimum range length to detect. This parameter determines the number of bars used to calculate the moving average, allowing the trader to focus on longer or shorter duration ranges according to their strategy.

mult: Adjusts the width of the boxes in relation to the ATR, modifying the indicator’s sensitivity to market volatility. A larger multiplier expands the range needed for an expansion to be considered, while a smaller value makes it more sensitive to small movements.

atrLen: Determines the length of the ATR used for volatility calculation. This parameter directly influences how the indicator perceives volatility and, therefore, how it identifies consolidation ranges.

These parameters can be adjusted to refine range detection and improve the indicator’s congruence with current market conditions or the employed trading strategy.

Interpreting the Indicator

Interpreting the signals generated by the “Range Detector” is intuitive, offering a clear visualization of market consolidation and expansion periods.

Consolidation boxes: When the price remains within a range defined by the adjusted ATR, the indicator draws a box around this period. The presence of a box suggests that the market is in consolidation, which can be an indication of accumulation or distribution before a significant movement.

Color change in the boxes: A change in the color of the boxes indicates a transition from consolidation to range expansion or vice versa. This change can signal the start of a new trend or the breakout of a range, offering an opportunity to adjust positions or seek entries.

The “Range Detector” is particularly useful for identifying those critical moments where the market is about to make a decisive move, allowing traders to anticipate and react to possible breakouts or trend reversals.

Practical Applications of the Range Detector

The “Range Detector” is not only a technical analysis tool for identifying consolidation and expansion ranges but also provides a solid foundation upon which effective trading strategies can be built. Here are some practical applications.

Breakout trading: 

By identifying a consolidation period using the indicator’s boxes, traders can prepare to enter a position at the moment of the breakout. An expansion of the range, indicated by the color change in the boxes, may signal the optimal moment to execute a trade.

Trading within the range: 

In addition to preparing for breakouts, the “Range Detector” also offers the opportunity to trade the rebounds within a consolidated range. When the price touches one of the edges of the consolidation box, traders may consider opening a position in the direction of the opposite edge of the range, anticipating a possible turn.

Risk management:

The “Range Detector” can help set more precise stop-loss levels, placing them just outside the consolidation box. This reduces the likelihood of being prematurely stopped out in volatile markets.

Entry optimization: 

Traders can use the indicator to fine-tune their entry points, waiting for a confirmation of consolidation or expansion before committing to a position.

These are just some of the multiple ways in which the “Range Detector” can enrich any trader’s toolbox, offering a clear and reasoned perspective for making more informed trading decisions.

Indicator Code in ProBuilder

The “Range Detector” indicator is based on the analysis of market volatility and the detection of consolidation ranges. Below is the basic code outline in ProBuilder, ready to be customized and implemented in ProRealTime:

This code is a basis upon which adjustments can be made, such as modifying the parameters length, mult, and atrLen to suit different strategies and trading preferences.

Conclusion

The “Range Detector” indicator represents a powerful and versatile technical analysis tool, capable of providing significant insights into market dynamics. By integrating it into their trading strategy, traders can better leverage market opportunities, manage risk more effectively, and make trading decisions with greater confidence. Its flexibility and the visual clarity it offers make it a very interesting complement.

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. Yann LB • 356 days ago #

    Bonjour Ivan,

    Merci pour cet indicateur.
    Je l’ai importé en utilisant le fichier ITF, mais une erreur s’affiche lorsque je tente de l’ouvrir sur un graphique.
    Le message me dit que l’expression NEXT serait plus appropriée qu’un nom de variable et une une fois l’éditeur de code ouvert, le problème commence sur la ligne 85 (fillcolor est souligné).
    Merci par avance.

  2. Yann LB • 355 days ago #

    Bonjour,

    J’ai modifié le code ainsi:

    ligne 85 suppression de “”fillcolor($rbox[i],$gbox[i],$bbox[i],50)”
    ajout de la ligne 86 avec “colorbetween($boxbot[i],$boxtop[i],$rbox[i],$gbox[i],$bbox[i],50)”

    ligne 110 suppression de “fillcolor(r,g,b,50)”
    ajout de la ligne 111 avec “colorbetween($boxbot[x],$boxtop[x],r,g,b,50)”

    Est-ce qu’un programmeur confirmé pourrait me confirmer que c’est correct svp? Merci.

  3. Yann LB • 355 days ago #

    J’utilise le bouton “Insert PRT code”, mais j’ai du louper quelque chose car le résultat ressemble à un simple copié/collé.
    Pas grave!

  4. Maik2404 • 355 days ago #

    funktioniert nicht

    • Iván • 355 days ago #

      Hi!
      Just copy and paste in a new indicator. I’ve done an it works. Try with EURUSD, EURJPY, DOW, AAPL,… it works

  5. Yann LB • 354 days ago #

    Re,

    Message identique d’erreur même en faisant comme tu le suggères.
    Le problème pourrait-il venir de la version de PRT? J’utilise encore la V11.
    Merci.

    • Iván • 354 days ago #

      Yes… I think that’s the problem.

  6. Maik2404 • 354 days ago #

    was bedeutet rotes Kästchen und was bedeutet blaues Kästchen. hat die Farbe eine Bedeutung? Der Code funktioniert jetzt.

  7. Sofitech • 353 days ago #

    L’indicateur fonctionne très bien de mon côté et je le trouve très pertinent. @Iván je vais créer un post sur le forum. J’aimerais creuser la possibilité de créer une alerte basé sur les bandes hautes/basses.

  8. finplus • 351 days ago #

    Bonjour à tous,
    en regardant le graphe joint, cet indicateur a l’air intéressant : est-ce que certains l’utilisent et si oui sur quel time frame ? en outre, comme j’utilise déjà des couleurs en back-ground de mes graphes, comment changer la couleur de remplissage des boîtes (peut-être dans “color boxes” ?
    merci.

    • Iván • 351 days ago #

      Perfect!!

    • Iván • 351 days ago #

      Hi! You should change $rbox, $gbox and $bbox variables. Also r,g,b for last box.

    • finplus • 351 days ago #

      Thanks Ivan.

  9. roccafragius • 351 days ago #

    Ivan, I just want to say you.. very very great job!!!! Thank you so much for this indicator! Fantastic.

  10. larouedegann • 333 days ago #

    Bonjour ivan,
    J’utilise l’indicateur en UT 15 mn et je souhaite le dupliquer en UT 3mn ou 1 mn.
    J’

  11. larouedegann • 333 days ago #

    As tu une idée ?
    merci

  12. larouedegann • 333 days ago #

    TIMEFRAME(15minutes) apparemment ne fonctionne pas

    • Iván • 330 days ago #

      Bonjour
      Je ne comprends pas bien le problème. L’indicateur fonctionne dans n’importe quelle saisonnalité.

  13. larouedegann • 330 days ago #

    OUI je le sais, il fonctionne dans toutes les unités de temps. Mais je souhaite utiliser l’indicateur UT 15 mn en UT3mn ou UT1mn.
    Autrement dit je duplique l’indicateur 15mn grâce à TIMEFRAME(15minutes) mais celà ne fonctionne pas pour cet
    //————————————————————————//
    //PRC_Range Detector
    //version = 0
    //09.04.24
    //Iván González @ http://www.prorealcode.com
    //Sharing ProRealTime knowledge
    TIMEFRAME(15minutes)
    //————————————————————————//
    defparam drawonlastbaronly=true
    //—–Inputs————————————————————-//
    //length=20//Minimum Range Length
    //mult=1//Range Width
    //atrLen=500//ATR Length
    //————————————————————————//

    //—–Moving average and ATR definition———————————-//
    n=barindex
    atr=averagetruerange[atrlen](close)*mult
    ma=average[length,0](close)
    //—–Check range——————————————————–//
    indicateur

avatar
Register or

Likes

avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar

+3 more likes

Related users ' posts
WarningTrading Comment peut on la comparer ? comme ceci ? cela ne me donne plus le message d'erreur manque...
sally31120 Bonjour, je n'arrive pas à créer ce screener close > supertrend extended2[1] la réponse...
Nicolas voir ce sujet pour un screener basé sur Supertrend Extended: https://www.prorealcode.com/top...
JanWd Tried the code, nice concept, seems to work quit well for US/EUR 2hrs, Other markets seems n...
JR1976 Simple and nice code , congrats !!! Seems work well with TIme frame 1 h
phanz Hi all, Sorry revisiting an old post. This algo is simple, and simplicity is the ultimate ...
Jean-Pierre Poulain When I buy and when I sell ?
Nicolas The featured image of the post do not deserve the indicator you are right, I attached other ...
Nicolas It is described in the post already :) The BUY/SELL signals are quite similar of what you ca...
imokdesign Hi Everybody, when I look at the strategy I felt the need to implement a Moneymanagement-Sy...
Inertia newlevel then multiplier=multiplier+1 oldlevel=newlevel newlevel=strategyprofit+startequi...
Inertia Hi Bjoern, I was playing around with your code this morning (EUR/USD 5'). Thank you to the...
fabio407 Thanks, Nicolas. Very useful. Would you tell me where to find what result conveys the functi...
Nicolas This is not an instruction of the programming language but a variable from this indicator (l...
fabio407 OK. I didn't notice it. Many thanks, Nicolas!
albertocampagna Sei grande Nicolas :-)
SAcht Dear Nicolas, Great work, thank you very much!I would love to use the indicator in ProScree...
SAcht btw: The above-posted ProScreener is supposed to show stocks for which the center line has i...
Wilko And not only readable.... makes it much easier to iterate different entry/exit-conditions, d...
IGOSNELL Hi Interesting strategy, when I used $ M-R Dif EURUSD M15 Long if does not enter any positi...
ilvillans HI, I modified the system, from good results but from this error: Replace the variables wit...
victormork Hi, I would just like to share my own take on this strategy. I'm using 30 min on EURUSD but ...
mckubik Thanks. I will run a Test. 
poonsl2828 Hi! bjoern May i know what timing should i change for time zone (Singapore (GMT +8:00) ...
Nicolas si il n'y a pas de stoploss définit dans le code, alors c'est normal :)
bertrandpinoy bonjour merci pour la réponse. Oui b sur ... est il possible que le SL soit coder sous une a...
Nicolas ok mais pourquoi poser la question ici ? Pour des questions non spécifique à cette article, ...
julien1978 The ADR value that is plotted intraday does not match the value of the regular ATR indicator...
Fab666 I've tried to get a fix for this also but no luck, it doesn't print the correct data as far ...
Seabiscuit Hi! With the new PRT update, this indicator does not work anymore
Guibourse Hi ! I am asking once again for your help : would it be possible to use the ATR as a "take p...
Tradingrob Many thanks for the indicator, however if the price is below the indicator, then the indicat...
aldtrading Merci pour ton travail ! J'ai de bons résultats en utilisant cet indicateur
Nicolas Use the wrench of the price chart! Upper left of the window
Dymjohn The wrench shows options for the components of the indicator not how to show in the main cha...
Nicolas http://www.prorealcode.com/topic/overlapping-indicators/  
Doctrading Hello,  The strategy should be improved, no doubt. But it was just one of my ideas, which h...
ALEALE Yes Nicolas is very difficult, macro economic data can destroy any work!!  
styrke depends which.. I personally think that it's much more easier to trade on XBTUSD, try to co...
David Thanks for the explanation Nicolas.
freecat1899 Hello, I wanted to create a percent ADR based on this indicator, so I wrote this code that I...
revstrat At first glance, I see this mistake. You shouldn't average the highs and the lows. You shoul...
GraHal Ooops got that excited I sent that last one twice! ha (and can't delete it, sorry) I got it...
Eric n = 3  dont forget to allow 3 contract in proorder
UkCoopDownUnder Tried EURUSD GMT and GMT -1, as far back as I can go, Nov 2018 on 15mn Tf, 22% loss
Nicolas
9 years ago
trabucaire Hello, what does it mean the 20 and 40 number on this code ? Thank you !
robertogozzi I modified it to make parameters customizable and to Draw a Grey candlestick when a range is...
PeterClothier Hi, I downloaded this indicator and imported it. I tried adding it to a chart , and it hasn'...
Nicolas Don't add it on the price, so just don't use the price setting to add the indicator.

Top