Filtering trade entry signals

How do you know when a trend has started? Ended? This forum is for discussions about trend indicators and signals.
Post Reply
wonkabar
Full Member
Full Member
Posts: 20
Joined: Wed Sep 01, 2004 5:27 pm

Filtering trade entry signals

Post by wonkabar » Thu Sep 02, 2004 11:48 am

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

garryboor
Full Member
Full Member
Posts: 14
Joined: Thu May 13, 2004 8:32 am

Post by garryboor » Thu Sep 02, 2004 5:06 pm

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.

wonkabar
Full Member
Full Member
Posts: 20
Joined: Wed Sep 01, 2004 5:27 pm

Post by wonkabar » Fri Sep 03, 2004 11:03 am

That certainly does sound interesting and I will try it myself. How are you defining intermediate and longterm in days for these? thanks

Hiramhon
Roundtable Fellow
Roundtable Fellow
Posts: 98
Joined: Fri May 09, 2003 12:45 am

Post by Hiramhon » Fri Sep 03, 2004 5:01 pm

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.

efficiency
Senior Member
Senior Member
Posts: 27
Joined: Wed Jun 02, 2004 9:17 am
Location: Omaha Nebraska

Post by efficiency » Thu Oct 07, 2004 8:32 am

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.

sluggo
Roundtable Knight
Roundtable Knight
Posts: 2986
Joined: Fri Jun 11, 2004 2:50 pm

Post by sluggo » Fri Feb 23, 2007 6:11 pm

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.
Attachments
v2_efficiency_system.zip
v2 of "Breakout with ADX filter" system
(2.06 KiB) Downloaded 989 times
part3.png
Figure 2. System test with stop parameter values tweaked a little bit
part3.png (52.72 KiB) Viewed 15916 times
part1.png
Figure 1. System test with parameters as specified by user "efficiency"
part1.png (52.49 KiB) Viewed 15916 times

drip007
Roundtable Fellow
Roundtable Fellow
Posts: 53
Joined: Mon Nov 27, 2006 2:54 pm

Adding ADX

Post by drip007 » Tue Apr 03, 2007 5:36 pm

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

Tim Arnold
Site Admin
Site Admin
Posts: 8500
Joined: Tue Apr 06, 2004 1:41 pm
Location: Boston, MA
Contact:

Post by Tim Arnold » Tue Apr 03, 2007 6:33 pm

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
Attachments
adxindicator.gif
adxindicator.gif (13.6 KiB) Viewed 15540 times

Daedalus
Full Member
Full Member
Posts: 14
Joined: Fri Jun 11, 2010 1:25 am
Location: Sydney, Australia

Post by Daedalus » Fri Jul 02, 2010 3:28 am

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
Attachments
Efficiency system - All Liquid Futures.PNG
Equity curve for All Liquid Futures, Efficiency System
Efficiency system - All Liquid Futures.PNG (36.54 KiB) Viewed 10408 times

LeviF
Roundtable Knight
Roundtable Knight
Posts: 1428
Joined: Mon Dec 22, 2003 12:24 pm
Location: Des Moines, IA
Contact:

Post by LeviF » Fri Jul 02, 2010 8:12 am

sluggo wrote:...portfolio of 110 futures markets.

sluggo
Roundtable Knight
Roundtable Knight
Posts: 2986
Joined: Fri Jun 11, 2004 2:50 pm

Post by sluggo » Fri Jul 02, 2010 8:57 am

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 :) )
Attachments
bloxcode.png
Another way to code the UnitSize script
bloxcode.png (4.95 KiB) Viewed 10366 times
Give_This_A_Try.zip
Complete backtesting environment for this system
(251.7 KiB) Downloaded 454 times

Daedalus
Full Member
Full Member
Posts: 14
Joined: Fri Jun 11, 2010 1:25 am
Location: Sydney, Australia

Post by Daedalus » Sun Jul 04, 2010 3:00 am

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

Post Reply