Triple Confirmation Trading Strategy
An Innovative Way to Trade Expected Reactions
--
Trading strategies are composed of multiple conditions. Technical trading strategies are the same but use conditions from technical indicators. This article presents an example of a strategy that can use technical rules.
I have released a new book after the success of my previous one “Trend Following Strategies in Python”. It features advanced contrarian indicators and strategies with a GitHub page dedicated to the continuously updated code. If you feel that this interests you, feel free to visit the below Amazon link (which contains a sample), or if you prefer to buy the PDF version, you could check the link at the end of the article.
The Basic Ingredients of the Strategy
The strategy is composed of three known technical indicators:
- A 2-period relative strength index (RSI).
- A 14-period stochastic oscillator.
- A MACD oscillator.
As a refresher, the RSI and the stochastic oscillator are normalization technique that trap the price action between 0 and 100 while the MACD is the difference between two moving averages that gives out trend following signals.
To code the indicators in Python while you have a numpy array, you can use the following:
def add_column(data, times):
for i in range(1, times + 1):
new = np.zeros((len(data), 1), dtype = float)
data = np.append(data, new, axis = 1) return datadef delete_column(data, index, times):
for i in range(1, times + 1):
data = np.delete(data, index, axis = 1) return datadef delete_row(data, number):
data = data[number:, ]
return datadef ma(data, lookback, close, position):
data = add_column(data, 1)
for…