Trend
Trend StepJust a modification of my old auto-line script, lot of errors fixed and a correction in the standard deviation. Also changed the tittle because "auto-line" was really confusing.
Trend Impulse FilterIntroduction
There is a lot of indicators similar to this one, however i think this one don't share the same calculation method and this is why i share it. This indicator aim to forecast price direction using an exponential filter architecture using highest and lowest information for the estimation of a smoothing variable. This filter is similar to the average Max-Min filter.
The Indicator
In the code a is equal to 1 when the price is greater or lower than any past price over length period, else a is equal to 0. The center parameter control the filtering degree of the output, when center is equal to 1 and a = 1 the indicator return the highest or lowest depending on market current trend, when center is superior to 1 the output will be smoother, however the reactivity of the indicator will still depend on the length parameter.
A color option show you the trend of the market, however the generated signals are the same that can be generated from a Donchian channel.
When highest is greater than previous highest the indicator direction will move upward, else if lowest is lower than previous lowest the indicator direction will move downward. Therefore the indicator can give information on the Donchian channels direction and provide a nice filter.
Conclusions
Adapting to highest and lowest can make an indicator adapt to the essence of trend trading, the indicator i showed can be used as source for others indicator or in MA crossover strategies. If you have a strategy using Donchian channels you may be interested in using this indicator and se how it fit in your strategy. Hope you like it.
Thanks for reading !
Moving Average Trend IndicatorThis Indicator shows you the major moving averages, both in simple and exponential.
ADX+DMI MTF byPeterOThe goal of this study was to use ADX from Higher Timeframe - to determine trend direction
Why? Because ADX is very sensitive, able to show trend ending without any delay, but not in the middle of it.
Being able to see such immediate trend change on higher timeframe, is a great indicator of trend direction.
Adding just security() calls to 'highest', 'lowest' and 'close' didn't seem right, because it produced some ugly ADX, D+ and D- plotlines.
I wanted to see plotlines, which look exactly like those on actual higher timeframe. Therefore I modified the calculations.
You can read more about my take on (not) using security() calls in my other source code indicator RSI MTF: link in comments.
On top of all that, I added interpretation of DMI readings, because it is not as simple as plus>minus + ADXrising = uptrend.
So GREEN background means higher timeframe uptrend and RED background means downtrend.
Time Price IndicatorIntroduction
There are already several indicators who measure the time behavior relative to price, the most well know being the Aroon indicator published by Tushar Chande. I propose an alternative indicator TPI who tend to create less whipsaw's at the cost of small reactivity.
The Indicator
The TPI is in a range of 0.5/-0.5 and is no different than the Aroon indicator when it come to signal generation, when the upper line (in blue) crossover the lower line (in orange) the indicator generate a buy signal, when the lower line cross under the upper line a sell signal is generated.
Comparison
The Aroon indicator tend to use more information which involve more reactivity but more uncertainty as well.
Aroon and TPI with both length = 50. White lines represent signals where the Aroon and my proposed indicator react at the same time, the red line show a whipsaw and the green line show a signal generated faster by the Aroon.
Here is a more pertinent exemple
Aroon reacted to price range which at the end involved many whipsaw, the TPI however stayed on a sell signal and did not reacted to this price range. The cost to avoid so many whipsaw was a reactivity of 7 bars back when the sell signal of the TPI was generated.
A statistic of the signal numbers generated by both indicator is shown below
The blue line show the number of signals generated by the Aroon indicator and in orange the number generated by the TPI with both length = 14. Aroon generated 410 while the TPI generated 288 signals.
Conclusion
The Aroon indicator and TPI can both generate a signal at the same time or with a small period deviation with the ability of the TPI to avoid some whipsaw.
Dynamically Adjustable Moving AverageIntroduction
The Dynamically Adjustable Moving Average (AMA) is an adaptive moving average proposed by Jacinta Chan Phooi M’ng (1) originally provided to forecast Asian Tiger's futures markets. AMA adjust to market condition in order to avoid whipsaw trades as well as entering the trending market earlier. This moving average showed better results than classical methods (SMA20, EMA20, MAC, MACD, KAMA, OptSMA) using a classical crossover/under strategy in Asian Tiger's futures from 2014 to 2015.
Dynamically Adjustable Moving Average
AMA adjust to market condition using a non-exponential method, which in itself is not common, AMA is described as follow :
1/v * sum(close,v)
where v = σ/√σ
σ is the price standard deviation.
v is defined as the Efficacy Ratio (not be confounded with the Efficiency Ratio) . As you can see v determine the moving average period, you could resume the formula in pine with sma(close,v) but in pine its not possible to use the function sma with variables for length, however you can derive sma using cumulation.
sma ≈ d/length where d = c - c_length and c = cum(close)
So a moving average can be expressed as the difference of the cumulated price by the cumulated price length period back, this difference is then divided by length. The length period of the indicator should be short since rounded version of v tend to become less variables thus providing less adaptive results.
AMA in Forex Market
In 2014/2015 Major Forex currencies where more persistent than Asian Tiger's Futures (2) , also most traded currency pairs tend to have a strong long-term positive autocorrelation so AMA could have in theory provided good results if we only focus on the long term dependency. AMA has been tested with ASEAN-5 Currencies (3) and still showed good results, however forex is still a tricky market, also there is zero proof that switching to a long term moving average during ranging market avoid whipsaw trades (if you have a paper who prove it please pm me) .
Conclusion
An interesting indicator, however the idea behind it is far from being optimal, so far most adaptive methods tend to focus more in adapting themselves to market complexity than volatility. An interesting approach would have been to determine the validity of a signal by checking the efficacy ratio at time t . Backtesting could be a good way to see if the indicator is still performing well.
References
(1) J.C.P. M’ng, Dynamically adjustable moving average (AMA’) technical
analysis indicator to forecast Asian Tigers’ futures markets, Physica A (2018),
doi.org
(2) www.researchgate.net
(3) www.ncbi.nlm.nih.gov
Fast Z-ScoreIntroduction
The ability of the least squares moving average to provide a great low lag filter is something i always liked, however the least squares moving average can have other uses, one of them is using it with the z-score to provide a fast smoothing oscillator.
The Indicator
The indicator aim to provide fast and smooth results. length control the smoothness.
The calculation is inspired from my sample correlation coefficient estimation described here
Instead of using the difference between a moving average of period length/2 and a moving average of period length , we use the difference between a lsma of period length/2 and a lsma of period length , this difference is then divided by the standard deviation. All those calculations use the price smoothed by a moving average as source.
The yellow version don't divide the difference by a standard deviation, you can that it is less reactive. Both version have length = 200
Conclusion
I presented a smooth and responsive version of a z-score, the result could be used to estimate an even faster lsma by using the line rescaling technique and our indicator as correlation coefficient.
Hope you like it, feel free to modify it and share your results ! :)
Notes
I have been requested a lot of indicators lately, from mt4 translations to more complex time series analysis methods, this accumulation of work made that it is impossible for me to publish those within a short period of time, also some are really complex. I apologize in advance for the inconvenience, i will try to do my best !
Absolute Strength MTF IndicatorIntroduction
The non-signal version of the absolute strength indicator from fxcodebase.com requested by ernie76 . This indicator originally from mt4 aim to estimate the bullish/bearish force of the market by using various methods.
The Indicator
Two lines are plotted, a bull line (blue) representing the bullish/buying force and a bear one (red) representing the bearish/selling force, when the bull line is greater than the bear line the market is considered to be strongly bullish, else strongly bearish.
The indicator use various method, Rsi, stochastic, adx. The Rsi method is the one by default.
The stochastic method is less reactive but smoother
The Adx method is way different, while the other two methods make the bull and bear lines somewhat uncorrelated, the adx method focus more on the overall market strength than individual buyer/seller strength.
The smoothing method use 3 different filters, SMA, EMA and LSMA, LSMA is more reactive than the two previous one while EMA is just more computer efficient.
It is possible to use price data of different time frames for the calculation of the indicator.
Stochastic method with 4 hour price close as source.
Conclusion
A classic indicator who can be derived into a lot of ways using a more adaptive architecture or recursion. Hope you find it a use :)
A big thanks to ernie76 for the request and the support/testing of the indicator
Feel free to pm me for any request.
Dominant Cycle Tuned Rsi BackgroundBackground version of the Dominant Cycle Tuned Rsi Background published here
Modified Gann HiLo ActivatorIntroduction
The gann hilo activator is a trend indicator developed by Robert Krausz published into W. D. Gann Treasure Discovered: Simple Trading Plans for Stocks & Commodities . This indicator crate a trailing stop aiming to show the direction of the trend.
This indicator is fairly easy to compute and dont require lot of skills to understand. First we calculate the simple moving average of both price high and price low, when the close price is higher than the moving average of the price high the indicator return the moving average of the price low, else the indicator return the moving average of the price high if the close price is lower than the moving average of the price low.
My indicator add a different calculation method in order to avoid whipsaw trades as well as adding significance to the moving average length. A Median method has been added to provide more robustness.
The Indicator
The indicator is a simple trailing stop aiming to show the direction of the trend. The indicator use a different source instead of the price high/low for its calculation. The first method is the "SMA" method which like the classic hilo indicator use a simple moving average for the calculation of the indicator.
Sma Method with length = 25
The "Median" use a moving median instead of a simple moving average, this provide more robustness.
Median Method with length = 25
The shape is less curved and the indicator can sometimes avoid whipsaw with high's length periods.
Mult Parameter
The mult parameter is a parameter set to be lower or equal to 1 and greater or equal to 0. High values allow the indicator to be far from the price thus avoiding whipsaw trades, lower ones lower the distance from the price. A mult parameter of 0.1 approximate the original hilo indicator.
In blue the indicator with mult = 0.1 and in radical red the original hilo activator.
Conclusion
The modifications allow more control over the indicator as well as adding more robustness while the original one is destined to fail when market price is more complex.
Thanks for reading :)
For any questions/suggestions feel free to pm me
IO_KijunTenkanThis is an indicator that plots customizable Kijun Sen and Tenkan Sen from the Ichimoku chart.
Since Kijun and Tenkan can effectively be used as an alternative of EMA and can play a pivotal role in many strategies, this indicator can be helpful
IO_GuppyDistanceThis indicator measures the distance between the Guppy EMAs.
Fast and Slow Guppy distances are plotted based on traditional Chris Moody Guppy colors.
Green = Long Term Bullish
Red = Long Term Bearish
Gray = Neither
Similarly colors for ST Bullish and Bearish signals based on Guppy.
Thank you, CM and xkavalis!
Consecutive Closes Above or Below a SMAThis is a very simple indicator to that marks a candle after a specified number of consecutive closes above or below a Simple Moving Average. The purpose of the indicator is to provide a quick visual cue that there is a strong trend in play.
Flagging BandsIntroduction
A pun between the word flag and the adjective flagging (less dynamic) , this indicator have two bands who react faster when in contact to the price. Imagine you are under sheets, if you abruptly rise, the sheets will instantaneously go up, then if you abruptly get down, the sheets will fall slowly until being in contact with a surface, this is because of a type of friction called drag or air resistance , this force is described in fluid dynamics and i inspired myself from that for the creation of the indicator.
The indicator
The indicator is made of two bands, one upper band and one lower band, then a weighted average of each bands, this average is weighted depending on which band the price is closer. The length control the period of the indicator, in general higher lengths will create wider bands, you must consider that this parameter behave differently than other ones and may create slower results in comparison with other bands indicators while having the same length period.
The indicator can use a simple breakout methodology (see trailing stop part) but can sometime provide support and resistance points, in fact i believe that when the average variability/volatility of band A is higher than the average variability/volatility of band B and that the price cross band B then price will reverse its direction, this claim is not justified, research is needed.
Trailing Stop Mod
It is possible to make the indicator act as a trailing stop, in order to do so just tick the trailing stop mod box.
The average/bands will automatically disappear being replaced by the trailing stop.
Conclusion
I was just playing around when making the skeleton of the indicator, i hope the code is easy to understand, if you need some kind of explanation just pm me, i'm always open to help people/receive suggestions.
Best Regards
Hucklekiwi Pip - HLHB Trend-Catcher SystemThe strategy was authored by Hucklekiwi Pip back in 2015 and is still being updated today. She says that the system was designed to simply catch short-term forex trends. At its heart, the system is a simple EMA crossover strategy with a couple of other indicators used for confirming entries.
Strategy Rules
See her original post here:
www.babypips.com
Be sure to check out the updates and tweaks over the years!
HOW TO USE
For full information on how to use this strategy and how to correctly set the exit time, see this post:
backtest-rookies.com
Surface Roughness EstimatorIntroduction
Roughness of a signal is often non desired since smooth signals are easier to analyse, its logical to say that anything interacting with rough price is subject to decrease in accuracy/efficiency and can induce non desired effects such as whipsaws. Being able to measure it can give useful information and potentially avoid errors in an analysis.
It is said that roughness appear when a signal have high-frequencies (short wavelengths) components with considerable amplitudes, so its not wrong to say that "estimating roughness" can be derived into "estimating complexity".
Measuring Roughness
There are a lot of way to estimate roughness in a signal, the most well know method being the estimation of fractal dimensions. Here i will use a first order autocorrelation function.
Auto-correlation is defined by the linear relationship between a signal and a delayed version of itself, for exemple if the price goes on the same direction than the price i bars back then the auto-correlation will increase, else decrease. So what this have to do with roughness ? Well when the auto-correlation decrease it means that the dominant frequency is high, and therefore that the signal is rough.
Interpretation Of The Indicator
When the indicator is high it means that price is rough, when its low it indicate that price is smooth. Originally its the inverse way but i found that it was more convenient to do it this way. We can interpret low values of the indicator as a trending market but its not totally true, for example high values dont always indicate that the market is ranging.
Here the comparison with the indicator applied to price (orange) and a moving average (purple)
The average measurement applied to a moving average is way lower than the one using the price, this is because a moving average is smoother than price.
Its also interesting to see that some trend strength estimator like efficiency ratio can treat huge volatility signals as trend as shown below.
Here the efficiency ratio treat this volatile movement as a trending market, our indicator instead indicate that this movement is rough, such indication can avoid situation where price is followed by another huge volatile movement in the opposite direction.
Its important to make the distinction between volatility and trend strength, the trend is defined by low frequencies components of a signal, therefore measuring trend strength can be resumed as measuring the amplitude of such frequencies, but roughness estimation can do a great job as well.
Conclusion
I have showed how to estimate roughness in price and compared how our indicator behaved in comparison with a classic trend strength measurement tool. Filters or any other indicator can be way more efficient if they know how to filter according to a situation, more commonly smoothing more when price is rough and smoothing less when price is smooth. Its good to have a wider view of how market is behaving and not sticking with the binary view of "Trending" and "Ranging" .
I hope you find a use to this script :)
Best Regards
IO_Volatility Quality Zero LineThis is the Volatility Quality Zero Line Indicator. This indicator measures volatility strength.
Delta longs-shorts. BITFINEX:BTCUSDFor any timeframe. Use for the BTC/USD pair. It is calculated by the formula: longs - shorts. Used data from Bitfinex. To smooth the values, you can use the EMA embedded in the indicator.
SMA Trend Bias IndicatorThis indicator is mainly used to quickly determine the trend of the market, so you can trade with the market and not against it.
This will also tell you when The Golden Cross/Death Cross has occurred.