Ichimoku Stop Loss Strategy

Author: ChaoZhang, Date: 2023-11-03 17:05:40



This strategy is a trend following strategy developed using Ichimoku Cloud and stop orders. It utilizes the conversion line, base line and lagging span of the Ichimoku Cloud to determine the trend direction and sets stop orders at the upper and lower edges of the cloud bands for stop loss.

Strategy Logic

The strategy is based on the following principles:

  1. The conversion line is the average of the highest and lowest prices over the past 9 days, reflecting recent average price changes.

  2. The base line is the average of the highest and lowest prices over the past 26 days, reflecting medium-term average price changes.

  3. The lagging span is the average of the highest and lowest prices over the past 52 days, reflecting long-term average price changes.

  4. The average of the conversion and base lines forms the leading span 1, and the lagging span forms the leading span 2. The area between the two leading spans forms the cloud bands. The upper and lower edges of the cloud bands indicate trend direction.

  5. When price breaks above the cloud bands, go long. When price breaks below the cloud bands, go short.

  6. Set stop loss orders at the upper and lower edges of the cloud bands to follow the trend.

Specifically, the strategy defines the three Ichimoku lines, calculates their averages to get the leading span 1 and 2. It then determines the trend direction based on price breaking through the upper or lower cloud band boundaries. After taking long or short positions, it sets stop loss orders based on the cloud band prices to follow the trend with stop loss in place.

Advantage Analysis

The advantages of this strategy are:

  1. Ichimoku Cloud reliably determines trend direction by incorporating price information from multiple timeframes, filtering out market noise.

  2. Stop loss placement is reasonable. Using the cloud band edges allows for proper stop loss range and good trend following.

  3. The strategy is stable and reliable. Ichimoku Cloud filters noise and stop loss controls risk.

  4. Flexible parameter adjustment. Conversion, base, and lagging span periods can be adjusted for market adaptation.

  5. Clear logic and easy to understand. Trend following approach makes it easy to grasp.

Risk Analysis

The risks of the strategy include:

  1. Stop loss breakout risk. Volatile price moves may trigger stop loss and exit profitable positions.

  2. Whipsaws in ranging markets. Frequent stop loss triggers lead to overtrading.

  3. Parameter risk. Improper settings of conversion, base and lagging spans may cause stop loss range to be too wide or narrow.

  4. Slippage cost in futures. Frequent orders may lead to excessive slippage costs affecting profits.

  5. Algorithmic trading risks. Downtime, network issues, bugs may affect trade execution.

To address these risks, optimization of parameters, stop loss algorithms, improving server stability, proper risk management, and thorough strategy testing should be undertaken.

Optimization Directions

The strategy can be optimized in the following aspects:

  1. Optimize parameter settings by testing different period combinations to find optimal values.

  2. Improve stop loss algorithms with trailing stops, volatility stops etc to reduce stop loss triggers.

  3. Incorporate additional indicators like MACD, KDJ to improve decision making.

  4. Add automatic loss closure functionality to limit losses.

  5. Implement re-entry mechanism after stop loss exit.

  6. Optimize money management through dynamic position sizing.


Overall, the strategy has clear logic, uses Ichimoku Cloud for trend direction and cloud bands for stop loss trailing, effectively controlling risk and having practical utility. But risks exist so parameters, stop loss algorithms must be optimized and proper risk controls implemented for stable live trading profits. It provides a good example of designing stop loss strategies based on trend following principles.

start: 2022-10-27 00:00:00
end: 2023-11-02 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]

strategy(title = "Noro's Ichimoku Stop Strategy", shorttitle = "Ichimoku Stop Strategy", overlay = true, default_qty_type = strategy.percent_of_equity, default_qty_value = 100, pyramiding = 0)

needlong = input(true, defval = true, title = "Long")
needshort = input(true, defval = true, title = "Short")
conversionPeriods = input(9, minval = 1, title = "Conversion Periods")
basePeriods = input(26, minval = 1, title = "Base Periods")
laggingSpan2Periods = input(52, minval = 1, title = "Lagging Span")
fromyear = input(1900, defval = 1900, minval = 1900, maxval = 2100, title = "From Year")
toyear = input(2100, defval = 2100, minval = 1900, maxval = 2100, title = "To Year")
frommonth = input(01, defval = 01, minval = 01, maxval = 12, title = "From Month")
tomonth = input(12, defval = 12, minval = 01, maxval = 12, title = "To Month")
fromday = input(01, defval = 01, minval = 01, maxval = 31, title = "From day")
today = input(31, defval = 31, minval = 01, maxval = 31, title = "To day")

donchian(len) => avg(lowest(len), highest(len))
conversionLine = donchian(conversionPeriods)
baseLine = donchian(basePeriods)
leadLine1 = avg(conversionLine, baseLine)
leadLine2 = donchian(laggingSpan2Periods)

p1 = plot(leadLine1, offset = basePeriods, color=color.green, title="Lead 1", transp = 100)
p2 = plot(leadLine2, offset = basePeriods, color=color.red, title="Lead 2", transp = 100)
fill(p1, p2)

max = max(leadLine1[basePeriods], leadLine2[basePeriods])
min = min(leadLine1[basePeriods], leadLine2[basePeriods])
up = low > max
dn = high < min

if max > 0
    strategy.entry("Long", strategy.long, needlong ? na : 0, stop = max)
    strategy.entry("Short", strategy.short, needshort ? na : 0, stop = min)