# Case study – creating custom building block – ROC indicator

In this short case study, I will show you how to create a custom block and then how to use it in a real trading strategy. Possibility of extending StrategyQuant with your custom-building blocks without programming is a unique feature that no other software offers.

Firstly let me explain what the custom block is. Every trading strategy consists of entry filters, entry conditions, exits, different calculations, etc. If you disassemble the trading robot into elementary pieces then you will get building blocks. To say it simply, they are bricks which create trading robots.

Before we proceed to our practical example let me explain which kind of custom blocks we can add.

Condition example:
Entry filter for uptrend: Close > MovingAverage(200)
The output is True/False

Price level example:
MonthlyHighestLevel
The output is price level

Value example:
ROC indicator
The output is a number which we can use for other calculations/conditions.

## Creating ROC indicator

The ROC indicator returns the value of the price percentage change during the certain period. If the period is 5 and the price drops by 5% during the last five days then the indicator output is -5. In case of price rise, it would be 5.

ROC formula:

ROC = [(Close – Close n periods ago) / (Close n periods ago)] * 100

### Adding the ROC indicator as the custom block:

1. Firstly, we open “Custom block” editor.
2. Add new custom block – type value:
4. Define ROC formula in SQ
5. Now you can start using ROC custom block in your trading strategies

You can also download the ROC custom block here and import it into StrategyQuant.

In the next article, I will show you a practical example of how to use ROC custom block in the trading strategy.

Subscribe
Notify of
1 Comment
Inline Feedbacks
Martin
25. 4. 2021 10:39 pm

This is a great feature for most users. The process of extending sqx was so time-demanding and error prone given the need of implementing so many templates and both the java and the mql. Just as a possibility for future improvements, the possibility of using previous values of the indicator being defines would be awesome, as many indicators use its previous value for calculations. Anyways thank you for this feature!!

### From Discretionary Trader to Algorithmic Expert: An Exclusive Interview with Rubén Martínez

In this exclusive interview, Rubén Martínez, founder of the La City community and capital manager, shares his incredible journey from his beginnings as a discretionary trader to becoming a successful …

Tomas Vanek

24. 6. 2024

### Interview with Trader That Gained 214 % in 6 months

Could you introduce yourself, what is your daily job etc. Hello, my name is EDAU87. I’m excited to have this opportunity to introduce myself and share a bit about my …

Tomas Vanek

18. 6. 2024

### Realistic Performance Expectations: Algorithmic Futures Portfolios

In this article, we review realistic expectations from trading algorithmic systems through portfolios. We will describe what returns can be expected for different account sizes and different risk settings. The …

Marek Chrastina

17. 6. 2024