Signal to noise ratio

Signal to noise ratio
This technical indicator is an attempt to find the good momentum of trend : is it actually trending or in a range market?

Interestingly, it follows that π is not only the ratio between the length of a circle to its diameter, it is also a constant rather appears in statistics and, oddly enough, in the relationship between the distance between a price oscillation and a straight line.

  • If the signal / noise ratio is less than or equal to 1/2 π, we will be in a trading range or range.
  • If the signal / noise ratio is greater than 1/2 π, we are in a trending market.

Code converted from the Metatrader4 version, by request on Spanish forums.

Description from website.

//PRC_SignalToNoiseRatio | indicator
//Nicolas @
//Sharing ProRealTime knowledge
//Converted from MT4 version

// --- parameter
MyLookBackShift = 14
// ---------------

MyClose = Close

LookBackShift = MyClose[MyLookBackShift]

AbsCh = Abs(MyClose - MyClose[1])
MyDistance = Abs(MyClose-LookBackShift)

MyB = 0
for y = 0 to MyLookBackShift + 1 do
 MyB = MyB + AbsCh[y]
MyWalk = MyB

MyDTWRatio = MyDistance/MyWalk

MyPiRatio = 1/3.14159265358979/2

Buf0 = MyDTWRatio
Buf1 = MyPiRatio

return Buf0 as "signal to noise ratio",Buf1 as "signal to noise level"
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?

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

  1. bolsatrilera • 123 days ago #

    Sin duda,esta es la conversión correcta.Le quedo eternamente agradecido Nicolas.

  2. bolsatrilera • 123 days ago #

    ¿Hay algún problema para hacerlo público también en un blog que tengo?Entiendo que es un código de libre acceso.Gracias por todo Nicolas.

    • Nicolas • 123 days ago #

      Mientras el código y los comentarios permanezcan intactos por supuesto. Un enlace a este post también será muy apreciado 🙂

  3. verdi55 • 122 days ago #

    Thanks a lot, this is something I had been looking for for quite a while. Are there any other indicators on this site that can be used to decide whether the market is in a sideward range or trending ? I know the ADX and the RAVI for example. Anything else ? 

    • Nicolas • 122 days ago #

      You can also use the choppiness index,  which is also an oscillator made to detect ranging market :

  4. sanjivmodi • 62 days ago #

    Respected sir, I would be grateful if you could send me signal to ratio indicator for Amibroker. Thanking you in advance. Regards Sanjiv modi

Register or


avatar avatar avatar avatar avatar
Related users ' posts
13 hours ago
DeMarker Indicator
DeMarker Indicator
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...
Andy 22 DRAWSEGMENT(BarBullNew, highest[(BarBullnew-BarBullOld)](close), BarBullNew+10, highest[(...
gabri Ok, I believe your version of PRT doesn't support the command drawsegment. You should check ...
Andy ok thanks!
albertocampagna Salve, bellissimo indicatore, ma purtroppo non riesco a farlo funzionare
Nicolas Another fine piece of code gabri! Excellent work again. Thanks a lot for your precious contr...
gabri Thanks Nicolas!!
bolsatrilera bravo, molto intelligente.
1 week ago
Loop Hi All! Would it be possible to have the same indicator with the MACD calculated with the DE...
Nicolas Why not, but do you think it would make such a noticeable difference?
Loop Good question Nicolas! That's why I was curious to check it! MACD based on DEMA is usually m...
2 weeks ago
2 weeks ago
AleX ho provato anche per febbraio e la strategia ha il 75% di risultati positivi e quelli negati...
gabri  Codificare il CSI e' possibile. Io uso una sua modifica (siccome lavoro solo sull'azionario...
gabri Dopo Pasqua codifichero' anche un altra strategia che Wilder suggerisce di usare quando il m...
diegofe_2000 gracias , muy bueno
iramirez55 Bonjour, excusez mon français. Est-il possible de mettre les résultats des stratégies dans E...
Nicolas Please ask general purposes questions on forums. Thanks. 
Sofitech What is the timeframe(s) you woul suggest to use for this method ?On Forex and/or on stock m...
Doctrading Hello, Higher timeframes are better. I suggest D1 or H4.Best regards,
Nicolas It's a platform related problem currently being investigated. 
JohnVS okay thanks, Hopefully u had a chance to check the other question too? Since the stock hav...
Nicolas I'm pretty sure you can do it yourself John! Please don't be shy :)
supertiti amplitude 1.2.3  = ( 2-6-30 ) or (1-1-27) ?
LUCASSEN Hallo Supertiti Macd amplitude=1-1-27    and    prc halftrend triple in Heikin Ashi  grafie...
supertiti Thanks you so much Lucassen
3 weeks ago
Nicolas Ligne 44 à modifier par r=0 Ligne 55 à modifier par g = 0 J'ai simplement codé en dur les ...
winkx Bonjour Nicolas, Je vous remercie L'indicateur est très intéressant Après c'est une quest...
Nicolas Les goûts et les couleurs...
owes29 Do a Youtube search for "Revolutionary Indicators Reveal Tops & Bottoms" it explains a v...
owes29 Hi is there anyway to develop this for the pro scanner on daily or hourly scans. so it woul...
Nicolas Of course, please add a query in the proscreener forum.
Elsborgtrading I have moved the development topic
Elsborgtrading Sometime along the way since I coded the Indicator something has change in PRT- at least I t...
Elsborgtrading Btw last code was a 10 min TF ver.