Superalgos Protocol V0.1 — the Short Version, for Experienced Traders.

Julian Molina
Oct 14 · 10 min read

A scalable framework for developing and automating your trading system.

Image © WHYFRAME, shutterstock.com

In conceptual terms, the Superalgos Protocol determines the structure in which all the information regarding a trading system is stored and — at the same time — provides a clear guidance on how traders using the various tools developed and distributed by the Superalgos Project shall create and automate their strategies.

In practical terms, the Superalgos Protocol is a file with a specific format capable of holding all the information concerning any number and variety of trading strategies. In its current early version, the protocol is simply the description of a JSON object which defines the desired automation.

The protocol allows us to standardize the way in which we describe strategies, so that the tools we develop to create or modify, visualize, backtest and deploy strategies can handle all types of strategies in a standard fashion. It also allows strategies — and even pieces of strategies — to be portable, along with many other features that will become possible in the future.

In this piece I will lay out a logical framework for developing your trading system. It is this framework that the protocol feeds from.

As the framework evolves, so will the protocol, incorporating the processes distilled in the framework. This will enable the various Superalgos tools to adopt the new standards, providing more and better features to develop more complex, robust and advanced trading systems.


The Basics

In terms of structure, you can think of a trading system as a hierarchical arrangement organizing the actionable aspects of your investment plan.

The structure would be quite large and complex if you were an Investment Bank, but can be rather simple for traders just starting out.

Simplified framework diagram

The first order of things is determining how much money you will be working with. This is your capital, and a crucial aspect to keep in mind is that there is a finite amount of capital.

You will need to manage this capital.

You will need to preserve it.

And you will aim to increase it.

The market refers to the pair of assets you wish to trade with, for instance, BTC-USD, ETH-BTC, etc.

Choosing a market is a strategic decision that you need to make, and — of course — you are free to choose more than one.

The third order of things is deciding what your base asset is. That is, what asset you wish to stand on when you are out of the trade, with no open positions.

The framework defines a strategy as a set of actions occurring in stages, designed to achieve a specific goal within a broader plan, via executing trades.

This concept is fundamental to the methodical aspect of the system, as it provides a framework to run every strategy with the exact same logic, which certainly contributes to developing a scalable system that may grow to any number of strategies.

Strategies are played in four stages

The set of rules and formulas comprising a strategy can be anything. They may be based on Technical Analysis, incorporate fundamentals or sentiment data or anything else you may think of.

The definition of strategy refers to trades

A trade is the process that exchanges the base asset for a second asset and that — after some time — exchanges back the second asset for the base asset. The first and foremost rule of a trade is to preserve capital and its main goal is to increase it.

With all that in mind, let’s assume you have a number of strategies ready.

When do you start trading?

How do you know which strategy to use?


Stage 1: Trigger

Those two questions lead you straight into Stage 1 of your strategy and point to the first characteristic that needs to be present in it: the rules or conditions to trigger on the strategy.

The anatomy of the Trigger Stage

I call this particular set of rules a situation, in the sense that you are trying to determine what is going on with the market and if the situation is right to use a certain strategy.

Put in other words, you define situations in which you wish to use a certain strategy and each situation is described as a set of conditions that need to be met in order for you to consider starting to use the said strategy.

When the conditions for any of the situations that would trigger a strategy are met, I call this a trigger on event, meaning the event activates the strategy.

A trigger on event signals an ideal time to activate the strategy and look for the opportunity of taking a position.

To take a position, you will too define situations.

In this case, when the conditions that define a situation are met, this marks the take position event, that is, the moment to enter the trade.

Are you starting to see the pattern?

Your strategy is guided by predefined conditions that — when met — define situations that determine that a certain event will take place.

Now, what happens if the take position conditions are not met?

This leads us to understand that, just like you had a set of rules to determine when a situation seems appropriate, thus triggering on a specific strategy, you should also be able to analyze when the market has shifted out of those conditions — therefore cancelling the potential for taking a position — so that the strategy can eventually be triggered off.

Before taking a position, it will be necessary to define the amount of base asset that you are going to risk in the trade — what I call the size of the position — which points back to one important concept I touched on before: capital.

This is when you start managing your capital.

Notice how the Stage 1 diagram above makes a clear differentiation between Size Definition and Capital Request & Allocation.

This is because each of those concepts are completely independent of each other at a conceptual level, and because in larger organizations, different people may take responsibility over each of them or co-participate in the process.

When setting up your strategy, you will describe a number of situations, each defined by a set of rules or conditions that — when met — indicate that the moment is ripe for taking a position. I call this the take position event.

Taking a position refers to the act of entering a trade, that is, placing the orders at the exchange. These actions are actually taken in the next stage, during execution.


Stage 2: Open

You have decided when is a good time to take a position. Good.

However, in order to complete the trade — that is, to buy back the base asset — you also need to define the rules to exit the position, or what I call the take profit and stop formulas.

The anatomy of the Open Stage

