New version 1.5 of Tradingfuturo Order Flow available

 

In this new version we have included the naked POC that are the areas where there has been more trading volume and have not yet been touched by the price.

 

 

We also added an Order Book (Level II) that charts the volume of orders

 

Also a mark where the horizontal imbalances occur (it doesn’t have yet the diagonals programmed ) that can be configured by the ratio of unbalance or the difference of orders.

 

 

This version fixes two errors. One that did not allowed other indicators to graph on the same chart. And it corrects the cumulative delta calculation that instead of being calculated from the beginning of the session, was calculated from the first bar that was rendered which was incorrect.

It includes many new configuration options as configuring the volume profile and small adjustments. The details are in the distribution page of the forum:

http://tradingfuturo.com/forum/Thread-TF-Order-Flow-V-1-5

What is Algorithmic Trading

What is algorithmic trading?

Algorithmic trading is a trading style in financial markets. Stock, Forex, Futures, etc, characterized by following those markets with a set of objective rules that generate entries and exits to the market. Basically an informatic system evaluates certain rules taking market data and executes orders towards this market automatically. The decisions are taken by a computer in an autonomous way.

What is an algorithm?

An algorithm is a set of rules intended to solve a problem in a predefined way. This simple and brief definition is a bit abstract, let’s take an example:

Imagine that we need to make decisions during trading. So we designed a system based on moving averages (very primitive and simple to serve as an example).

  • If the MM20 becomes larger than the MM50 buy N lots.
  • If the MM20 is made smaller than the MM50 sell N lots.

Where MM20 is moving average 20 and the MM50 is moving average 50.

Thus a computer system monitoring and calculating this data can execute automatic orders all the time and execute them in a very fast way. This is a very simple and very bad algorithm but as an example it allows us to understand how a system of these would behave. Some trading systems are very complex and even employ Artificial Intelligence, machine learning, genetic algorithms etc.

What are the advantages?

An obvious advantage is that it allows a market presence uninterruptedly, something that a human being can not do unless it is a team that takes turns.

Another advantage is that they can be run in many markets at once and even using correlations between them. Example if the price of iron falls this will cause a fall in the price of corn? These correlations can be determined by statistical analysis. Did the price of iron fell? Is it time to sell corn contracts?

This algorithmic trading mode also allows to operate during the whole session without experiencing the slightest fatigue or reduction of its performance. In addition, these systems respect the rules to the letter and do not experience any emotion during trading. This allows to operate with zero psychological affectation. In other words, market movements and mass psychology do not cause any emotional effect on the system which is one of the main sources of bad operation. So we can say goodbye to psychotrading.

It also has verifiable risk / benefit expectations. Algorithmic trading is based on tests and not on assumptions as they are subjected to rigorous back-testing and robustness tests before starting to operate.

These allow another advantage and is channeling orders to the market only at the precise moment. In other words,  not leave an open order waiting for it to execute but when the indicated moment arrives, execute the order. This allows to not show the cards to the rest of the traders that are operating in the market.

And disadvantages?

One of the obvious disadvantages of these systems is that if they contain errors they can cause huge losses.
The other disadvantage is that past earnings do not imply future earnings as markets are always evolving and this triggers other disadvantages that we will explain later.

How to reduce those disadvantages?

One of the things that is done to reduce the disadvantages of algorithmic trading is to provide them with a catch system that will stop them if their performance starts to be very bad.

Example if one of these algorithmic trading systems has 3 or 4 consecutive losses or if it is not so profitable, it stops and notifies that it has stopped for a human to intervene.

This is not perfect and certainly there have been reports of large losses due to errors in these systems, such as Knight Capital. But is like a lifeboat in case the ship starts to sink. Of course these systems also operate with risk management and are also monitored not only by humans but also by other systems developed for this purpose.

The other thing that is done is to put them to work in a Timeframe or period of time. After this period, its performance is evaluated, its faults analyzed, it is readjusted and restarted in another Timeframe.

