Statistical methods based on mean cannot be effective all the time when attributed to financial data since it doesn't usually follow normal distribution, the data can be skewed or/and have extreme values which can be described as outliers.
In order to deal with this problem it is appropriate to use median-based techniques.
The most common one is called...
This script plots given first timeframe inputs candles with data from second timeframes candle closes. If you change inputs you should change also TF1/TF'2 so that it is equal to first time frames / second time frame. For example if first timeframe is Daily and second is 15. There is 96 times 15m candle in the Day so TF1/TF2 should be 96. Other inputs are...