Filter (best/worst) trades
Author: hlh
Creation Date: 9/1/2011 2:50 PM
profile picture

hlh

#1
Is there a way now or the idea to implement such feature in the future to have trades not being included in backtesting results when they are too good (or too bad), like a bad ticker filter works?

It is quite a challenge to filter whether data is right or nor (when is a spike a spike or when was it a take over, can blue chips fall more than 15% over night, yes they can but it also might be a bad low data figure, etc.).

The problem gets worse if I lets say enter a trade long at bar 10 and will execute it a certain bars later or after a certain holding period. Might be the Buffet bought that thing and the 35% performance of that one trade presents me with a way too good looking performance result.

Yeah, of course before going live one would check all the trades (e.g. by sorting) if such things happend but when quickly checking different parameters for entries one does not look at each 5000 trades all the time. Specially if run over the Optimizer.

So wouldn't it be great just to have WL execute its stuff and have some optional filters, like "Exclude profits over x%" and one for negative results as well.

What I do now is to peek whenever possible to not enter a trade if the profit would be to great. That is quite complicated as one hast to simulate the whole trade at (before) the entry bar, meaning including the exit maybe 200 days later (and if there is no more data one has to rule that out to to avoid errors). Once started one can see how complicated that gets.

While looping thru all the "gross" positions and then filter them our according to their percent profit (or loss) and then show/store only the realistic ones in "net" positions sounds easier, at least for me as the end user of WL. All the nice visualizers, tables and stuff would then also show the filtered results.
profile picture

Eugene

#2
Like "Exclude outlier trades over N std. deviations from performance results"?

I remember (Robert?) suggesting this idea to Fidelity. I hope that they consider adding it someday as an option in Preferences so that every existing performance visualizer wouldn't have to be changed to add this option.

As of today, you might want to check out the 'Outlier trades' section in Performance+. Namely "Profit of outlier trades" and "Select Net Profit" (profit after removing the results of all outlier trades).
profile picture

hlh

#3
Yeah, that would be really helpful! And standard deviation might be even cooler than percentage of profit/loss (which also has his niche). And to select whether to exclude positive outliers only, or negative ones only, or both.

Thanks for pointing towards Performance+. Never looked there much. Guess also the listed negative outliers are taken out, not only the positive ones?

What is your practical advice. Checking on the fly over 1000 symbols over 20 years is quite a challenge for WL (and me waiting on a result). But on intraday data the whole thing gets quite ugly!

Would it be better to make some complicated strategies just for writing a separate series for each symbol like 0 on that bar is okay, 1 = no entries, 2 = no exits, 3 = no entries long, ... and then load that series as an external series for each symbol an buy only if not 1 or not 3 etc.?

And for intraday to make another series for the whole day: if BarDate == badDate do not enter ...?
profile picture

Eugene

#4
QUOTE:
Guess also the listed negative outliers are taken out, not only the positive ones?

Yes, Select Net Profit takes out all profits from outlier trades (over -/+ 3 StdDev).
QUOTE:
Would it be better to make some complicated strategies just for writing a separate series for each symbol

I don't quite understand the connection. Do you now mean filtering outlier trades on-the-fly in strategies?
profile picture

hlh

#5
My question was about whether to include the "outlier filters" I am using in the actual strategies, e.g. by peeking ahead on-the-fly if a trade would generate to much profit and not enter that trade at all (which I am doing now) or maybe to write extra code for marking certain dates as not valid for entries (or exits) and store this data in separate series or lists. Then running thru the strategy and importing lists and compare if an (e.g. long) entry would be "allowed" for that bar or that day.
profile picture

Eugene

#6
Hardcoding certain dates as not valid seems like the easiest workaround to me.
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).