How to use the Pattern blocks correctly in Level2

Getting started with the idea behind Pattern Blocks implementation in your strategy on Level2

Published on Tue Mar 12 2024

Reference Guide

**Price Data is a special block that comes into the data category, however, does not accept any input nor it throws any output. ā€‹ Price Data can be considered as the starting point of the strategy that takes into account the price when back test or forward test is run. ā€‹ If you'd like to use real time price in your strategy then consider using the Current Price Block.

**Action block does not give any output to the users. Instead, when running in background, it instructs our services when to place an order with other meta-data (stop loss, take profit)


Using Patterns is very simple on Level2. Below, we've documented what patterns are and how you can combine pattern blocks to enhance your strategy.

Pattern Block

Pattern Blocks are additional verification checks you can apply in your strategy.

Please note: These cannot be treated as inputs to comparators (Logic blocks) since the output value is not a numerical value, but rather a Boolean one.


For illustration:

Pattern Block Inputs

A Pattern Block can accept only one input.

If you're sending two inputs then it might be that your strategy logic is incorrect.

A common mistake that happens is when you directly connect an indicator's output to a pattern block. This is incorrect since the output of indicators is an array of numbers and if we directly feed it into patterns then the pattern block will not know what to do with those numbers (it cannot give true or false). To solve this please refer to this example where we've used two indicators and then a logic block.

Pattern Block Outputs

There are only two ways in which the Pattern Block's output can be connected to other blocks. Only one output originates - In this case the output is generally connected to the Action Block. Two outputs originate - In this case the output is generally connected to indicators or Data blocks like High Price/Volume and so on..

That being said, here is the correct way to use a pattern block

You can also attach two or more pattern blocks like this


If you want to know more about patterns and how you can use these in your strategy then please reach out to us on contact@trylevel2.com.