How to create an Ichimoku trading bot using python (Part 1: The Strategy)

Ape finance
Coinmonks
3 min readJul 29, 2021

--

Photo by M. B. M. on Unsplash

I had a brilliant idea to build a swing trading bot at the beginning of this year. And after taking a semester worth of python I decided to put my python skills to the test. Lets see how it went!

First I had to choose a trading strategy, one which was simple enough to be coded as my first bot, but effective. After researching, I settled on the Ichimoku cloud strategy.

What is Ichimoku Cloud strategy?

The red line is Tenkan-Sen (Conversion Line): The short term indicator [(9-period high + 9-period low)/2]

The yellow line is Kijun-sen (Base Line):The medium term indicator [(26-period high + 26-period low)/2].

The green line is Senkou Span A (Leading Span A):The short-medium term indicator [(Conversion Line + Base Line)/2]. (Also note this value is plotted 26 periods into the future.)

The blue line is Senkou Span B (Leading Span B): The long term indicator [(52-period high + 52-period low)/2]. (Similarly this value is plotted 26 periods into the future.)

The purple line is the Chikou Span (Lagging Span):The confirmation indicator [Just current recent price, plotted 26 periods back.]

How does it work:

When Span A is above Span B, it forms a ‘green cloud’ which also indicates an upward trend in the long term.

When the price is above the ‘cloud’ plotted 26 days forward, it shows price strength. Whereas prices in the ‘cloud’ show choppiness and a time of uncertainty.

Next, we also look for the conversion and base being above the cloud and the buy signal would be the conversion line crossing the base line. This shows a boost in short term momentum over the medium term and further reinforces our upward trend.

Lastly, the lagging span must be above the price, this serves as a confirmation that the current price is higher than the price 26 days ago.

Summarising the rules:

Now let’s get to building the bot in python!

Also, Read

--

--