The Ichimoku_v32 strategy is a trading strategy that utilizes the Ichimoku Cloud indicator to generate buy and sell signals. Here's a breakdown of how the strategy works:
The strategy uses the ichimoku function from the technical.indicators module to calculate the Ichimoku Cloud values for the given timeframe. The parameters used for the Ichimoku Cloud calculation are: conversion line period of 20, base line periods of 60, lagging span of 120, and displacement of 30.
The calculated Ichimoku Cloud values are stored in different columns of the dataframe object:
tenkan: The Tenkan-sen line.
kijun: The Kijun-sen line.
senkou_a: The Senkou Span A line. senkou_b: The Senkou Span B line. cloud_green: Indicates whether the price is above the cloud (True) or not (False). cloud_red: Indicates whether the price is below the cloud (True) or not (False). The strategy also uses the Heikin Ashi chart type. The Heikin Ashi values are calculated using the qtpylib.heikinashi function and stored in the dataframe object:
ha_open: The Heikin Ashi open price. ha_close: The Heikin Ashi close price. ha_high: The Heikin Ashi high price. ha_low: The Heikin Ashi low price. The populate_buy_trend function is responsible for determining the buy signals based on the strategy's conditions:
If the Heikin Ashi close price (shifted by 2 periods) crosses above the Senkou Span A and both the Heikin Ashi close price (shifted by 2 periods) and Senkou Span B are above the Senkou Span A, a buy signal is generated. The populate_sell_trend function is responsible for determining the sell signals based on the strategy's conditions:
If the Tenkan-sen crosses below the Kijun-sen, and the Heikin Ashi close price is below both the Senkou Span A and Senkou Span B, and the cloud color is red, a sell signal is generated. The strategy aims to achieve a minimum return on investment (ROI) of 100% (specified in the minimal_roi dictionary) and has a stop loss of -1 (disabled). The ticker interval is set to '4h' (4-hour intervals). Please note that this is a simplified description of the strategy, and there may be additional details and considerations not covered here.