This is not about finding new rules and filters. Instead, we focus on what we have in hand, and make it perfect.
For example, you have a strategy that you love so much. It is either crafted by you, or conjured up by the Divine Engine from scratch. It doesn't matter; the point is, you believe in its rules and filters. But not so much their “values”.
You can squeeze out the last drops of performance by tweaking their values: an SMA period of 50 days might not be the best value, so you want to try out all the different SMA periods from 10 to 500 days, for example. Ditto the ATR multiplier from -10 to 10 can all be experimented to find the best one for this strategy.
This is what we call parameterization, that is, experimenting with different values to find the best one for the parameter. You can count on the Divine Engine to do that for you.
You wouldn't believe how a simple change of value could transform your strategy into a beast. We had a meager strategy that yielded 27% CAGR. But by letting the Divine Engine find the best values, for example 2 days RSI instead of 14 days, the strategy transformed into this 140% CAGR beast:
1. Obviously, this scenario assumes you have a complete strategy already (a valid one). This is an example:
You can create a strategy by yourself. Or load one of the top strategies provided by the previous Divine Engine runs.
2. Now, let's enable the Divine Engine by clicking the button at the top. Once it's enabled, some panels are spattered with funny looking buttons . These panels are:
Those are the “parameterization” buttons. With this button, a parameter can be “parameterized”, i.e experimented with different values to find the best one.
If you click on that button, a pop-up appears. Each type of parameter behaves differently in the way you parameterize it.
We will discuss the different behaviors next.
3. Let's get to the SMA filter, and click the parameterization button on its “days” parameter, as shown in this screenshot:
If it's a parameter like this, where you can input an arbitrary number such as “200” days, “98” percent, “1.5” multiplier, “30” dollars, etc, you can set the minimum and maximum values to be experimented:
Thus we set the values' “range” for that parameter. In the example above, we'll be experimenting from the value of 10 days to 500 days. But is everything between those values experimented?
That's where you set the “Step Size”, which defines the increment (step) between the min and max values.
For example, with a “Step Size” of 5, the Divine Engine will experiment from the value of 10, 15, 20, 25, all the way to 500 days. In short, it's a multiple of 5. If you wish all values to be tested (no skipping) then set the smallest “Step Size”. For example, if it's set to 1, the Divine Engine will test 10, 11, 12, 13, 14, 15, all the way to 498, 499, and 500 days.
A larger range and a smaller step size allow for a broader and more thorough search (to find that exotic and high-performing value), but at the expense of a longer backtest time.
Once done, you can click the “Close” button.
4. Now if it's a parameter that has a fixed set of values, such as “Above”, “Below”, “Greater Than”, “Less Than”, or other values built-in to that parameter, you can select any or all of those values:
The Divine Engine will then experiment with those values you selected. If you decide to select all values at once, instead of picking them one by one, use the “Select All” checkbox:
Conversely, to deselect all at once, disable that checkbox. Or, press the “Reset” button to revert this popup to its default state (no parameterization).
5. If it's a parameter that uses ticker symbol, such as Index or Cash Equivalent symbol, you can search the instrument in the ensuing dialog box:
The search result can be seen under “Available Instruments”, where you can pick the instruments that you desire:
You can enter another search term, and pick yet another set of instruments. The instruments that will finally be tested by the Divine Engine are then listed under “Selected Instruments”:
In the example above, you're telling the Divine Engine to experiment with the NDX and NYA indexes, to see which market indicator may best guide this strategy.
6. Now as stated earlier, you can also fine tune the rules at the “System Settings” panel. But you must decide on the most important rules first, as they can't be parameterized:
The most important rules are:
You can read the help page for the “System Settings” panel for a more thorough explanation.
Then, you can parameterize the rest of the rules so the Divine Engine will find the best values for them:
Note, the rules “Buy/Sell Order Limit” are only visible if you set the “Buy/Sell Order Type” to “N ATR Limit Order”.
7. Obviously, you don't have to parameterize everything. You can leave alone those values you believe are already correct. Parameters that have been parameterized will have their “parameterization” button highlighted with a color:
8. Now let's go to the “Backtest Parameterization” Panel.
Things will be different here than the previous scenarios. First, instead of “Evolutionary” Search, we'll be using the “Random” Search Algorithm.
“Random” search is more suited for fine-tuning a strategy. Through brute force, it tests all the different values that you picked, combining one parameter's value to another parameter's value. For example, in one test it combines the “Above” value with the “200 days” value. While in another test it combines the “Below” value with the “20 days” value. And so on and so forth.
The best combinations will then be pulled as a top strategy.
Another thing is to set “Rule Set Parameterization” to “Manual”, because we trust the existing rules/filters to be perfect for this strategy. We don't want new rules to break it.
Then you set the “Fitness Functions” as you see fit. For example here, I added the “Score” and “Avg. Drawdown” Fitness Functions.
9. Next, we will define the amount of backtests to be executed. Take a look at the parameter “Execute n random backtests” here:
One backtest is for one strategy with its distinct set of combinations. We call each backtest an “iteration”. Thus if we have 29,850 iterations as shown in the screenshot above, it means the Divine Engine will create and test 29,850 strategies, each with different combinations (of values).
The more iterations you set, the longer it takes for the Divine Engine to finish. But that also means your “search” is more thorough and exhaustive, thus potentially finding that exotic high performing combination. If you set it too low, on the other hand, not all combinations will be tested.
Preferably, you set the amount of tests to match the “Number of Parameter Combinations” as shown here:
That means all possible value combinations are tested. But usually, satisfying that number means an impossibly long backtest time. Therefore, for efficiency reasons, you can set the parameter to a value of 3.
Even if you set it to a value of 1, all values that you picked will be tested; but not all their different combinations.
10. If, for one reason or another, you have doubts on a certain filter, you can let the Divine Engine decide its fate. Very similar to the previous scenario:
Click on the leftmost parameter that says “Enabled”, and a dropdown appears:
If you choose “Random”, the Divine Engine decides whether this filter will be disabled or enabled, depending on its performance. If you're certain the filter is useful, set it to “Enabled”.
You may recall this parameter used to show “Replaceable” or “Not Replaceable”, instead of the “Enabled/Disabled/Random”. Well actually they all function the same way despite the different names.
The former show up when you set “Rule Set Parameterization” to “Random Selection”. When you set it to “Manual”, the dropdown changed into “Enabled/Disabled/Random”.
11. So let's fire up the Divine Engine backtest. Press the button “Start Local Test” as shown below (or press the shortcut key F6):
A confirmation dialog shows up, allowing you to write a memo describing this backtest (optional). If you don't want this dialog for future local backtests, tick the checkbox “Don't show again”. If everything's good, click OK or press Enter on your keyboard.
Notice the button “Start the Boss” is grayed out. That's because the “Random” search can only be processed locally in your machine. So you use that button we showed above (a local Divine Engine backtest specifically designed for the “Random” search). The Boss cloud platform on the other hand, is specifically architectured to benefit the “Evolutionary” search.
The progress box displays some of the iterations being processed or already completed (the rest may not be shown here). Unlike The Boss where you can still use the software, here you must wait it out to finish. Don't worry, the “Random” search is less compute-intensive than the “Evolutionary” algorithm. Therefore you can wait from a few minutes to a few hours at most, unless you have a titanic amount of iterations.
You may notice there are other buttons there:
Queue Local Test – This allows you to queue (pend and collect), local Divine Engine backtest(s) to be processed later. Each time you click this button, or press the shortcut key Ctrl + F11, whatever rules you have now i.e. filters, parameters, parameterization settings, and portfolios will be stored as a queued Backtest Item. So if you click this button multiple times, there will be multiple Backtest Items queued. Queueing allows you to start a local Divine Engine backtest at a later time, without losing your strategy's rules & settings. It's also useful so you can create and store multiple baselines, especially for fine-tuning multiple form of baselines. Otherwise you must wait a baseline to finish its Divine Engine backtest before creating another one; it may cause you to forget what your other baselines are supposed to be. For example, one baseline is used for a Nasdaq 100 with RSI, Impulse ranking, and Retracement filters; while others are S&P 500 with SMA Position, Volatility ranking, and Position Duration filters:
Start Local Queue – Once you're ready to backtest the queued items, click this button. Its shortcut key is F11. They will be backtested one by one, starting with the earlier/older item. Once the first one is finished, it immediately processes the second one, and so on (the backtest progress dialog shows 1/2 toward 2/2, etc). Don't confuse “Start Local Test” with the “Start Local Queue”; you want to use the latter to start processing the queued items. If you use the former, the queue won't be processed but instead another new Divine Engine backtest is immediately processed. Note, if you cancel any of the queued process (e.g. while it's showing 2/3 and you cancel the process), the next queued items will be cancelled, not just that one item you cancelled. So to continue processing them, click the “Start Local Queue” again (the cancelled Backtest Item will stay cancelled, while the one already processed will of course stay “Finished”).
Note, pressing the button “Start local queue” brings you a confirmation dialog: that these backtests will hog your computer resources. Tick the checkbox “Don't show again” so it doesn't show up in future backtests, and press “Continue”.
12. Once it's finished, you can look at the Divine Engine Results Tab. Where the top strategy was pulled, instead of “Generations” it now shows “Iterations”. For example with “Iteration 065”, that strategy was actually the 65th test/iteration to be done.
You can load a top strategy as usual by clicking its “Load Parameters” button . Also note there's no “Fitness Series” chart when Random search is used (it uses “Mini Charts” instead, explained next).
The memo you wrote for this backtest will be shown here as well.
13. If you look at the strategy's parameters, there's a small colorful icon next to each of them.
These are called the “Mini Charts”. If you click them, a popup chart appears.
The Mini Chart shows the parameter's performance at different values that you picked. Look at which value has the highest orange line (Best Fitness IS):
The value that has the highest “Best Fitness IS” score is the value applied for this parameter. The “Mini Charts” are not really that important, but if you crave for the detailed explanation, visit the help page here.
Now if you look at the parameter's value itself, there are values inside the parentheses, and outside of them:
The value outside the parentheses is the value applied to that parameter (in the example above, “Total Positions to Hold” is set to “3” by the Divine Engine). Inside the parentheses is your parameterization range. If this view looks confusing, you can simply disable the Divine Engine.
Don't worry, the value applied by the Divine Engine still remains. And the parameter appears neater now.
If you re-enable the Divine Engine, the parameterization settings you set are still there. Even if you closed Portfolio Boss, they're still remembered. If you wish to remove all those parameterizations at once, click the “Reset Divine Engine Fields” button at the top:
That way, you can start the parameterizations afresh should you wish to fine-tune the strategy again. But if you wish to reset the parameterization one by one, click the “parameterization” button of each parameter, and press “Reset” there: