Setting up a trading algo that works smoothly, like a well-oiled machine, is not a trivial endeavor. 沢山あります, many parameters that you have to take into account. It begins with the signals your algo is generating to the margins in your account, ボラティリティ, gains and, もちろんです, リスク. Certainly you’ve used our previous tips to build your algo and to draft your strategy. So how do you incorporate all those elements and optimize your algo for the greatest precision?
How do all the quants make their algos run smoothly like a Swiss watch? You have to treat your algo like a machine, built up with numerous mechanisms. Because of course, that’s what an algo really is. I like to call those mechanisms boxes. Now don’t despair if you think it all sounds a bit too complicated. By the time you reach this article’s conclusion you’ll have realized that it’s all quite simple and logical.
An Algo Made of Boxes
So what is the approach quants use that I like to call boxes? You divide your algo into separate mechanisms, or boxes, あなたがする場合. Each box will become a stand-alone mechanism that receives input data and generates an output. There will be one box that we can consider the brain; that box decides if it is a go/no go for the specific trade. The brain box gets all the inputs from all the other boxes.
Algo Boxes
Signal Box- The signal box scans prices and parameters, such as the moving average or any other condition you have written into it. 基本的には, these inputs are the rules of engagement you had early written for your algo. One simple rule could be, しましょう, 14 days moving average < 30 days moving average = signal to sell. 通常, this box will be running prices in several pairs.
他の言葉で, its input data and its output would normally be three parameters; an entry signal, a recommended stop loss and a limit. もちろんです, もう一度, these inputs are according to the parameters you have already defined.
Risk Box- The risk box, as its name implies, is the box in charge of risk monitoring. This one is a bit more complicated. The risk box gets input from several sources. It gets the risk, すなわち. stop loss required, from the signal box. さらに, the risk box constantly reads your available margin.
Its output is a go/no go on each trade that exists, based on the parameters you entered. たとえば, how much you want to risk in total or the minimal available margin to be left in the account.
Let’s say you have a free margin of 11% and you set up a minimal margin of 10% in the risk box. The signal box will send output of an upcoming trade.
The risk box can calculate that the executed trade would take 2% from your remaining margin. You started with 11% so that would leave your free margin at 9%. したがって, the output from your risk box will be a no go for this trade.
If you had had 13% free margin rather than the 11%, the output would be a go. もちろんです, there are many more options to program into this box but this is the simplest one.
Volatility Box- The volatility box might be the most complicated to program. しかし, volatility charting is something we covered fairly thoroughly in these articles – ボラティリティ & あなたの貿易, ビクスの世界, ビクスの代替を使用. The box’s task is to chart market volatility and provide an output if volatility is about to change dramatically. A major change to volatility could, もちろんです, warrant a change in your strategy.
Execution Box (aka the Brain Box)- Easily can be considered the most important box of all. This box is in charge of making the finally decision. It gets input from all the other boxes and decides if the trade should be opened or not. It also decides if a strategy needs to be changed.
たとえば, if the volatility box signals an upcoming surge in volatility the execution box may decide to close some trades. Or it could instruct the signal box to change into a secondary signal model suited to high volatility. There are many other ideas that you can program into it.
How Boxes Help You Win
All of those boxes can help you make your algo run more smoothly and efficiently. どのように? Quite simply because it lets you optimize your algo to a much higher level. It provides you with flexibility to easily adjust each mechanism. もっと重要なこと, it lets you monitor the inputs and outputs of each box and assess which needs fixing.
Algo Box: The Bottom-line
もちろんです, the partitioning into various boxes is not a new algo concept. It’s also not rigid; there’s no need to do it exactly as I did. If you’re intrigued by the Algo mechanism box concept and want to delve into it a bit farther you’re in luck. I highly recommend the book Inside the Black Box by Rishi K. Narang. I’ve found that it sheds a great deal of light on what some might construe as a complicated strategy.
And for those of you that are short of time? You can use this as a basic guide on how to make your algo run smoothly, without reinventing the wheel.
Спасибо. Мы попробуем реализовать по такой схеме. Очень интересный вариант
Please let me know how it turns out.
こんにちはショーン, I have being following your indispensable publications for some time now. They are usually of immense importance to the task of everyday profitable trading. But I have also noticed that you give little room for anyone who is a novice, like me. Am keen on learning coding but don’t know where to start. I did be glad if you could accommodate new comers also please. おかげで.
Great question and thanks for pointing out the deficiency. The best book for learning to program is John Smiley’s Learn to Program with C++. My bachelor’s degree is in history. I didn’t come from a technical background. It was only when I decided that I wanted to learn how to program that I got serious about my trading, and Smiley’s book was the way I did it. He also happens to be very helpful – he replied to my emails after I read his book, which I thought was a nice gesture.
Please i would like to know it too….
Hi Max,
質問を理解していません。. Which part of the article wasn’t clear?
–ショーン