AI Algorithms: A Walkthrough of the Strategy

Forex/Stock Trading robot— Strategy — December 2020

Shivalay Kara
5 min readDec 22, 2020

Hi everyone,

In the last few blogs, I started talking about my trading algorithm, and after hearing lots of feedback, I wanted to clarify the exact strategy. This article will walk you through an example trade that the algorithm made.

A quick overview of the strategy

The algorithm’s strategy is not dependent on the direction of the market. In other words, this means whether the market goes down or up, the trades will be profitable, hence creating a continuous passive income.

This is achieved through buying and selling positions in the forex market and as you guessed this will mean at any given time either the “buys” or the “sells” are profiting. Whilst the other side would be accumulating a negative balance until they are closed with a reversal (shown in figure 1).

Figure 1: Schematic of the strategy
Figure 2: Live trades with the strategy

In the schematic above, the top three trades will profit, and the last two will close at a loss. The algorithm is set, so the target price to close all positions is where the profit is greater than the loss.

This can be seen in figure 2, where an overall profit of £3.39 for the “Sells” was generated.

A live trading example

Figure 3: Screenshot of EURUSD between 21st Dec 11:00- 22nd Dec 14:15

So let me walk you through this live trade. The green bars indicate a price increase, and the red bars indicate a price decrease.

If you look at the bottom left of figure 3, the market has been pushing upwards from 1.21330. Since then, “sell” positions have been accumulating, with the upward movement. The target price (bottom blue dotted line) for the “sell” positions have been lagging behind the current price. This means no matter how much the price has moved from the first opened position (1.21330), the market will only need to reverse back to the bottom blue dotted line for an overall profit to be made.

Figure 4: Buy positions of EURUSD between 21st Dec 11:00- 22nd Dec 14:15

What about the “buys”?

Alongside the accumulation of the “sell,” the algorithm also places “buy” trades. In the same time frame between Dec 21-Dec 22, there were several buy positions opened and closed, this can be seen in figure 4.

The losses, seen in figure 4, are part of the same strategy taking place for the buy positions, which is the reverse of what can be seen in figure 1. You can identify these by the timestamps and the closing prices, which are all the same.

The results after a few hours

Figure 5: Screenshot of EURUSD between 21st Dec 11:00- 22nd Dec 16:00

The current price hit the take profit (previous bottom blue dotted line), to close all the “sell” positions at profit (See Figure 6).

This now resets the algorithm to place new “sells”, whilst the buys are starting to accumulate in Figure 5.

However, hypothetically, if the market did continue to rise, more “sell” positions would be placed, whilst moving the target price for the accumulated sell even high and closer to the current price. This would happen all while the “buy” positions continue closing at a profit.

Figure 6: The closed positions of the accumulating sells

The algorithms automatically closed all trades simultaneously at the price of 1.21991 (EURUSD). As you can see, the top four trades profited, whereas the bottom three closed at loss, to make an overall profit of $9.95.


Ping Pong

The message I want to get across is the algorithm works like ping pong, where no matter which side the ball hits, profit is made.

The benefit of automatic trading is that unlike a manual trader who would simply hold one position for the duration of the movement, the algorithm can utilise the constant fluctuations to profit at every peak, instead of one continuous hold. Not only does automatic trading reduce technical analysis, which is time-consuming but it also gives us access to utilise the entire 24/5 forex market, adding to the passive income source title.

The challenge

A known risk and challenge is what happens if the market continues to spike? This requires a trading plan and proper risk management, which I have talked about in more detail in my previous post

Signing off

Shivalay :-)


Please note that Shivalay Kara is not a financial advisor. This page and the work I do is purely for financial education purposes. Any stocks, cryptocurrencies, commodities, trading/investment techniques or any form of financial activities mentioned in all of our pages entail risk. Any person undertaking either do so with the understanding that the content supplied is a guide to demonstrate how Shivalay Kara trades with the algorithm. All education and products are done so in a non-professional environment, and you are personally liable for all losses and gains made through the algorithm, the algorithm manager, creator or article administrator cannot be held liable in any circumstances.



Shivalay Kara

Just someone who’s passionate about making money through passive income.