Portfolio Boss Documentation

Augmenting a Strategy with New Rules

 

 

This scenario assumes you have a strategy in hand (even a partially valid strategy).

For example, you added certain rules and technical indicators that you believe will benefit you (or to “guide” the Divine Engine). But still, you believe this strategy can be improved more. Maybe its performance is a little too underwhelming: despite yielding very good CAGR, it has mindboggling Drawdown.

And yet, you have no idea what rules and technical indicators may spice this strategy up to the next level. Worse yet, you have doubts. A certain rule/filter is dubious, whether it's useful or detrimental to the strategy's performance.

Worry not! The Divine Engine to the rescue!

 


 

1.  Let's continue with the previous strategy we created. You can delete all filters (supplied by the previous Divine Engine run), and add your own filters that you trust.

 

 

Don't worry, the top strategies are already stored (in this Divine Engine Results Tab). They won't change whatsoever, even if you load them then modify/delete their rules. The only thing that changes is the performance report of an active strategy, obviously. That is, as market data is continually updated every day, the strategy's performance is also revised every day.

 

 

You can also create a strategy from scratch, as described in the previous scenario.

 


 

2.  Now, as you can see, this is the strategy I came up with:

 

 

I believe the 200 days SMA filter and the Impulse ranking rule would be useful, but not so much the Aroon oscillator. And besides, I'd like the Divine Engine to add more filters to beef up this meager strategy:

 

 


 

3.  So we will consult the AI genius. Click the button  and ensure the “Search Algorithm” is “Evolutionary” (on the “Backtest Parameterization” Panel).

 

 

Also, make sure “Rule Set Parameterization” is set to “Random Selection”, with the checkbox “Use Current Rule Set as Baseline” ticked. This is because we have a valid baseline strategy that we want to improve more. With that checkbox ticked, you can ensure the Divine Engine will always give you results that are as least as good as the current strategy. Now, if a baseline is not valid (not complete), let's say you don't know what Ranking Rules to use and rather have the Divine Engine find them for you, you must disable that checkbox, even if you supplied other rules/filters yourself. Ticking on that checkbox only works if you have a valid baseline strategy.

 


 

4.  You can leave the rest of the properties here at their default values. But I will reduce the “Population Size”, “Min. Generations”, and “Max. Generations” so the Divine Engine run won't take too long.

 

 

As well, I decided to increase “Mutation Rate” to 20% so there's a little more variation in the filters and their values.

 


 

5.  Then, set whatever “Fitness Function” you see fit according to your trading goals. As for me, I choose CAGR, for the greatest profit possible.

 

 

I also added “R²”. That will give me a more consistent strategy, with no big surprises either up or down. As for the “Exit Conditions”, I decided not to use them, because the “Max. Generations” value is already low. I don't want the Evolutionary progression to be truncated even shorter.

 


 

6.  Now let's go back to the rules/filters we supplied before. We'll tell the Divine Engine to keep the filters we believe are useful. While a filter that's dubious for the well-being of the strategy shall be judged by the Divine Engine. If it proves to be useless or detrimental, it will be replaced by a new one.

 

 

To do that, look at the left-most parameter of each filter that says “Not Replaceable”. You can click on that dropdown and choose either “Not Replaceable” or “Replaceable”.

 

 

In my case, I leave the SMA filter (and the ranking rule) as “Not Replaceable”, which means the Divine Engine won't replace them. They will stay no matter what. The Aroon filter though, is set to “Replaceable”. Its fate is up to the Divine Engine to decide, whether it will be replaced by another filter or not.

 


 

7.  Let's now start the Divine Engine backtest. You can run the test locally now, or queue it for later. But we usually recommend running big tests in the cloud: Press the button as usual. A confirmation dialog appears, informing you of the estimated compute credit consumption for this backtest:

 

 

Simply click OK, and look at the Divine Engine Results Tab: there's another item at the top that's currently “Running”. This is your current Divine Engine backtest. The other item (below it) is the previous Divine Engine run you did.

 

 

You can click on each “Backtest Item” to see its contents. So, each “Backtest Item” contains its own set of top strategies, as well as its own “Fitness Series Chart”.

 

 

Obviously, the Backtest Item that's currently running is not yet fully populated with top strategies. We'll wait it out to finish. In the meantime, you can use Portfolio Boss as usual. You're not locked out waiting for the Divine Engine to finish.

Even better, you can load one of the top strategies fresh out of the oven, to see what rules and filters it contains, even as the backtest is still running.

 

 

If after a long time you don't see any better strategies listed at the top, you may cancel the backtest. Simply click the “Cancel” button on the running Backtest Item:

 

 

You may also cancel a backtest if the Brown, Cyan, and/or Green lines (on the “Fitness Series” chart) drops to very low values. That tells you that the evolutionary progression only yields worse performing strategies, thus you manually kill the process. If you used the Exit Conditions, termination happens automatically.

 


 

8.  Once the cloud backtest is finished, you can load one of the top strategies by clicking the “Load Parameters” buttons  . In my case, here's the content of the highest performing strategy:

 

 

As you can see, the barebone strategy is now augmented with the new rules/filters. And those filters we set to “Not Replaceable” are still there. Surprisingly, the Divine Engine decided that the Aroon oscillator is actually useful, despite some value changes.

What's once a 50,000-percentage return strategy with 76% Drawdown, has now become a strategy with 50,000,000-percentage return and an acceptable 50% Drawdown, despite a short evolutionary progression.

 

 

So in summary, the steps are very similar to the previous scenario, where you use the “Evolutionary” search and the property “Rule Set Parameterization” adjusted to “Random Selection”. Except here you supply your own filters you believe will benefit the strategy. The Divine Engine will then add new filters (or replace existing ones that are dubious), to take your barebone strategy to the next level.

 


 

Note:

 

If the baseline contains Cyber Code rules (from a top strategy you loaded that used the Cyber Code engine), they'll have the flag “Not Replaceable” permanently set (grayed out). These Cyber Code rules will stay no matter what, with its contents (codes) fixed. The idea is that a Cyber Code evolution and a standard evolution (which we discussed in this page) are mutually exclusive: the Divine Engine either adds random built-in rules, or adds/evolves the Cyber Code rules, not both. If you don't want a Cyber Code rule to be part of your baseline, simply delete it. If you want the Cyber Code rule to evolve further, set the property “Rule Set Parameterization” to “Generate Cyber Code” as discussed in the Cyber Code page (which means the new random rules added by the Divine Engine will be of the Cyber Code type exclusively, not of the built-in type).

 

 

 

 

Back to Top