That is why these systems require constant maintenance and software engineers able to adjust complex programs. And this triggers another disadvantage is the high cost of maintenance of these systems because they require highly trained personnel not only in trading but also in software engineering that must work very fast.

That is why its obsolescence is very fast. A high value system that worked excellently a while ago today may simply be junk code with very little value. They are short-lived.Unlike other systems that are made and then are being exploited / marketed for years.Therefore investing capital in developing them carries a high risk.

As a result, these systems are not used by everyone. Generally large organizations that because of their volume of capital can afford to pay these costs and risk that capital.

Not everything ends up there

Another problem with these algorithmic trading systems is that they are adjusted with historical data. In other words, actual performance may vary. And this performance as it is simulated are not real orders to the market. What happens, that the orders to the market affect the price in the market but in simulated no. Therefore you can never know exactly how these algorithms will work in reality and you can only know an estimate. Although this can be very close to reality with a very acceptable margin of error. This becomes a variant of the observer’s effect, in which the object to be measured is modified when making the observation.

What happens is that usually orders of low volume in a large market cause little effect. Usually, we must clarify. But as it is said in the markets the flapping of a butterfly in Hong Kong can provoke a storm in New York if a domino effect occurs. This is known as the Butterfly Effect. Something that HFTs exploit a lot in some of their strategies that I will talk about later. These use low latency algorithmic trading.

Conclusions for the retail trader

Why the retail trader? Because he/she is often ignorant in the matter and is the most abused, product of that ignorance. So with this we can help in such case. Well an important conclusion that can be drawn from all this is that sometimes we see on sale robots especially Forex that claim to be the holy grail of trading. A robot that was made long ago and is shown in videos how it operates and earns reaching tens of thousands of dollars. And of course sold at a very high price. Which is not necessarily false or unbelievable.

What is the problem? I think some readers are already imagining. The first is that many are not maintained and / or are not made by people with solid knowledge in the subject. And starting from the axiom (or premise) that past earnings DO NOT imply future earnings the result is that not all but most of these robots are a scam. The fact of showing a robot winning in a video of the past does not imply that when you buy it, it will do it or that it will cover your investment.

In the first place a robot to work well has as we said before, needs having undergone a rigorous back testing. And from there it can be inferred that many of these people that market them do not have solid knowledge or at least pretend not to have them. And in second place. It only starts to work in a timeframe. Then it must be re-adjusted / modified. Even this is no guarantee of anything. So if someone sells you a super robot and does not assure you that he/she will be updating it, is definitely ripping you off.

If still goes and tells you that is going to make you a millionaire with it, is inherently false. First because the only thing that can be talked about in all this is probability, because in the market there is never anything 100% safe even for the big operators. The other is that the market gains or losses are directly proportional to the capital with which you operate. No matter how good a robot is, if it does not operate with enough capital it will not have great results. At least not in a short time. Well, it can be assumed that the accumulated profits eventually create a relatively acceptable capital if you are trading effectively. As trading can become something similar to a compound interest or an arithmetic progression. What happens is that by the time it starts to approach a “respectable” capital doing trading, most likely that robot will become hopelessly obsolete.

Another important issue to consider is the following. Many of these robots are sometimes marketed preaching to the four winds that have artificial intelligence, that is intelligent. That is actually not a big deal today. Artificial intelligence is many things and can be very good but can also be lousy. In fact it is very simple to put “artificial intelligence” to a robot. Result, it can not be concluded that because a robot has artificial intelligence is already good. Perfectly a well planned strategy that has nothing of artificial intelligence can perform better in a market than many of these “smart robots.”

I imagine some readers are wondering … I know what I can not use to guide me and I have to avoid, but … then how to know if a robot is good?

I think it’s a good question and more than that the question I think is: How do we evaluate a trader, whether it’s human or not, and decide whether it’s good or bad? How do we decide which is best when comparing? This is already coming out of the article and I will leave it in an upcoming publication, although it is not a question that has a single answer because there are many variables to consider. I tell you that not only does the net profit matter and this is simply the most obvious of the variables but not the most important.

Note: The theme image was created with a Markov Decision Process graphic and was taken from raster to vectorized to be able to be expanded with a convolutional neural network with later manual adjustments (the network was not made by us but as a curiosity).

The adjustment graph was taken from the Department of Statistics and Mathematics Finance at the University of Toronto.

How Google Alpha-Go works?

Recently there was in the news that champion Go player Lee Sedol was defeated by an AI. This was striking since experts were predicting that to get a computer play Go at the level computers played Chess was something to happen within 10 to 15 years.

How they did it and why was supposed to be such a difficult problem? They used an interesting trick. Existent technology used in an unconventional way.

But first lets talk about complexity. Let’s start with noughts and crosses puzzle. In game theory you can represent all stategies of a player in a form called extensive form. Or a tree. In this game players take turns. Same as in Chess and Go. So with every possible move you could create a tree where all boards are represented by nodes and edges are the possible moves. By making the computer take the moves where it wins it eventually always wins.

For noughts and crosses the number of possible boards is relativelly small. It has 9 moves so the tree has 9 levels and removing symmetries there are 138 game ends. This is quite easy to represent for a computer, even microcontrollers can deal with that. This is a game known to be perfectly solved. You will never defeat a computer playing it. All you can get is a draw.

This is done with an algorithm called minimax. This algorithm’s main theorem was stated by french matematician Émile Borel and applies in game theory to zero sum games. Exactly it is is the largest value that the player can be sure to get without knowing the actions of the other players. Or in another way, the smallest value the other players can force the player to receive when they know his action. If you want more details please read the article.

For minimax 3 things are required:

  1. A way to generate the boards on each move.
  2. A way to evaluate the generated boards
  3. Pick the best next move

Now lets jump into chess. Chess is a game with a larger board, that is to represent each board consumes more memory. There are tricks to reduce the size but on average it weights more. But then each possible move in chess starts at 20 and the average game moves is 40-50 moves. This ends up being so large that no computer can properly deal with all possible board representations. Let alone the calculations to compute the boards.

It is not feasible to use that bruteforce like approach. So how computers defeat human players? Well thing is you don’t need all the boards for that. All you need is to evaluate enought forward steps taking the best moves and forget boards when things start to look bad for you. This is called prunning.

What is this? Well it is based on the assumption that once a game is startig to look bad is simply better to not waste time working on something that likely is not going to get any better and assume it is a bad move. And since bad moves are usually the most common, this effectively reduces a load of processing time and memory that otherwise would be mostly wasted. But prunning brings a problem and is that it can potentially loose a good move that started to look bad but wasn’t actually a bad move and could have ended up in a victory. This is called the horizon problem. To overcome the horizon problem an algorithm called apha/beta prunning is used. However interesting as it is, its variations and optimizations, we are not going into the details, we’ll just leave the link. So with more than 18 plays ahead, specialized hardware in chess (chips that generate boards) and many processors (CPUs) Deep Blue supercomputer beated in 1997 the champion chess player then. By then Deep Blue used minimax but modern programs use prunning.

Now what is the problem of Go? Go is a very simple game to play, with very simple rules. There is a 19×19 board with black and white stones an players take turns to capture areas. But don’t be fooled by that simplicity. It is a far more complex game than chess for computers. Why? Three things:

  1. Average number of moves for Go is 250 possible moves
  2. The average moves in each game is more than 300 moves
  3. Not easy to evaluate how good or bad is a board for a player (champions can’t even describe exactly what makes them make a move)

