Torben Moving Median

Torben Moving Median

Median filtering is a commonly used technique in signal processing. Typically used on signals that may contain outliers skewing the usual statistical estimators, it is usually considered too expensive to be implemented in real-time or CPU-intensive applications.

Let us define the median of N numerical values by:

  • The median of a list of N values is found by sorting the input array in increasing order, and taking the middle value.
  • The median of a list of N values has the property that in the list there are as many greater as smaller values than this element.

Example:

Torben’s method

This method was pointed out by Torben Mogensen.

It is certainly not the fastest way of finding a median, but it has the very interesting property that it does not modify the input array when looking for the median. It becomes extremely powerful when the number of elements to consider starts to be large, and copying the input array may cause enormous overheads. For read-only input sets of several hundred megabytes in size, it is the solution of choice, also because it accesses elements sequentially and not randomly. Beware that it needs to read the array several times though: a first pass is only looking for min and max values, further passes go through the array and come out with the median.

Credits to Fast median search: an ANSI C implementation.

PRT implementation

I have translated that C implementation by N. Devillard of Torben Mogensen algorithm in PRT, obtaining this moving median indicator:

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. yanntorp • 11/09/2020 #

    Bonjour,
    je souhaiterai savoir comment vous définissez la variable closedbar = t puisque cela me retourne une erreur.
    Merci pour votre aide.

    • Nicolas • 11/09/2020 #

      Le plus simple est de télécharger le fichier itf présent sur cette page et de l’importer dans la plateforme, vous aurez ainsi accès à toutes les fonctionnalités du code directement.

    • Daniele Maddaluno • 11/09/2020 #

      Le closedbar est simplement une variable de type boolean, et = t signifie qu’il est égal à true (c’est-à-dire checked box, 1).
      Cependant, il est beaucoup plus rapide d’importer le fichier “.itf”, comme l’a suggéré Nicolas.

      The closedbar is just a variable of type boolean, and = t means it is equal to true (i.e. a checked box, 1).
      However, it is much faster to import the “.itf” file, as Nicolas suggested.

  2. yanntorp • 11/09/2020 #

    merci pour vos réponses et le partage de ce code. Cela fonctionne très bien.

  3. Bruno Carnazzi • 11/09/2020 #

    GENIUS !

  4. AK27 • 11/09/2020 #

    Bonjour pensez vous qu’il est possible de creer un screener par rapport à cet indicateur, que le screener avertisse dès qu’une bougie validée clôture au dessus de la torben 20 par exemple 🙂

    • Daniele Maddaluno • 11/09/2020 #

      Bien sûr, vous pouvez écrire quelque chose comme ceci dans un screener:

      torben = CALL “Torben Moving Median”[20, 1](close)
      filter = close crosses over torben
      screener[filter]

    • AK27 • 11/09/2020 #

      merci Daniele vous êtes top, vous pensez qu’il est plus judicieux d’utiliser un screener de croisement de torben ou de franchissement du prix de la torben 20 ? je priorise le % de réussite au % de gain. 🙂

  5. AK27 • 11/09/2020 #

    Bonjour Daniele j’ai une idée d’indicateur qui va vous plaire je peux vous parler ou ? discord, twitter ? mail ?

  6. Daniele Maddaluno • 11/09/2020 #
  7. AK27 • 11/09/2020 #

    C’est payant visiblement sur linkdin je peux pas vous envoyer, discord vous avez ?

avatar
Register or

Likes

