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 • 69 days ago #

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

  2. bolsatrilera • 69 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 • 68 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 • 68 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 • 68 days ago #

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

  4. sanjivmodi • 8 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
Ernesto1 Good Job !!! Ciccio
ALE great! :-)
14 hours ago
diegofe_2000  Entro a operar una demo con este indicador,  les voy contando
diegofe_2000 vamos a probarlo
Nicolas Voici le lien pour la version avec Volumes négatifs si le dernier ZigZag était un "peak". h...
Nicolas Here is the link for the new version with cumulative Volumes as negative values when the las...
Draper Merci Nicolas pour cet indicateur et pour les précédents aussi!  Je n'arrive pas à comprendr...
gregus bonjour a tous quelqu un pourait il recodé en prt il sagit  du dynamique zone ma, je n arri...
Nicolas Merci de faire une requête spécifique sur le forum. 
leo1962 Ciao Nicolas, nel codice c'è un errore di sintassi, allego screenshot. Non sono pratico di ...
Nicolas Este indicador sólo funcionará para Prorealtime v10.3 y superior.
leo1962 gracias ;)
larouedegann blue = 50 green = 20 red = 10 than you
Elsborgtrading By adding the inside bar breakout failure candle, which is the next bar after the inside bar...
3 weeks ago
saulyte1 doesn't work on IG PRT 10.3 get the indicator window when imported but empty and no projecte...
Nicolas Please add the indicator on price. Use the wrench in the upper left corner of the price char...
saulyte1 thank you,  seems to be working now.
Wing Yes, investigate as much as you want. For more insight, you can view the linet1, linet2 etc....
CKW Hi Wing, Thanks for your sharing. I am still trying to breakdown & understand your code...
Wing Hello CKW. No, the parameter, 7 in this case, is used when calling the RSI indicator to ide...
supertiti Buenas tardes Rafa con esa linea no me sale bien las flechas : DRAWARROWUP (barindex, AvHig...
supertiti asi me gusta ! DRAWARROWUP (barindex, AvHigh-(range+2) ) COLOURED (127,255,0)  
supertiti asi mejor con +1 DRAWARROWUP (barindex, AvHigh-(range+1) ) COLOURED (127,255,0)
Sofitech Ce code n'est valable que sur la V10.3 ? sur le 10.2 il y a une erreur de syntaxe dans le fi...
Nicolas Oui en effet, c'est un indicateur "10.3" à cause uniquement de la mise en forme des courbes ...
Nicolas You need to have enough bars loaded on your chart for the indicator to compute completely th...
verdi55 Working with separately calculated supertrend indicators in backtests is usually somewhat pr...
Nicolas Very interesting Verdi. Would be a great addition to the library, your own modified version ...