How do I stop my trend system from giving signals during ranges?

aparoid89

Active member
Messages
146
Likes
1
My system works well when backtested on the last 25 years of FTSE 100 data but when I test it on something that doesn't trend a lot like BP plc then it ends up making a loss after the 25 years. It's an adaptation of the 3 ducks method for UK stocks but with the daily, weekly and monthly charts as the 3 'ducks' instead of 5 min 1 hour and 4 hour.
 
can you quantify mathematically, or in terms that can be algorithmisised (??) what constitutes a range?
 
Probably using its proximity to a previous resistance but I don't know if that's what other people who are in a similar position have done. That's why I ask.
 
My system works well when backtested on the last 25 years of FTSE 100 data but when I test it on something that doesn't trend a lot like BP plc then it ends up making a loss after the 25 years. It's an adaptation of the 3 ducks method for UK stocks but with the daily, weekly and monthly charts as the 3 'ducks' instead of 5 min 1 hour and 4 hour.

There are generally three problems as I see it :

1)All back tests work well because they tend to be curve fitted.
2)You back test on FTSE but expect some degree of correlation to BP plc. Isn't that apples and oranges?
3)Your backtest was over a 25 year period but as they say "the devil is in the details." Without context it is difficult to make judgment unless you are prepared to wait another 25 years to finally draw a conclusion.

False signals are part and parcel of all non discretionary systems. You take the good and the bad that goes with it. Basically you can't have the cake and eat it too.
 
There are generally three problems as I see it :

1)All back tests work well because they tend to be curve fitted.
2)You back test on FTSE but expect some degree of correlation to BP plc. Isn't that apples and oranges?
3)Your backtest was over a 25 year period but as they say "the devil is in the details." Without context it is difficult to make judgment unless you are prepared to wait another 25 years to finally draw a conclusion.

False signals are part and parcel of all non discretionary systems. You take the good and the bad that goes with it. Basically you can't have the cake and eat it too.

I just want it to be able to know when it is trending and not to generate signals when it is in a range.
 
Well, it's not that you need it to not give you signals, it's just that you need to know when to employ your system and when not to employ it. Trend following systems break down when the market ranges, just as range trading systems break down when the market trends. If you want to use your trend following system, then just use it on trending markets. If you want to trade ranging markets then you'll need to develop a range trading system. Deploy each as needed.

I suppose it is possible, in theory, to develop an alert system that will not alert you during ranges by say, filtering out signals when the ATR/ADR is < X, but that depends on your software's capability. I don't know what you use, so I couldn't comment any further on that...
 
Well, it's not that you need it to not give you signals, it's just that you need to know when to employ your system and when not to employ it. Trend following systems break down when the market ranges, just as range trading systems break down when the market trends. If you want to use your trend following system, then just use it on trending markets. If you want to trade ranging markets then you'll need to develop a range trading system. Deploy each as needed.

I suppose it is possible, in theory, to develop an alert system that will not alert you during ranges by say, filtering out signals when the ATR/ADR is < X, but that depends on your software's capability. I don't know what you use, so I couldn't comment any further on that...

I use python so pretty much anything is posible
 
I just want it to be able to know when it is trending and not to generate signals when it is in a range.

We all want that whether we trade discretionarily or if we automate a system. This problem has been around as long as trading has been around. There are generally two ways to deal with it. Learn to become a better trader or continue to invest in a better system but regardless you will have to learn to live with false signals unless you quit trading.

You can apply discretion to your signals but don't expect a system to perform any better than your own ability to filter correctly.

Alternatively you can use a system filter but the drawback is often late entry and/or fewer trades. You will have to run the back test to determine whether it will provide you with better results then without the filter.
 
Have you tried incorporating Heiken Ashi Candles., IMHO they are easier to interpret and show when the prices are trending.
 
My system works well when backtested on the last 25 years of FTSE 100 data but when I test it on something that doesn't trend a lot like BP plc then it ends up making a loss after the 25 years. It's an adaptation of the 3 ducks method for UK stocks but with the daily, weekly and monthly charts as the 3 'ducks' instead of 5 min 1 hour and 4 hour.

a system that posts a loss when it isnt trending ?.........welcome to trading :cool:
 
If you can't stop your system/edge generating trend following signals/set-ups in a range then you have to recognise when to act on those signals/set-ups and when not to - ie in a trend not a range - via a rule set for determining such.