How to solve this? Well something called Monte Carlo Tree Search is used sometimes when there is no idea on how to evaluate something or is too complex to calculate.  For instance to calculate some integrals. Monte Carlo are a set of probabilistic experiments based in randomeness and statistics. And Monte Carlo Tree Search is a probabilistic search that converges to minimax with enought sampling (enought in this case is very high, assume infinite). How it works? Basically you take a board and pick a couple of random moves and just start playing to see how many makes you loose or win. And then with those numbers you can estimate how good or bad is the move with some certainty. The more evaluations of moves you perform the more it converges to minimax so anyone can selected how close or far they want it to be. Get the point where this is heading? Is not only the complexity of the board and moves, is also the complexity to evaluate the board! Not good. At least not to defeat a professional Go player in a limited time.

Monte Carlo Tree Search
Monte Carlo Tree Search

So how Google engineers solved it in Alpha-go? Neural networks. A computer simulation of biological neural network to be more precise. And the kind known as Deep Neural Networks. They are actually quite old and everywhere today but using them for this was the novel thing. So how they used neural networks there? Well neural networks can act as classifiers. They can say this is in the picture looks more like a dog or more like a pigeon and sort of. But how about if you make neural network classify a Go board or a move into good or bad? Bingo!

Alpha-Go uses 3 networks:

  1. The policy network
  2. The value network
  3. The fast rollout network

The policy network looks for the current best moves in a board. But neural networks require a lot of processing and can be slow so it was reduced in a way it fails a little more but takes less time to evaluate. The value network predicts the winner player based on current board. So it is used to make a double check on those moves selected by the policy network  in order to improove on the previous simplification. And lately the fast rollout network (this is a small but fast network) picks the moves to feed the monte carlo tree search algorithm. So instead of picking random moves it is fed with random smart moves. And that running in a cluster of computers with CPUs and GPUs performing the search defeated professional players. Machine learning in essence combined with Monte Carlo tree search.

Of course those neural networks are not that easy to obtain. They require a lot of processing therefore computing power for the reinforcment learning. Self playing and evaluation of preexisting data. Actual human Go games. And there it is, half a century of artificial intelligence research.

You wight be wondering. What does this has to do with trading and why do we care? Well the big question is… If computers can defeat a champion Chess player or a champion Go player wouldn’t they be able to outerperform top traders? Actually the big question I think is… When?

If you are interested details of the implementation of AlphaGo here is the link to the article in Nature Magazine

http://www.nature.com/nature/journal/v529/n7587/full/nature16961.html

Theme image taken from Nature Magazine, Monte carlo tree search from wikimedia commons.

Order Flow indicator for Ninjatrader 8

Notice: This was the first version, the latest version is available at the forum with far more features

https://tradingfuturo.com/forum/Thread-TradingFuturo-Order-Flow-Educational-version-1-7-available

Some may remember that some time ago were experimenting with NinjaTrader 8 and indicators (sorry in Spanish only, we were not posting in English then). Maybe some have also seen that we have been publishing tutorials explaining how they work and some indicators we’ve posted videos of some premium high-cost commercial indicators of very high quality. Some we use them and some we study them. Well, we decided we wanted to develop a good order flow indicator ourselves. This not only allows us to give classes with our own tools but to operate with a quality indicator and allow us to offer it to our students.

Trading Futuro Order Flow

This indicator we developed is not among the most advanced at the moment but it is useful to understand the Order Flow and COT. However now as it is a software that although has been tested and debugged to correct errors may still contain some that could cause losses if used in real Trading (this is a serious warning). Therefore it is not recommended by us for that activity yet. However, we will release it as beta version so users go reporting errors that can find and so they use it as educational material. And also so people gets to know it. This is a first version that does not contain some key signs to be an indicator of higher level, but it is a step in that direction. It is sort like intermediate. Now, it is a truly order flow indicator with all it takes in that regard. Soon we will release it to the public.  Persons wishing to obtain it can follow us on our channels, Youtube , Facebook and/or Twitter to receive notification of release and be able to download.

Update:

Latest version available in this forum thread: https://tradingfuturo.com/forum/Thread-TradingFuturo-Order-Flow-Educational-version-1-7-available