Is it useful to optimize Priority?
Author: wernerhh
Creation Date: 8/16/2020 8:46 AM
profile picture

wernerhh

#1
When optimizing my strategies, I sometimes get quite satisfactory results. However, I have the impression these good results are not always achieved because the strategy is so good. Sometimes the Optimization function just finds the parameters which cause some very profitable purchases in the beginning of the time period. Because of that the results are high.

When I change the priority slightly - in my case the period for the RSI (here "pri_per) - it happens often that the Annualized Gain diminishes by 5 to 10 percent.

CODE:
Please log in to see this code.


So, I wonder if it could be useful to find an appropriate value for this priority function and then leave it without optimization, so that not just the random factor gets optimized. Would this be a useful action or is this a general problem with optimization that the strategy might be optimized so precisely on the data of the past, that it will not be able to show these results in the future.

Best regards
Werner


profile picture

Cone

#2
Sure it's useful if you use it correctly - i.e., with market orders.

For BuyAtMarket orders make sure to negate the RSI value for priority so that that lowest RSI (e.g. 30 vs. 50) has the highest priority. Put this value in the SignalName so that you can sort Alerts with it. Then, when your account doesn't have sufficient buying power, you enter the trades with the lowest RSI, i.e., highest priority.

To your question, I've never worried about optimizing the period for RSI when using it for priority (I use period 10) , because I'm simply looking for what could be considered "more oversold" with respect to other stocks in the DataSet at the moment when you have to choose one over the others. But test everything! And if the optimization space shows a significant skew in profitability towards higher or lower values, then all else being equal it makes sense to use those values.
profile picture

wernerhh

#3
Thank you very much for your help!
profile picture

wernerhh

#4
Backtesting in Portfolio Mode is a good way to calculate a realistic Annualized Gain. However, I have the impression that Optimizing might not make a lot of sense in Portfolio Mode.

Because then the trades at the beginning of the period are very important and a strategy might be optimized in a way that a big loss at the beginning of the period is avoided. But not because the underlying strategy (which enters into this bad trade) is bad, but because this single trade generated a huge loss.

It might be recommendable to optimize in Raw Profit Mode where each trade has the same importance. Do you agree?
profile picture

Eugene

#5
If you're concerned about a trade in the beginning affecting the course of optimization, then you might look into Monte Carlo Lab's Trade Randomization (TR) feature. There are several options that randomize the raw trades, createing in fact a new simulation: Trade Scramble, Trade Scramble and Randomize, Trade Synthesize. Check out the Wealth-Lab User Guide > Monte Carlo-Lab > Monte Carlo Settings.
profile picture

Cone

#6
QUOTE:
a strategy might be optimized in a way that a big loss at the beginning of the period is avoided.
Absolutely. This is the reason to use the Walk-Forward Optimizer (WFO) - more realistic simulations based on trading that uses the optimization values for the previous interval. Check it out in the User Guide.

Note: Unfortunately, WFO has an intermittent problem that may result in a position that doesn't close after changing intervals in the WF analysis. This will be fixed in 6.9.24.

Re: Eugene suggestion to use the Monte Carlo visualizer (part of Extra Performance Visualizers).
For strategies that set position Priority, I recommend the "Same Date Scramble (SDS)" setting. Other randomizations tend to smooth out the Equity curve by distributing trades on different dates, whereas the SDS setting will keep all the trades on the same date, but scramble their priorities.
profile picture

wernerhh

#7
Cone & Eugene: Thank you very much for the good advice!
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).