Calculate the distance of the price to a moving average. Also be able to identify if the average distance is decreasing or increasing based on signal line.
Length: The moving average length to measure against.
Source: The price input source use to measure the distance from.
Signal Length: The average of distance between Source and MA.
This script implements a rebrushed distance-based pair trading strategy. In this strategy, normally they trade the difference between the prices of two instruments. This difference is also called spread. Here, however we’ll trade the difference between two time frames of one instrument. And that's the main trick. Common procedure consists of the following...
copy pasted description..
Minkowski distance is a metric in a normed vector space. Minkowski distance is used for distance similarity of vector. Given two or more vectors, find distance similarity of these vectors.
FOLLOW twitter.com and twitter.com for designing the original script and idea with MAs
Follow twitter.com for making it VWMAs and finding the ultimate clout getting top signals of all time for Bitcoin on BITSTAMP:BTCUSD
I misspelled weighted on the chart, whatever.
Adopted to Pine from systemtradersuccess.com
They wrote that this average is designed to be a robust version of a moving average to reduce the impact of outliers, but I dont see a significant difference comparing it with SMA. So, I published it for the educational purposes.
To learn more about the robust...
Calculating distances in signal processing/statistics/time-series analysis imply measuring the distance between two probability distribution, i am not really familiar with distances but since some formulas are in closed form they can be easily used for volatility estimation. This volatility indicator will use three methods originally made to measure...