OPEN-SOURCE SCRIPT
Torben Moving Median

This method was pointed it 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 in little more time. The number of iterations is probably O(log(n)), although I have no demonstration of that fact.
What is Median Filtering
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.
How To trade
Trading is quite intuitive
Buy when the Price breaks-out the price which breaked the Torben Moving Median
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 in little more time. The number of iterations is probably O(log(n)), although I have no demonstration of that fact.
What is Median Filtering
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.
How To trade
Trading is quite intuitive
Buy when the Price breaks-out the price which breaked the Torben Moving Median
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
For quick access on a chart, add this script to your favorites — learn more here.
Get Ocs Ai Trader, Your personal Ai Trade Assistant here
→ ocstrader.com
About me
AlgoTrading Certification, ( University of Oxford, Säid Business School )
PGP Research Analysis, ( NISM, SEBI )
Electronics Engineer
→ ocstrader.com
About me
AlgoTrading Certification, ( University of Oxford, Säid Business School )
PGP Research Analysis, ( NISM, SEBI )
Electronics Engineer
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
For quick access on a chart, add this script to your favorites — learn more here.
Get Ocs Ai Trader, Your personal Ai Trade Assistant here
→ ocstrader.com
About me
AlgoTrading Certification, ( University of Oxford, Säid Business School )
PGP Research Analysis, ( NISM, SEBI )
Electronics Engineer
→ ocstrader.com
About me
AlgoTrading Certification, ( University of Oxford, Säid Business School )
PGP Research Analysis, ( NISM, SEBI )
Electronics Engineer
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.