Filtering trade entry signals
Filtering trade entry signals
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
If any one has any thoughts I would love to hear them. thanks
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:
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.
- 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
- If (intermediate term system wants to go long) AND (longterm trend is bullish) THEN go long
- If (intermediate term system wants to exit long) THEN exit long no matter what the filter says
- If (intermediate term system wants to go short) AND (longterm trend is bearish) THEN go short
- If (intermediate term system wants to exit short) THEN exit short no matter what the filter says
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.
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.
-
- Senior Member
- Posts: 27
- Joined: Wed Jun 02, 2004 9:17 am
- Location: Omaha Nebraska
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!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.
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 1198 times
-
- Figure 2. System test with stop parameter values tweaked a little bit
- part3.png (52.72 KiB) Viewed 19732 times
-
- Figure 1. System test with parameters as specified by user "efficiency"
- part1.png (52.49 KiB) Viewed 19732 times
Adding ADX
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
Thanks in advance.
D
-
- Site Admin
- Posts: 9015
- Joined: Tue Apr 06, 2004 1:41 pm
- Location: Boston, MA
- Contact:
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:
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 (13.6 KiB) Viewed 19356 times
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:
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
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
Thank you,
Daedalus
- Attachments
-
- Equity curve for All Liquid Futures, Efficiency System
- Efficiency system - All Liquid Futures.PNG (36.54 KiB) Viewed 14224 times
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 )
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
-
- Another way to code the UnitSize script
- bloxcode.png (4.95 KiB) Viewed 14182 times
-
- Give_This_A_Try.zip
- Complete backtesting environment for this system
- (251.7 KiB) Downloaded 648 times
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
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