Page 1 of 1

Filtering trade entry signals

Posted: Thu Sep 02, 2004 11:48 am
by wonkabar
I have been toying with ideas on how to improve my trend following system entries. Part of this has got me thinking about various ways to filter trade signals so as to have a higher probablity of catching a "good" trend. What i have found is some people use rules such as only take longs if we are trading over x day moving average. Are there other schools of thought on the merits or demerits of adding filters? The Stridsman books explore adding filters to some systems with limited success.

If any one has any thoughts I would love to hear them. thanks

Posted: Thu Sep 02, 2004 5:06 pm
by garryboor
The Veritrader 2.0 Beta Testers are working collaboratively on a system exercise "A3" which seems to show some promise. It is an intermediate term trendfollowing system, plus a filter. In general terms:
  • The filter indicates whether the very long term trend is bullish or bearish. It only has two outputs: Longterm trend bullish, Longterm trend bearish.
  • The trading system is extremely simple
    1. If (intermediate term system wants to go long) AND (longterm trend is bullish) THEN go long
    2. If (intermediate term system wants to exit long) THEN exit long no matter what the filter says
    3. If (intermediate term system wants to go short) AND (longterm trend is bearish) THEN go short
    4. If (intermediate term system wants to exit short) THEN exit short no matter what the filter says
In preliminary tests the filter removes more than half the trades of the unfiltered intermediate-term trading system, yet it increases CAGR, decreases maxDD, and increases MAR Ratio quite noticeably (1.5 times larger than without the filter).

What sort of filter would give only two possible outputs, Long term trend bullish or Long term trend bearish? Well, how about using a pure-reversal long term trading system as an indicator? If this long term trading system is Long then the indicatorr output is "bullish", and if the long term trading system is Short then the indicator output is "bearish". Voila. No rocket science. Try it for yourself and see what you get.

Posted: Fri Sep 03, 2004 11:03 am
by wonkabar
That certainly does sound interesting and I will try it myself. How are you defining intermediate and longterm in days for these? thanks

Posted: Fri Sep 03, 2004 5:01 pm
by Hiramhon
In my mind, the average trade of a "long term trend following system" lasts 3 months or longer (entry date to exit date), taking the average over all trades in all markets in the portfolio. However the average trade of an "intermediate term trend following system" lasts between 3 weeks and 9 weeks, entry to exit. Just my opinion.

Posted: Thu Oct 07, 2004 8:32 am
by efficiency
For long entry I use a 120 day HHV (6 months) when FILTERED with an ADX 14 above 30 and rising. My initial sell stop is 3 ATR (which flexes with volatility). Once I'm "in the money" meaning the inta-day low is above my basis, I tighten the stop to 2 ATR and ride the trend.

Posted: Fri Feb 23, 2007 6:11 pm
by sluggo
efficiency wrote:For long entry I use a 120 day HHV (6 months) when FILTERED with an ADX 14 above 30 and rising. My initial sell stop is 3 ATR (which flexes with volatility). Once I'm "in the money" meaning the inta-day low is above my basis, I tighten the stop to 2 ATR and ride the trend.
I programmed your system into Blox and ran it on a portfolio of 110 futures markets. (Since you specified long-only trades, I'm guessing you originally conceived it for trading stocks rather than futures). With the parameters you specified, it is very solidly profitable. Fooling with the stops a little bit, sands off some of the jaggedy-ness and changes the shape of the equity curve. Enjoy. Maybe someone will try it out on stocks!

edit: a diligent Roundtable member found an error in the handling of stops for Short trades. Which, predictably, I didn't test very thoroughly because the emphasis was on Long trades (!). Live and learn. The fix is attached.

Adding ADX

Posted: Tue Apr 03, 2007 5:36 pm
by drip007
Can anyone show me how to add ADX to my system as a filter in Tblox? I simply want to filter out choppy markets and require that ADX be above 20 or 30 before entering a trade.

Thanks in advance.

D

Posted: Tue Apr 03, 2007 6:33 pm
by Tim Arnold
Sure. Take a look at the ADX System and you will see some good examples. Here is how you setup the ADX Indicator for use in the Blox Scripting.

Then you can setup an If/Then statement like this:

Code: Select all

IF adxIndicator > adxTrendLimit AND
	positiveDirectionalIndicator > negativeDirectionalIndicator AND
	instrument.position <> LONG THEN
	
	IF useATRStops THEN
		broker.EnterLongOnOpen( instrument.close - averageTrueRange * atrStop )
	ELSE
		broker.EnterLongOnOpen
	ENDIF
	
ENDIF

Posted: Fri Jul 02, 2010 3:28 am
by Daedalus
Hi,

I'm new to TB, so I'm still feeling my way. I think I'm getting the hang of it though...

I downloaded this system and ran it, but it doesn't get anywhere near the CAGR for me. I get between 5-6% using the sample data futures, which is an order of magnitude less than the results shown above.

It makes me wonder if I've got something else fundamentally mis-configured.

My equity curve is attached.

I had to change the money manager to work in this version. Here's what I used:

Code: Select all

VARIABLES: riskEquity, dollarRisk TYPE: money

if sizeofUnit > 0 then
	order.SetQuantity( sizeOfUnit )
else
	' Compute the risk equity.
	riskEquity = system.tradingEquity * riskPerTrade
	
	' Compute the dollar risk.
	dollarRisk = dist2stop * instrument.bigPointValue
	
	' Set the trade size.
	IF dollarRisk = 0 THEN
		order.SetQuantity( 0 )
	ELSE
		' *** Set the quantity to a MIMNIMUM of 1 ***
		order.SetQuantity( max(riskEquity / dollarRisk, 1) )
	ENDIF
	
	' Reject the order if the quantity is less than 1.
	IF order.quantity < 1 THEN
		order.Reject( "Order Quantity less than 1" )
	ENDIF
endif
To help me test my fundamental settings, could someone let me know what kind of curve they got for the All Liquid Futures data in the sample please?


Thank you,

Daedalus

Posted: Fri Jul 02, 2010 8:12 am
by LeviF
sluggo wrote:...portfolio of 110 futures markets.

Posted: Fri Jul 02, 2010 8:57 am
by sluggo
Levi is correct, the benefits of diversification across MANY futures markets, at numerous exchanges on several continents, are dramatic. Buy some Global Futures historical data, try it, and see for yourself.

Meanwhile, I think Daedalus's replacement code for the UnitSize script might not have captured the original intention. An alternate way of writing the code (as a single line!) is shown in the image below. This is a very literal translation, word for word, of the original.

A software environment for Blox version 3.5 is also attached. This contains Blox, System, AND Simulation Suite. Make a backup copy of your entire TradingBlox folder, for safekeeping, so you can revert to its pristine condition before fooling with this system. Then ....

Copy EACH of the included files into your Blox setup and don't change any of them. (The Simulation Suite sets all parameters, both system parameters and also Global Parameters; and it sets the start date & end date). Update Sample Data to today. Running this suite will provide a potent illustration of the benefits of a large & globally diversified portfolio. (Which it does by showing lackluster performance of a not large and not globally diversified portfolio :) )

Posted: Sun Jul 04, 2010 3:00 am
by Daedalus
Hi Sluggo,

Thank you for putting this up, I get the picture. I see there's significant correlation between the number of trades and the success of the system.

To elaborate on my code above, the max(...) element was to bypass the < 1 contract filter i.e. to trade every signal. This was a remnant from a previous test. Apart from that I think the effect of the code is the same.

I'll now go in search of sample data with a wider range of markets...

Thanks for your help,

Daedalus