Technical Analysis

How it works

The Technical Analysis Module for your algorithmic trading strategy works by evaluating a user defined series of logical expressions. These can in theory be nested to infinity crating a logic tree with multiple conditional statements.

In addition to the General Configuration Optionswhich need to be defined for any crypto trading strategy, the Technical Analysis module requires a few more variables to be set in order a configuration to be valid. In this post, we're going to explore how technical analysis can be used in an algorithmic cryptocurrency trading strategy by using AESIR's build in Technical Analysis Layer.

You can create TA Logic using the following fields:

Candle Interval

This represents the interval of time that each Indicator (selected below) will operate on. For instance if you are comparing EMA50 to EMA20, and your Candle Interval is 1m, then both indicators will use the same 1 minute interval. 

 

Add Condition

Allows you create a logical expression comparing an Indicator against a different Indicator or an absolute value.

 

Add Logic Tree

Adds an additional logic layer and a pair operator. Without the logic tree, your expression is a single comparison, for instance: EMA20 Is greater than EMA50. Adding a Logic Tree instead of a Condition creates a slot to add more conditions or more logic trees, allowing you to continue nesting more and more conditions separated by a Pair Operator.

 

Select Indicator

Allows you to choose any indicator to be evaluated.

 

Select Operator

Defines how the indicator will be evaluated against the other indicator / value.

  • Equals
  • Not Equals.
  • Greater Than.
  • Less Than
  • Greater Than or Equal
  • Less Than or Equal.

 

Select Indicator / Value

Represents the item that the initial indicator will be evaluated against. This can be any other indicator or an absolute value.

 

Pair Operator

When adding another logic tree, this will create a new Pair Operator allowing you to choose how two or more conditions will be evaluated. The relationship between conditions can be: AND, OR.

 

Examples

We're going to build technical analysis logic that evaluates a simple moving average against another, and ensures that the Awesome Oscillator is above 0 on a 5m candle interval.

Start by selecting a Candle Interval of 5m and then adding a Logic Tree.

Now Add a Condition in the first box. This will check that SMA10 is Greater than SMA50. Now in the pair operator (the input between the two logic boxes) we're going to select AND.

Finally, in the second box we're going to Add another Condition. We would create even more complex logic if we added another Logic Tree instead. In the new logic box we're going to populate the Indicator, Operator and Indicator / Value fields with: AO (awesome oscillator) is Greater than 0. 

The signal is now finished and it will read like so: AESIR will place a buy order when SMA10 is greater than SMA50 <AND> AO is greater than 0. Because we've used an AND operator, this means that both sides of the expression need to evaluate to true before an order can be placed. Similarly, with more complex logic, all or some parts of the expression need to be true in order for buy order to be placed. 

 

Deep Nested Logic

What makes this Technical Indicator layer great is that you can create any form of logic, so long as you're aware of what it actually does. Let's take a look at some more advanced use cases for it. If we start by creating a Logic Tree for our technical analysis algorithm But then instead of adding a condition, we add Another Logic Tree in Each box, we'll end up with a total of 4 Add Conditions. This means that now the first 2 conditions are nested in box A and the other 2 are nested in box B.

This setup will create a logic expression that looks like this:

(SMA10 > SMA50 AND AO > 0) AND (EMA10 > EMA50 AND RSI >70)

The above expression will only evaluate to true if every member of that expression is true. However, if we change the inner Pair Operator from AND to OR, it will now evaluate to true if one of the nested conditions is True.

(SMA10 > SMA50 OR AO > 0) AND (EMA10 > EMA50 OR RSI >70)

You can keep nesting conditions to create deep complex nesting for any kind of technical analysis crypto trading algorithm. If you don't have an AESIR account, you can easily create one here to start creating powerful trading algorithms.