Q-Trend is an multipurpose indicatorm that can be used for swing- and trend-trading equally on any timeframe (non-volatile markets are better for this thing).


  • Trend period – used to calculate trend line in the special moments(will explain below);
  • ATR Multiplier – changes sensitivity. The higher the multiplier = the more sensitive it is.
  • Also option to smooth source data (helps get cleaner signals, as always).

How to use?
Signals are given on the chart. Also ou can use trend line as S/R line.

The idea behind:

SRС = Source
TL = trend line;
MP = ATR multiplier;
TL = (highest of source P-bars back + lowest of source P-bars back) / 2
Epsilon = MP * ATR
I was thinking for a week about combining volatility and relation between highest and lowest price point. That why I called indicator Q-Trend = Quantitative Trend, as I was trying to think about price in a mathematical way.

Okay, time to go philosophical:
1) TL is shows good price trend, but as it is slow enough and not enough informative, we need add additional conditions to produce signals.
2) Okay, so what can we add as conditions? We need to take volatility into account, as it is crucial in the moments of market uncertainty. So let’s use ATR (Average True Range) somehow. My idea is that if SRC breaks TL + ATR, then it means that there will be upmove and we update our TL. Analogically for SRC breaking TL – ATR (breaks are crosses of TL +- ATR lines).
– if SRC breaks TL + ATR, it is a BUY signal and update of trend line;
– if SRC breaks TL – ATR, it is a SELL signal and update of trend line;

