Maximizing Profits with Ichimoku Trading Strategies: $131,668 Earned
Written on
Understanding Ichimoku Trading Strategies
Engaging in stock market investments can be a fruitful way to build wealth over time. Nonetheless, it can be quite challenging to pinpoint the ideal strategy that aligns with your personal investment approach and risk profile. In recent years, a growing number of investors have embraced automated trading techniques to enhance their decision-making process. A notable approach involves utilizing Python scripts to facilitate trades based on technical indicators.
In this article, we delve into how one investor successfully generated a profit of $131,668 through a Python-based trading strategy.
The Technical Indicators Explained
Before we examine the trading strategy, it’s essential to clarify the technical indicators incorporated in the code.
StochRSI:
This indicator merges the Stochastic Oscillator with the Relative Strength Index (RSI). It fluctuates between 0 and 1, signaling whether a stock is overbought or oversold. Values below 0.2 indicate oversold conditions, while values above 0.8 suggest overbought conditions.
df['STORSI'] = ta.momentum.stochrsi(close=df['close'], window=14, smooth1=3, smooth2=3, fillna=True)
Span A and Span B:
These are two critical components of the Ichimoku Cloud indicator. Span A is derived by averaging the Tenkan-sen and Kijun-sen lines and plotting the result 26 periods ahead. Span B is calculated by averaging the highest high and lowest low over the past 52 periods, also plotted 26 periods ahead.
Crafting the Trading Strategy
The trading strategy is fundamentally a trend-following method that initiates a purchase when the price surpasses both Span A and Span B, along with the StochRSI being under 0.8. Conversely, it sells when the price dips below either Span A or Span B, with the StochRSI exceeding 0.2.
df['SPANA'] = (ta.trend.ichimoku_a(high=df['high'], low=df['low'], window1=26, window2=52, visual=False, fillna=True))
df['SPANB'] = (ta.trend.ichimoku_b(high=df['high'], low=df['low'], window2=26, window3=52, visual=False, fillna=True))
df['EMA6'] = ((ta.trend.ema_indicator(close=df['close'], window=11, fillna=True))
The following loop processes the data to generate buy, sell, or hold signals:
signals = []
for i in range(1, len(df)-1):
if df.iloc[i]['close'] > df.iloc[i]['SPANA'] and df.iloc[i]['close'] > df.iloc[i]['SPANB'] and df.iloc[i]['STORSI'] < 0.8 and df.iloc[i]['close'] > df.iloc[i]['EMA6']:
signals.append(1) # Buy signalelif (df.iloc[i]['close'] < df.iloc[i]['SPANA'] or df.iloc[i]['close'] < df.iloc[i]['SPANB']) and df.iloc[i]['STORSI'] > 0.2:
signals.append(-1) # Sell signalelse:
signals.append(0) # Hold signal
Once the signals are generated, the code incorporates them into the dataframe for further analysis.
Backtesting the Strategy
The backtesting phase is crucial as it assesses the trading strategy against historical data to estimate its effectiveness. The following code segment illustrates how trades are executed based on the generated signals:
investment = 1000
current_investment = 1000
is_invested = 0
for i in range(500, len(df)):
signal = df.iloc[i]['signal']
close = df.iloc[i]['close']
if signal == 1 and is_invested == 0: # Long entry
entry_point = close
quantity = (current_investment / close)
is_invested = 1
elif signal == -1 and is_invested == 1: # Long exit
profit = quantity * (close - entry_point)
current_investment += profit
is_invested = 0
# Additional conditions for short selling can be added here...
Through meticulous backtesting of this strategy, the investor managed to achieve a remarkable profit of $131,668. However, it’s essential to remember that previous performance does not guarantee future outcomes, and trading strategies inherently carry risks.
Important Reminder
It's crucial to fully comprehend the strategy before committing real capital and to always adhere to effective risk management practices.
A Message from InsiderFinance
Thank you for being part of our community! Before you leave:👏 Show your appreciation for this article and follow the author 👉📰 Explore more content in the InsiderFinance Wire📚 Enroll in our FREE Masterclass📈 Discover Powerful Trading Tools
This video explores whether the Ichimoku Indicator is effective by backtesting the Tenkan-Kijun Crossover trading strategy.
This video conducts an extensive backtest of the Ichimoku Cloud strategy to determine if it lives up to its reputation, testing over 25,000 times.