The fathers of Russian algorithmic trading education network. I personally trained via their courses and I am endlessly grateful for all the materials I got from them.
When I found out about Wealth Lab I didn’t know how to code but I found out about Financial Laboratory which is the educational project run by Igor and Dmitry. I think if it was not for that project my life as an algorithmic trader might have turned out quite different. The Theory
One of the courses ran at Financial Laboratory project is named as 96 templates and bindings which is a script that let’s you analyze the market. In my article I will try and explain the philosophy behind that script. I cannot provide the script because it is owned by the right of the Financial Laboratory but you can always contact the authors.
The article is styled in a way where I use myself as the story teller but please be aware that all the ideas used for the article are based on the philosophy of Igor Chechet and Dmitry Vlasov from the Financial Laboratory project. Classify
Once you have your first trading system coded and running you are not very concerned with classification or any logic behind arranging your systems into different types and subtypes simply because there is nothing to sort yet.
Once you have ten or twenty of them you start putting them into some kind of folders, naming them and trying to classify them using some kind of logic and once you have a 100 and over systems you get in trouble if that logic and methodology wasn’t clear and efficient enough to help you now work with what you have created.
I classify systems in accordance to the market type where they can be used but I don’t mean NYSE, NASDAQ, FOREX, GLOBEX etc. I mean that before we classify systems, we need to be able to classify markets. Market type philosophy
Mainly, I use two big folders which are trend and flat. So what is the difference?
Let’s discuss this in respect to some kind of price level that we take in a period of time. During trend, once prices break through that level they want to reach new highs or lows away from that level and during flat, prices want to bounce off that level because they have worked out their potential.
If, just for an example, we look at this situation in respect to pivot levels we can say that during trend, once prices break though R1 level we expect them to go further up and we expect them to go further down if they break through S1 level, but during flat we will expect them to bounce back to pivot from either of the levels. That can be true for any level which can be considered mathematically as a price magnet – pivots, camarillas, money zone, initial range, woody, Fibonacci etc.
I’m not considering any candle stick pattern situations that can occur at those levels and signal to us what is going on, I’m only stating that for the simplicity of trade system and market type classification, I use two types of behavior at certain levels, either break through or bounce.
So if we are talking about researching this kind of behavior with price reaction to levels we can definitely work out whether the market will work for break through or bounce systems. In this case we can simply run a backtest of both kinds of systems on the same symbol and see which one works better. However we can go into analyzing the market behavior much deeper and try and invent some sort of market tester aka system classifier. Step 1 – trend or flat
So in order to move on with deeper market type classification you have to decide whether you are going to be trading trend or flat and that means are you going to be buying on potential breakthrough levels or selling.
Pivot levels from above are only an example and to generalize, we can say that there can be market entry signals and it doesn’t matter what they are because certain actions have to be taken when market entry signals occur, depending on whether the system is trading trend or flat globally, the action is one opposite the other, if the market signals buy during trend we buy and sell or short for the same signal during flat. Step 2 – choose market entry type
In order to analyze the market we are interested in more precisely we need to look into main market entry types. a) Impulse entry
So what is it psychologically? When an impulse occurs the market reacts. When an impulse occurs during trend a lot of people believe that this impulse will be followed by other impulses and the price movement will carry on. During flat the situation is vice versa, people tend to believe that the impulse has occurred and the price is not very fair now, so they will open positions opposite to the market movement. Ok, but how does it look like? Well here are a few examples of what an impulse signal can be.
• Candle pattern – candle closing higher than the previous high (whilst not being a dodji during trend, being a dodji during flat not bad is it)
• Price level breakthrough – price channel break through, pivot level break through.
• Sharp Indicator movements – sudden DMI crossover or a short period RSI overbought/oversold zone entry (although this kind of entry is better be considered individually)
• Relative price movement – the candle price range is higher than the average price range over a set period.
I would say the word speaks for itself, any kind of direct and powerful movement can be considered as an impulse. How do you figure out whether it is powerful and can be considered as an impulse, well you simply compare it to the rest of the movements that took place in a period of time, however you have to be very careful with the period because if you look at many impulses in the same direction over a long period of time you can come up with a trend filter.
So this entry type is pretty straight forward. We can test two types of entries and see which ones work better, trend or flat, if we get a market impulse up during trend we buy if we consider we are in the flat market period we sell during impulse up and buy during impulse down hoping for a bounce off. b) Extra filter
That is where the brain breaking trading philosophy comes into play. Before we move any further and actually speak about the next entry type we need to invent a special filter.
First of all let’s say we are trading trend. This is very easy because in order to filter out our impulse signals we can use a trend filter. Let’s not go very far and just swing an SMA under all the candle stick impulse signals we get, pretty straight forward and actually works pretty well. It doesn’t have to be SMA – any sort of trend filter you invent is just fine.
So now you got them all filtered out because you believe that in order for the market to continue moving in the same direction the overall price movement has to already occur under or over some kind of mean line depending on whether you open shorts or longs. Psychologically this confirms our impulse movement and sets us into some sort of safe mode.
What if you are trading flat?
Now here once you get an impulse you expect the price to come back to where? To the exact same mean that we were talking about during trend. So for example, during flat, if we get an impulse down, we are expecting the price to bounce off and come back to the SMA, so therefore the price has to be below a long period SMA for us to open long positions and buy. c) The pullback
Now this is classic. Especially during trend. So many ways to identify it including the famous Larry Connors technique with Connors RSI. You can also simply swing a faster EMA over a slower EMA to see trend pullbacks. Anyway, during trend you are looking to buy at a lowest possible price inside a price pullback and expect the price to continue to move in the trend direction. In this case you are not looking for an impulse but you are looking for some sort of trend pullback situation.
This is a bit more difficult to picture out during flat but we can try and put it all together step by step. So we were, in a previous market entry type, already buying below our trend filter expecting the prices to come back to that price mean. If we now buy below the trend filter and also buy on pullbacks than this will look like some sort of counter trend system. For example we have a trend up, once we go into pullback zone we open our shorts because we want to make money during a pullback.
This is a little different from the same system during trend and it is vital to understand this because that is where you come to think about designing the exit types. During trend we hope the price is going to leave the pullback and continue its way with the trend, so we are trying to catch a turnaround, during flat we are trying to catch the peak in order to make money during the pullback and close our positions if it tries to change direction once a pullback is over. You have a long period slow trend filter that price wise acts like a magnet to attract the pullback and you are looking to enter the market at the start of the pullback and exit in the end. d) The carry on
Finally we can derive a combination of everything that we have just said. This one can be good for adding shares to the position, it can be considered something like jumping onto the ongoing train however it also works as an independent entry type. What happens here is that we wait for an impulse to occur once we have entered the pullback zone.
For a trend situation this looks very straight forward because even psychologically this looks like a confirmation of the trend continuation after a pullback has occurred, it’s like a really careful way to enter the market, because we first get to see an initial impulse, which is then confirmed by a trend filter, at that point we realize that something is going on and wait for a pullback to happen and once it occurs we are not sure, because it might be a turnaround so we wait for another impulse to open positions in the direction of the trend or impulse.
For a flat situation this does look a little wicked and I can only think of a few situations when this occurs. Mainly we are talking about catching the second breath before a good quality pullback or a real turnaround. Sometimes the market does it, for example when it wants to turnaround it doesn’t really do it instantly, doesn’t change direction quickly, so it would form a peak and then enter a small pullback which is enough for us to determine on set trade conditions, after which form another peak, which will be our second impulse and we enter with counter trend positions. Entries summary – the 8 types
So overall we came up with four main types on two main markets flat or trend. That gives us eight possible ideas of market behavior. I can’t say they are the only ones out there but this can be a good start for further analysis which can be very creative and include all sorts of other possibilities and ideas. You might have noticed that each market entry type already, inside its philosophy of entry assumes some sort of further price development.
What I mean is that you don’t just enter because you feel like it, there is a strong idea behind every open position and every single entry can be explained, Jesse Livermore maybe said that a long time ago. Step 3 – Choose your exit type
I guess this part is not as exiting but also involves quite a few methods of how to follow your open positions.
a) Stop and profit – the simplest, the easiest to code, once you have your backtest results and have figured out you win/loss ratio you can easily determine the stop profit ratio.
b) Trail stop – my favorite, price ATR trails, EMA trails, parabolic trails, channel trails, etc. etc. etc.
c) Infinity – just enter long when your exit short and enter short at the same time you exit long, reverse your positions.
d) Time – exit after a set number of bars, exit at the end of the day, period, month, year.
e) Indicator exits – the famous Larry Connors RSI exits, DMI cross exits, EMA cross exits Step 4 – Combine
So overall we have 4 entry types which are impulse, impulse with a trend filter, pullback and carry on. We also have that in two different situations trend or flat. We then have 4 exit types (just to make it easier I dropped the indicator exit because that will give us too many systems) stop and profit, trail, stop and reverse and time. That gives us how many variations of trading systems? Not enough because right here you should also divide by position types and see whether it is better to trade long, short or both. If all of that is taken into account there should be 96. So now what?
To tell you the truth some of these combinations work good out of the box on some markets. All you have to do is tweak your entry and exit methods a little bit with different order types but mostly I would use this kind of system type enumeration in order to get a feel of the market you are attempting to trade.
Say you want to trade gold, you have never traded gold before so how would you know what kind of system will work best for gold? You can use this approach.
If you know how to code then it will be quite easy for you. Just code an enum and stick into the parameters, then use the if logic for various condition selections. However if you don’t know how to code you can buy Financial Laboratory course which is called 96 templates and binders. However the course is in Russian so be aware of that. Hope you found this article useful, good luck and have a great trading experience!