(description from original author: tarasenko_)

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. Ozons • 336 days ago #

    Bonjour Nicolas, merci pour le code

  2. NEOMKEY • 336 days ago #

    Hello everyone. Great job Nicolás, and any input is appreciated. But isn’t there a way for the entry arrow to be drawn on the closed candle and not on the previous candle?. Thank you very much again.

    • Nicolas • 335 days ago #

      Change any reference to barindex[1],m[1] with barindex[0],m[0]

  3. NEOMKEY • 335 days ago #

    Thank you very much Nicolás.

  4. T-rader • 324 days ago #

    Thanks for great indicator. Translated it to a algo. How come I can´t get the strongbut and strongsell to work?

    // —settings
    p = 200 //Trend period
    atrp = 14 //ATR Period
    mult = 1.0 //ATR Multiplier
    mode = 1 //Signal mode options = [1=”Type A”, 2=”Type B”]
    useemasmoother = 0 //Smooth source with EMA? 0=false ; 1=true
    srcemaperiod = 3 //EMA Smoother period
    colorbars = 0 //Color bars? 0=false ; 1=true
    signalsview = 1 //0 = trend inversion ; 1 = strong buy / strong sell only
    // — end of settings

    source = customclose

    // Calculations
    if useemasmoother then
    src = average[srcemaperiod,1](source)

    hh = highest[p](src) // Highest of src p-bars back;
    ll = lowest[p](src) // Lowest of src p-bars back.
    d = hh – ll

    if barindex>p then
    once m = (hh + ll) / 2 // Initial trend line;
    atr = AverageTrueRange[atrp][1] // ATR;
    epsilon = mult * atr // Epsilon is a mathematical variable used in many different theorems in order to simplify work with mathematical object. Here it used as sensitivity measure.

    if mode=2 then //type B
    changeup = src crosses over m+epsilon or src crosses under m+epsilon
    changedown = src crosses over m-epsilon or src crosses under m-epsilon
    changeup = src crosses over m+epsilon or src > m+epsilon
    changedown = src crosses under m-epsilon or src < m-epsilon

    sb = open < ll + d / 8 and open >= ll
    ss = open > hh – d / 8 and open <= hh
    strongbuy = sb or sb[1] or sb[2] or sb[3] or sb[4]
    strongsell = ss or ss[1] or ss[2] or ss[3] or ss[4]


    if (changeup or changedown) then
    if changeup then
    m=m + epsilon
    elsif changedown then
    m=m – epsilon

    if changeup then
    elsif changedown then

    if signalsview=1 then
    if strongbuy and ls<>1 then
    buy at market

    if strongsell and ls<>-1 then
    sell at market

    //if r<>r[1]and r>0 then
    //sell at market

    //if r<>r[1]and r=0 then
    //buy at market


    • Nicolas • 323 days ago #

      thanks for opening a specific topic in the ProOrder forum.

    • doo23559 • 214 days ago #

      Brother , It`s not work .
      I want to be auto trade based on the signals

  5. JC_Bywan • 311 days ago #

    Link to automatic strategy topic in forum: https://www.prorealcode.com/topic/strategy-based-on-q-trend/

  6. Gigi • 298 days ago #

    Bonjour, cet indicateur repeint il? Par avance, merci pour la réponse.

    • Nicolas • 296 days ago #

      Non, il n’y a pas d’indicateur qui repeint avec PRT.

  7. JADINVEST • 293 days ago #

    Hello everyone,
    Great work, thank you Nicolas for this indicator that I really appreciate.
    Would it be possible to create a sreener with the possibility of displaying weak and/or strong signals?
    a topic is already open : https://www.prorealcode.com/topic/creer-un-screener-base-sur-q-trend
    Thanks //

    edit: the screener is in the topic, thanks
    What about the strategy please: https://www.prorealcode.com/topic/strategy-based-on-q-trend

  8. lkiklkik • 292 days ago #

    merci ! semble très sympa couplé avec une MM.

  9. yassinoumas33 • 282 days ago #

    how to add this indicator to mt4 please

    • Nicolas • 280 days ago #

      You can’t, all codes shared here are to be used with ProRealTime trading platform: https://trading.prorealtime.com/en/

  10. Anthony2A • 201 days ago #

    Bjr, j ai des erreurs sur la ligne 69, 74, 78 et 80.
    sur drawcandle drawtext et endif.
    si quelqu un pourrait m aider svp

  11. Lucas0000 • 160 days ago #

    Hello, Congratulations on this programming, it seems incredible to me, I am new to this but I would like to know if you have this automated Q-trend indicator, I think it is proorder, that it makes the entries and exits automatically in the color change, and if not Do you have it, how could I get it?…
    Thank you.

  12. plbourse • 137 days ago #

    Hello, I am trying to use this singal (in fact I have converted it to an indicateur giving Bull/Bear phases, but I would like to have it more sensitive, i.e would accept a higher lagging time before the indicator changes from Bull to Bear (or changes from green to red in the original version) does anybody have a clue on which parameters I should act ?
    Thanks in advance

Register or


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

+4 more likes

Related users ' posts
Faisalx Hola Ivan. Thanks for your great job. I would appreciate if you have look at my request http...
roccafragius Thank you for all these useful information!! Very great job Ivan! THank you so much
geroniman Merci Ivan, super travail. On peut toujours compter sur toi pour apporter des innovations su...
Stenozar Ciao mi restituisce errore line 1; forse è perchè utilizzo la versione 11 ? in questo caso d...
Stenozar Ciao IVAN , mi da errore per la riga 49 "print tema low"; puoi suggerirmi la modifica da met...
Iván Avete provato a scaricare il file .itf?
Iván Allora crei un nuovo post. Lo aspetterò.
Stenozar Ciao Ivan, ho inserito il post con la richiesta di traduzione. Se puoi vedere, grazie!
Iván perfect!
kats Bonsoir, Pensez vous pouvoir répondre à ma question posée ci dessus? Ce serait vraiment tr...
Iván Bonjour L'ensemble de l'indicateur est alimenté à partir de la ligne 9 avec la définition d...
kats BONSOIR c bon merci j ai trouve ce weekend merci de votre reponse cdlt
Gaspare Ciao Ivan si puo' inserire una strategia su questo indicatore per ottimizzare le variabil...
2 months ago
Iván Si lo descargas e importas en tu PRT verás que se han creado las variables para luego config...
WhyAskOZ Hi, Ivan As always you are doing great coding. The code works on my PRT, however the issu...
Iván You can delete in the last line (return) the configuration for color. Delete coloured(xx,xx,...
P. Marlowe Quite an impressive work, Iván. Extremely useful and accurate. Congratulations. Keep it up¡
lkiklkik i love it !!! thanks.
Lean Me parece muy buen indicador, y se complementa muy bien en mi sistema, ¿podrías crear un scr...
Iván Gracias! Para el screener sólo tienes que copiar el indicador y poner como condición de búsq...
Lean Muchas gracias Iván, ya lo he podido crear.
Doddge Hola Iván, ¿sería posible crear un screener que indique cuándo las velas coloreadas del indi...
RTR Ivan thank you for the pro-screener. I a trying to understand how to write the signals from ...
Iván Hi, Lines 62 and 63. These lines define buy and sell conditions.
Iván Hi You should delete from the indicator code all drawing functions and all variables not us...
Iván I've created a screener to show [longcondition or shortcondition]
Chrisinobi Hallo Ivan, Danke das ist Perfekt !! Kannst du bitte in der Screener-Bibliothek die itf. hoc...
MaoRai54 Thanks, now it's OK. in your first code at line 15-16 it's missing.
Madrosat Hello Ivan Did you try a strategy with this indicator
Iván Hi. No I didn't. This is a code translation requested by an user a few days ago.
4 months ago
cjr30 Simplemente modifica las lineas 19 y 21 por las siguientes: drawtext("▲",barindex,low-0.1*a...
groelandes Gracias!!
WhyAskOZ i copied the code into strategy and it gives error on line 21 and 23. it says " Line 1: ...
4 months ago
Madrosat Hello Ivan You have interesting topics on indicators , smart supertrend, optimised trend t...
Iván Hi! thanks. All of these codes are translations requested in the forum. I've on mind to back...
Raspete01 Buenos días Iván, estoy intentando llevar el código eliminando los colores y pasando un Back...
5 months ago
ARLEQUIN49 Hello Ivan, Would it be possible to convert the code of this QQE MOD indicator which accomp...
ARLEQUIN49 here is the code: //@version=4 //By Glaz, Modified // study("QQE MOD") RSI_Period = i...
Iván Hi, Yes I can translate it but please, create a new topic for it.
Fgats quelques explications en Français ici : Some explanations in French here : https://www.p...
Nicolas Merci pour cette contribution, j'apprécie ! :)
Fgats Merci Nicolas pour ces encouragements et merci aussi pour le commentaire en Anglais accompa...
Alai-n I really like it when you develop ideas around price movement! I am much less a fan of all t...
elcortijoverde Muy buen trabajo.Intuitivo y claro.Gracias por tu dedicación y aportación.