avatar avatar avatar avatar avatar avatar avatar
Related users ' posts
Byggtrader Hi Nicolas! How do I get the indicator in the price chart? It only stays under i new chart.
Nicolas Just add it on the price chart by using the wrench on the left upper side of the chart (pric...
Dom Hello, hello....je commence le trading et découvre par la même occasion le codage....et ce n...
Nicolas Merci, ça fait plaisir !
Be-n Bonjour tout le monde ! Dans l'indicateur de tendance, j'ai du mal à saisir la nuance entre ...
Globalmarkets79 Thank you Vonasi for the answer. I have an other question. When i tried to run the indicator...
Vonasi Lines is either 0 or 1 to turn on or off the drawing of them. Once again if you download and...
Globalmarkets79 Thank you Vonasi, this indicator is very helpful!!!
Nicolas
5 years ago
Bateson Merci pour la réponse Nicolas. C'est bien ce que j'ai fait mais ça ne fonctionne toujours pa...
Enzo Paliotti Veramente ottimo, era quello che cercavo, si potrebbe modificare inserendo come variazione a...
Nicolas Perché no, chiedetelo con una descrizione dettagliata nel forum degli indicatori, per favore!
jiddan78 how to convert to afl amibroker ?
Nicolas We do not supply free coding assistance for AFL Amibroker on the website. You can ask for pa...
Ngomsi @ Vonasi, how to use timeframe , 13 minutes ,21 minutes, 34 minutes,et 55 minutes with this...
manchokcity can we have it in mql4 platform? or how or which platform do we use it?
camporan I don't use MetaTrader so I won't be able to do the translation myself. Sorry!
Alexander9 This can for amibroker ? . Thanks
riz001 thnk u
geroniman bonjour Nicolas, j ai un indicateur le Tiger . J aiemrai placer des fleches buy et sell dire...
Nicolas Merci de formuler les demandes sur le forum. ça n'est pas le bon endroit et hors sujet ici ! ;)
avatar
Anonymous Hi robertogozzi - thank you very much for sharing this strategy. I have performed various ...
robertogozzi Thank you samsampop.
Dotan Hello guys I really appreciate this coding effort but can I use this code for Mt5 Forex Trad...
LucioleLucide Clean view, thanks for sharing
dertopen hi where i can found the window for candle configuration?
paolosab69 Ciao! . I have seen the pictures that explain this metod but i don't understand when is mome...
coscar Ottimo lavoro. come sempre!
luxrun Nello studio di Sepiashvili viene descritto anche un altro indicatore, il Q-indicator, che è...
Maik2404 wie kann ich den Code bekommen Paul?
jens_kittner Works with US Crude at 1h as well!
Jean-Claude REGIS Je préconise de regarder les graphiques H1 et M15 pour visualiser la tendance de fond et d'...
capgros Bonjour @Nicolas, Thanks a lot for this tool, it is very useful for me. I would like to s...
Hans63 Would you add the possibility to color also the Heikin Ashi and bar chart?
Nicolas That's possible, please open a new topic in the indicator forum explaining what you need exa...
Nicolas
6 years ago
BSTrend
v10.3
BSTrend
10
Indicators
Florian Legeard C’est à dire sur le prix et non sur le temps ? Merci
Rohit82189 bstrend repaints
Nicolas No, it doesn't repaint.
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
6 years ago
Maxime Baudin Interesting, Thank you! :)
franck-david Bonjour Nicolas , actuellement je me forme grace a vos videos tres tres bien expliques mer...
Nicolas Merci. ça n'est pas le lieu pour poser ce genre de question :) Merci d'utiliser le forum Pro...
gabri Brined :) look on this indicator how on the 6th and on the 9th you have very high positive s...
Pepsmile Hi everybody, An application could be found by applying this indicator on the strategy prof...
zilliq Thanks for your indicator Gabri but are you sure for your code because on EUR/USD for exampl...
Vonasi Discussion on this indicator/filter can be found here: https://www.prorealcode.com/topic/121...
Domenec Claro Juanjo de todas maneras en deinversoratrader.com tienes estsos osciladores evolucionad...
Dron Hola Domenec, en la descripción hablas del indicador velas de colores, no lo encuentro en la...
Domenec Hola Dron mira en el blog deinversoratrader.com en formacion indicadores ahi hay varios grat...

Top