Skip to content

Renko Strategies in cTrader

A Renko chart is a type of chart that is built using only price movement. A new Renko brick is only formed once the price movement for a symbol exceeds a certain threshold of pips; the time component typically used in candlestick charts is entirely absent. cTrader allows traders to develop automated strategies based on Renko bars in the exact same way as developing such strategies for time-based candlestick bars. In this article and its corresponding video, we will create a simple cBot that uses a Renko-based strategy and backtest it.

Defining the Trading Strategy

We will start by defining the buy signal. As Renko bars lack the time component and, therefore, filter market 'noise', it makes sense to use them to identify trend exhaustions and potential reversals. We will place a new buy order when two bearish Renko bars are followed by two bullish bars.

Our sell signal will follow the opposite setup. We will place a sell order when two bullish Renko bars are followed by two bearish bars.

Creating an Example cBot

We can now proceed to coding a cBot based on the above strategy. To start, we will define the parameters for the order volume, and the relative levels of stop loss and take profit.

1
2
3
4
5
6
7
8
[Parameter(DefaultValue = 10000)]
public double Volume { get; set; }

[Parameter(DefaultValue = 20)]
public double StopLoss { get; set; }

[Parameter(DefaultValue = 20)]
public double TakeProfit { get; set; }

We will implement our trading strategy in the OnBarClosed() method. For our bullish setup, we will check if the bars with indices 3 and 2 have a close price lower than the open price and we will also check if the bars with indices 1 and 0 have a close price higher than the open price.

1
2
3
4
if (Bars.Last(3).Close < Bars.Last(3).Open && Bars.Last(2).Close < Bars.Last(2).Open && Bars.Last(1).Close > Bars.Last(1).Open && Bars.Last(0).Close > Bars.Last(0).Open)
{
    ExecuteMarketOrder(TradeType.Buy, SymbolName, Volume,InstanceId, StopLoss, TakeProfit);
}

For our bearish setup, we will check for the opposite. Bars with indices 3 and 2 have to have a higher close price than their open price; bars with indices 1 and 0 must have a higher open price than their close price.

1
2
3
4
if (Bars.Last(3).Close > Bars.Last(3).Open && Bars.Last(2).Close > Bars.Last(2).Open && Bars.Last(1).Close < Bars.Last(1).Open && Bars.Last(0).Close < Bars.Last(0).Open)
{
    ExecuteMarketOrder(TradeType.Sell, SymbolName, Volume,InstanceId, StopLoss, TakeProfit);
}

Backtesting the cBot

After we save and build our bot, we can proceed straight to backtesting. If we add the bot to a chart for EURUSD with a 20-pip Renko threshold, we should get encouraging results.

Note

Renko-based strategies use the same data structures as time-based candlesticks. For example, we have used the Bars collection to retrieve our Renko bars as we would have done to retrieve candles from a candlestick chart. This feature allows for developing strategies that can be tested and run on any chart type without the need for any modifications. If we backtest our cBot on a candlestick chart, all operations will still be executed according to the specified rules.

Note

Renko-based strategies can be optimised just like candlestick-based strategies in the 'Optimisation' tab.

In this guide, we have created a successful Renko-based cBot with minimal effort. If you found the article helpful, consider subscribing to our YouTube channel were we regularly post educational content about cTrader.

Subscribe to our YouTube channel