I trade an edge that produces both with trend and counter trend set-ups but have a rule set for when to act on each ...and in the case of the with trend set-ups only act on them when price is trending on the relevant t/f's per such a pre-determined rule set

G/L
 
  • Like
Reactions: x4x
Have you seriously gone back 25 years of FTSE? What were you doing working off a monthly or a 3 monthly chart? If you had a computerised version do this for you it is a forked up flawwwed anal-ysis. Tha I can say for defffff.
 
Have you seriously gone back 25 years of FTSE? What were you doing working off a monthly or a 3 monthly chart? If you had a computerised version do this for you it is a forked up flawwwed anal-ysis. Tha I can say for defffff.

Why is it flawed? I used the monthly chart
 
Quick update, using some ninja coding skills I just downloaded all the data of all the ftse 100 companies from yahoo finance in 3 minutes without needing to know the name of any company. Pretty tired now so I'm going to run my algorithm on all 100 companies tomorrow and see how many are profitable.
 
Quick update, using some ninja coding skills I just downloaded all the data of all the ftse 100 companies from yahoo finance in 3 minutes without needing to know the name of any company. Pretty tired now so I'm going to run my algorithm on all 100 companies tomorrow and see how many are profitable.

good luck with your research.
good to see a positive, learning attitude, rather than asking for things on a plate. (y)

as an exercise, you could just run your algorithm on the first 7-8 years, see which ones are profitable, then run on what remains of the 25 years data.
And then see if your "profitable" ones remain profitable over an extended time.

I don't know if you have optimised the settings for your signals, but then tweak them and see if the results are wildly different. (unless you have already tested for robustness, ie, a small change doesn't give rise to an unusually large difference in returns)

I think your hard work will pay off.
As an aside, I got round the whole trend/range problem by assuming that if price has started to contract, and the highs and lows are within a defined range, I treat the market as now in breakout mode, and trend-mode is off.
However, I have to suffer a couple of losses before I look deeper.
 
Quantify the time frame you are using.
Quantify the volatility of the equity you are trading.
Quantify the definition of Range.

If time frame is short, it will usually be more volatile hence more false signals, vice versa.

Let's say that we are talking about "Daily" bars.
How to measure volatility? We see frequent gapping action, no orderliness in OHLC with prior bars, sometimes volatility swipes that exceeds the range limit define by 2*ATR(10). Hence, we can use Standard Deviaton ( square root of Variance, the squared difference of CLOSE from Moving Average).

But how to know whether StDev is abnormal? Hence, we need to compare its volatility relative to its historical volatility or to its base index (Beta). The better one is Connor's 100-day Historical Volatility. If it's below 50, its definitely not volatile. 50-150 normal. Over 150 means volatile.

Now, what's the definition of range? (Usually, the intial start of ranging is difficult. But ranging indicates deliberate trapping of price within an immediate Support and Resistance for Distribution/Accumulation or simple, uncertainty between buyers and sellers)

1) Overbought-Oversold Oscillators oscillating between OB zone and OS zone frequently, more frequent than the past
2) Frequent crossing of moving average. Moving average is flat. E.g.Price always cross 20-SMA in less than half cycle period=10
3) Due to swinging nature of price, investors will not take the risk due to unfavourable MFE/MAE ratio. Hence, volume starts to decline.

Hence, from here, define Stable-Range vs. Volatile Range.
Worst case is volatile range as you get in and out very frequently. Hence, rather than using a moving average crossover strategy, you can use a dynamic breakout strategy with volume and market breadth confirmation. If its stable-range, there is order, thus look for special candlesticks or 2-bar patterns coupled with indicator confirmation.

Then create 2 buy conditions. To make a good trading system, try to make entry and exit signal "conditional".

Just my 2'cents.
 
My system works well when backtested on the last 25 years of FTSE 100 data but when I test it on something that doesn't trend a lot like BP plc then it ends up making a loss after the 25 years. It's an adaptation of the 3 ducks method for UK stocks but with the daily, weekly and monthly charts as the 3 'ducks' instead of 5 min 1 hour and 4 hour.

Backtesting is useless , there is no phsyche involved and in actual trading a lot trades will be missed .

There are no mathematically calculable repeatable patterns to back test /omit ranges from back testing.
 
I use ichimoku for this purpose. I don't take any trades while the price action itself or the Tenkan or Kijun lines are in the spanAB cloud. I also use moving averages and typically when the above criteria prevent trading, the averages will be flat anyway which suggest it isn't the best time to get into momentum plays.
 
Top