Introduction to the StrategyQuant templating system – Part I

Author: Kornel Mazur

November 28th, 2019

Rating:
1 Star2 Stars3 Stars4 Stars5 Stars (2 votes, average: 5.00 out of 5)
Loading...

I am starting a series of articles where I will dig deeper into the trading strategy creation process in StrategyQuant X. As you might know, this amazing software had been transformed from a basic strategy generator into a complex framework that allows traders to leverage their knowledge and to swiftly create trading robots.

As we are continuously adding new features, some of them may have been unnoticed for our users (transition could become hidden from our users) which would be quite a pity.

So let me start with the new templating system as this is one of the essential parts of the new StrategyQuant which defines the kind of generated strategies.

In this article I will focus mainly on the introduction and basics of templating system and show you how to set up basic conditions in SQ.

What is StrategyQuant template system?

There are many kinds of trading strategies. Trend following, breakouts, pullback, London breakout etc. Template is the base part of the strategy creation process, which defines what type of strategy logic StrategyQuant will generate. To understand the process better, let me describe its steps in more detail.

The first step: Building blocks


Building blocks

It can be indicators, operators, values etc. Simply put, these are the bricks you build your new house from – in this case – your trading strategy. In StrategyQuant, you can easily define which building blocks will be used for generating a strategy. SQ supports more than 40 indicators and various predefined conditions.


Building blocks in StrategyQuant

The second step – conditions and levels created from building blocks

Generating conditions

In this step, we put together single building blocks and generate strategy conditions. In the table below, you can see several examples of building blocks.

ConditionDescription
Close>MovingAverage(200)Filtering condition which defines a rising/growing market. Very efficient especially on a daily timeframe (D1)
Highest[40]+0.3*ATR[14]Entry level for placing stop orders
RSI(20) < 50Indicates oversold market, buy filter

StrategyQuant uses Genetic or Random engine for generating building blocks, you can also use ready-made conditions which are called “Signals”.

Ready made conditions – Signals

 

The third step – putting it all together into a strategy template

Let’s say you have two trading conditions: Condition 1 and Condition 2. Both are generated randomly or during evolution from the preconfigured blocks.

Condition 1: Close>MovingAverage(200)

Condition 2: RSI(20) < 50

Now it is time to create your first basic strategy. Please note that it is not a real world example and it was simplified for demonstration purposes.

Strategy template could be something like:

————————————————————————

IF [Condition 1] and [Condition 2]
THEN Buy at Market price

————————————————————————

The final generated strategy will then be:

IF Close>MovingAverage(200) and RSI(20) < 50
THEN Buy at Market price

The condition “placeholders” in strategy template were replaced with the actual conditions. So the template defines where exactly the conditions should be used and how the resulting strategy will be generated.

Now let’s say we have this strategy template:

————————————————————————

IF [Condition 1] and [Condition 2]
THEN Buy at Market price

IF [Negation of Condition 1] and [Negation of Condition 2]
THEN Sell at Market price

————————————————————————

You can see that strategy template allows you to use also a negation of a condition which will be created automatically.

If we’ll use this template, the generated strategy will be:

IF Close>MovingAverage(200) and RSI(20) < 50
THEN Buy at Market price

IF Close<MovingAverage(200) and RSI(20) > 50
THEN Sell at Market price

Let’s try third example of yet another strategy template:

————————————————————————

LongEntrySignal = [Condition 1] and [Condition 2]
ShortEntrySignal = [Negation of Condition 1] and [Negation of Condition 2]

IF LongEntrySignal and not ShortEntrySignal
THEN Buy at Market price

IF ShortEntrySignal and not LongEntrySignal
THEN Sell at Market price

————————————————————————

If we’ll use this template, the generated strategy will be:

LongEntrySignal = Close>MovingAverage(200) and RSI(20) < 50
ShortEntrySignal = Close<MovingAverage(200) and RSI(20) > 50

IF LongEntrySignal and not ShortEntrySignal
THEN Buy at Market price

IF ShortEntrySignal and not LongEntrySignal
THEN Sell at Market price

You can see that we have used the same conditions, but we were able to generate three slightly different strategies.

And that it is. By putting building blocks into your template, you will easily get strategy logic. You can see that by using different strategy templates you can customize StrategyQuant strategy creation process in almost limitless ways. Later within this series of articles, I will introduce l other types of templates which you can customize based on your own ideas.

In the next article we will move into StrategyQuant and test templates by yourself.

Leave a Reply

Please Login to comment