Discover more from All About Trading!
Trading the Red Indicator
Presenting and Coding the Red Indicator
The Red indicator is the second indicator in the collection of the colored technical indicators which will be presented in future articles. A contrarian indicator weighted by the market’s trend, the idea is to seek out quick reversal opportunities.
Start your Free Trial now at O’Reilly and start reading the Early Release of my upcoming book “Mastering Financial Pattern Recognition” which covers everything you need to know about candlestick patterns and how to code them in Python! (Bonus points: You will discover new never-seen-before patterns). You will also find technical indicators, risk management, and even behavioral finance covered in the book!
Creating the Red Indicator
Contrarian indicators are numerous and their predictability varies from market to market and from parameter to parameter. Everyone agrees that performance ratios are not stable and this is to be expected from semi-random markets. The Red indicator is a helping technique that increases the bias for a certain trade. It is not really mean to generate pure signals.
To construct the Red indicator, follow these steps:
Subtract the current close price from the previous close price.
Normalize the differences between close prices between 0 and 100 using a lookback period of 8.
Calculate a 21-period moving average on the normalized values.
Calculate a 100-period moving average on the market price (close price).
If the market price is lower than its moving average while the Red indicator’s value is less than 38.2, then the latter’s value becomes 38.3.
If the market price is greater than its moving average while the Red indicator’s value is greater than 61.8, then the latter’s value becomes 61.7.
The two last conditions ensure that bullish signals are only given in a bullish trend and bearish signals are only given in a bearish trend. This being said, the Red indicator is a bounded indicator with an upper barrier at 61.8 and a lower barrier at 38.2 (representing Fibonacci ratios as discussed in previous articles).
The basic functions you must define are as follows:
The next Figure shows GBPUSD with the Red indicator in the second panel.
The following snippet shows the Red indicator’s function which you apply on an OHLC array (not data frame):
Getting healthier means changing your lifestyle. Noom Weight helps users lose weight in a sustainable way through behavioral change psychology. It's a no-brainer.
Using the Red Indicator
Using the Red indicator is rather simple as it is bounded between 0 and 100. The idea is that every time it exists these two extremes, a signal is given. The trading conditions are as follows:
A long signal is generated whenever the Red indicator is greater than 38.2 while the previous value is lower than 38.2.
A short signal is generated whenever the Red indicator is lower than 61.8 while the previous value is higher than 61.8.
The following snippet shows the signal function:
The next Figure shows the signal chart on USDCAD’s hourly values. The Red indicator works well in ranging or low-trending markets (as is the case for almost all contrarian indicators). However, with the trend filter, its abilities are improved.
The next Figure shows a signal chart on FTSE100.
Make sure to focus on the concepts and not the code. The most important thing is to comprehend the techniques and strategies. The code is a matter of execution but the idea is something you cook in your head for a while.
If you want to see how to create all sorts of algorithms yourself, feel free to check out Lumiwealth. From algorithmic trading to blockchain and machine learning, they have hands-on detailed courses that I highly recommend.
Learn Algorithmic Trading with Python Lumiwealth
Learn how to create your own trading algorithms for stocks, options, crypto and more from the experts at Lumiwealth. Click to learn more
To sum up, what I am trying to do is to simply contribute to the world of objective technical analysis which is promoting more transparent techniques and strategies that need to be back-tested before being implemented. This way, technical analysis will get rid of the bad reputation of being subjective and scientifically unfounded.
I recommend you always follow the the below steps whenever you come across a trading technique or strategy:
Have a critical mindset and get rid of any emotions.
Back-test it using real life simulation and conditions.
If you find potential, try optimizing it and running a forward test.
Always include transaction costs and any slippage simulation in your tests.
Always include risk management and position sizing in your tests.
Finally, even after making sure of the above, stay careful and monitor the strategy because market dynamics may shift and make the strategy unprofitable.