Having tested and used a buy-and-hold strategy similar to Clenow since 2020 or so, I had to learn the hard way that it makes a difference to see a 35 % drawdown in a backtest graph, compared to seeing the savings shrinking 35 % in reality in the past 18 months.

Therefore I would like to take the good things from Clenow and to develop a long-only trading strategy, based on Renko principles.

Compared to classical chart models like KST (know sure things), I have the impression that trading with a Renko system is much more unagitated.

Trying to model this in the simplest way in AmiBroker showed me that I have limits in knowing how to apply AFL. Therefore I would like to ask for help in this forum.

My questions are:

- How can be calculated with 2 % Renko bars in AmiBroker? As it looks is there a function â€śRange Barâ€ť, but I could not find any definition or example how to use it in backtests.
- How does the formula â€śClose higher than EMA 10â€ť look like when the EMA10 shall be calculated from Renko bars?
- And: How does the formula â€śClose below EMA10â€ť look like, when calculating with Renko bars?

I would appreciate if somebody could help me for the first first steps forward.

The backtesting framework I would like to use looks like this:

```
//// Formula 36 "Renko Strategy", Revision 1, February 2023
//
// Trade only when S&P 500 > MA 200:
// Switch to S&P symbol to calculate broad-market timing
SetForeign( "A0AET0" ); // S&P 500 in Tai-Pan EOD data
// now calculate, based on S&P 500:
MarketIsUp = C > MA( C, 200 ); // here C represents closing price of S&P 500
MarketIsDown = NOT MarketIsUp ;
// Go back to original data (current symbol):
RestorePriceArrays();
// Definition of lot size
NumPos = 11;
SetOption( "MaxOpenPositions", NumPos );
PositionSize = -100 / NumPos;
// Ranking with highest RSL in past 5 years
// PositionScore = 1000 + (Close / MA (Close, 1280));
PositionScore = 1000 + ((Close / MA (Close, 256)) + (Close / MA (Close, 128)) + (Close / MA (Close, 64)));
// The following 20 lines or so are based on the following recommendations:
// https://forum.amibroker.com/t/how-to-identify-and-define-trading-days/23630
// https://forum.amibroker.com/t/how-to-sell-all-titles-after-a-defined-period/23853/6
// Many thanks once more to Beppe, Fxshrat and MacAllen for your help
// Definition of trading periodicity
mth = Month();
dow = DayOfWeek();
mth_mod3 = mth % 3;
hy = mth % 6;
NewWeek = dow < Ref(dow,-1);
NewMonth = mth != Ref(mth,-1);
NewQuarter = mth_mod3 * !Ref(mth_mod3,-1);
NewHalfyear = hy * !Ref(hy,-1);
NewYear = Year() != Ref(Year(), -1);
PeriodStart = NewWeek;
// PeriodStart = NewMonth;
// PeriodStart = NewQuarter;
// PeriodStart = NewHalfyear;
// PeriodStart = NewYear;
// TradingDay = PeriodStart;
TradingDay = BarsSince(PeriodStart) == 1; // Second day in period
// Buying conditions
Bcond1 = MarketIsUp ;
Bcond2 = TradingDay;
// Here to define: C > MA (10), but in Renko. How can this be defined? Size of the Renko tiles should be 2 %
// Remove "//" in the following and fill in formula
// Bcond3 = ....................... ;
Buy = Bcond1 AND Bcond2 AND Bcond3;
// Selling conditions
Scond1 = Ref(TradingDay, 1) == 1; // REFERENCE TO FUTURE DATE (not using quotes)
// Here to define: C < MA (10), but in Renko. How can this be defined? Size of the Renko tiles should be 2 %
// Remove "//" in the following and fill in formula
// Scond2 = ....................... ;
Sell = Scond1 AND Scond2;
```