The next step is defining two separate rule-sets for exiting the position: take profit and stop. These rule-sets are most likely expressed as mathematical formulas.

It is important to note that setting constant values for take profit and stop is certainly a simplistic approach, and that a lot more efficiency can be obtained with more dynamic formulas.

Such formulas may take into consideration the actual price movement, momentum and as many indicators as you may wish to factor in the analysis.

You have identified that the moment is right to take a position, now it’s time to actually go and do it.

Why would you want to think of this as a two-stage process?

For starters, there are further decisions to be made: are you placing a market order or a limit order?

Moreover, the complexity of the execution depends on several factors, the most relevant being the size of the trade and the liquidity of the market.

Large orders need to be fragmented, sometimes even across different exchanges. Also, the position may be taken at different prices, or along a certain period of time.

It’s important to notice that the current V0.1 of the Superalgos Protocol does not manage such level of complexity at the moment of execution, but it will in the future.

For the time being, the protocol assumes your orders are rather small, in the order of magnitude that your exchange of choice can handle fine in a single order.


Stage 3: Manage

A trading system corresponds to a lower level logic in relation to the strategic aspects of trading. The system serves to structure the processes and methods that you will use to implement your trading strategies.

What follows are a number of considerations that aim to increase the efficiency of your system: the opportunities to manage the trade while you have an open position.

The concept of managing the trade means that the formulas to determine the take profit and stop may change as the trade develops.

The typical situation in which you may want to change your original take profit and stop formulas is when the trade seems to be going well in your favor.

It may be in your best interest to manage both stop and take profit, moving them in the direction of the trade as the market moves, allowing some leeway for a larger profit than expected and at the same time cutting the potential for a loss.

How does all this management translate in the framework?

The management of the trade is handled in phases.

Actually, the management of take profit and stop — while correlated — is done independently of each other, therefore, each concept has its own set of phases.

Trade management involves managing the stop and take profit events in phases

Changes to take profit and stop formulas respond to the same kind of logic you used to set the original values. When a situation defined by a set of conditions is met, the event indicates that take profit or stop formulas shall be changed. At the moment those predefined conditions are met, you enter the next phase. Keep in mind that the trade is in constant development, so there may be as many phases as you deem appropriate for your particular strategy.

Chart notations indicating changes of phases on take profit (green) and stop (red). Horizontal red bars represent a dynamic stop at each candle interval while horizontal green bars represent a dynamic take profit.

The idea of having different phases comes from the notion that big market moves tend to provide clues as of what may come up next.

For instance, rallies may accelerate as more traders join the move. Recognizable patterns may emerge. Signs of exhaustion may be identified.

All of these considerations should feed the dynamic analysis performed as the trade develops, and may be contrasted with the predefined conditions that may push take profit or stop further, entering one phase after the next.


Stage 4: Close

The Closing Stage has very similar implications to what I explained in the Opening Stage in regards to execution.

While it is true that the trade management process takes care of making the decisions as of when to close the position by managing the take profit and stop, the actual execution of the exit may require a number of considerations when dealing with substantial amounts of capital.

It is for that reason that I propose to understand execution as a separate stage, while it may not be required in practical terms if you are trading a small capital. If that is the case, then your trade management includes the actual execution and you don’t need to consider any other variables.

This is in fact what the current V0.1 of the protocol can handle at this point in time.

While it is sometimes disregarded as a boring task, record keeping is a fundamental part of the process and should be clearly implemented in your trading system.

The tools delivered by the Superalgos Project make sure you keep track of each of your trades, with all the basic information, such as date of opening, reasons for entering the trade (conditions met to take the position), take position price, initial and last take profit and stop, return on the trade (%), profit & loss (expressed in your base currency), duration of the trade and more.


Further Levels

So far, I covered the basic framework — what I call Level One — analyzing the four stages of a trading strategy.

The complete basic framework diagram

Needless to say, there is a lot more depth to the subject of trading systems.

For instance, two of the most relevant subjects that still haven’t made it to the protocol are capital allocation and risk management.

We are working on that.

In the meantime, it’s up to you to get up to speed with a solid foundation for you trading system by creating and automating your strategies using the various web-based tools the Superalgos Project makes available free of charge, embodied in the Superalgos Platform.

Paired with the Superalgos Protocol, these tools allow you to create, customize and share strategies through a graphic user interface (GUI).

You may analyze the outcome of strategies in (almost) real time through a simulation engine with historical and up-to-date market data.

Once happy with your strategies’ output in the simulation, you may deploy your strategies as fully automated bots, and trade live.


You may join our Telegram and use our existing trading intelligence to trade with your own crypto assets, free of charge. You may also join the project and contribute to building our Collective Intelligence from the inside.

Superalgos

A collective trading intelligence

Julian Molina

Written by

I’m a lifelong entrepreneur and co-founder of Superalgos.org, an open-source project building a Collective Trading Intelligence.

Superalgos

A collective trading intelligence

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade