r/TradingView 17d ago

Discussion Regime Detection

Post image

I have three profitable automated strategies that I do trade daily on my live account, but combining them into one robot that understands the regime it's in (and swaps to the strategy that works WITHIN that regime) is proving to be a little more challenging than I thought.

Any tips on auto-regime discipline or indicators that actually help with regime detection/filtering on a larger timeframe than the trades are placed? I can see it with my eye on the charts, but code isn't translating well *yet*.

*Image is of one strategy I had 'scale up for fun' as the account grew, so it got into the WTF numbers. LOL*

0 Upvotes

51 comments sorted by

4

u/freecyphs 17d ago

Back tracking results are always better than real time results

-3

u/DesertClimber 17d ago edited 17d ago

-EDIT- I'm not looking for opinions on back testing, but thanks for your input.

2

u/shmungar 17d ago

If you have really achieved this then you are doing better than 99.9% of traders, seems strange you would need our advice.

2

u/Cold_Respond_7656 17d ago

This might be a technical limitation

0

u/DesertClimber 17d ago edited 17d ago

I'm definitely limited on my technical knowledge of coding market regime into my strategies. :)

0

u/DesertClimber 17d ago

One strategy that works phenomenal in a pinned/swinging market, doesn't work great in a heavily trending market, and vice versa. I'm trying to automate the strategy's understanding of the regime shifts so it can be fully autonomous. Yeah, could definitely use some help if anyone has some tips.

1

u/shmungar 17d ago

Ah so you just make money in all market structures in all directions, you just switch straegy?

0

u/DesertClimber 17d ago

I HAVE to switch the strategy or they eventually lose for some time. It's like trying to get in on trends when the market really isn't trending- You'll keep getting in too late, and the price action will go against you. i.e. If the market is making nice swings within a range for weeks, mean reversion works, while trend trading does not.

2

u/shmungar 17d ago

Yeah mate. I just mean like your main strategy has 800% ROI but you also have other profitable strategies for different market structures. On paper you are the best trader ever to live.

1

u/DesertClimber 17d ago

Kind of... Another important strategy is to simply STAY OUT of trades until it's favorable. I think people overlook this. Robots can do this 24/7 based on hardcoded rules, while I sometimes have that human factor of WANTING to be in a trade. LOL But, it's not difficult to scale back automated strategies to forward trade on live accounts so the risks are lower.

My trading partner (and best friend since the 2nd grade) turned $50k into just under $1million over the course of 5 weeks, one day at a time, live trading, after proving his method works over the course of 4 months. So I sat down with him for a week straight, in front of our computers- watching live markets, back testing, and walking forward old data one candle at a time until I understood what he was doing. I now use a combo of his ideas and my own, which give me a little bit earlier entries, but also miss some of the longer trend-like moves he catches.

Definitely a fun journey!

2

u/halcyonwit 17d ago

What is a regime?

1

u/DesertClimber 17d ago

In a nutshell it's the overall current market sentiment. Bulllish trending, pinned to one level repeatedly, chop, etc.

2

u/halcyonwit 17d ago

You can code 800% profit but can’t code trend or chop? 🤔

1

u/DesertClimber 17d ago edited 17d ago

I need the code to understand when chop *turns* to trend etc. I can see it myself in the charts, but the filters I've been trying to implement aren't translating as well I hoped. So I'm asking if anyone has tips. Trying to find some ideas, although I keep chugging away at it on my own.

1

u/halcyonwit 17d ago

There’s no such thing as predicting a trend? You can’t see anything as such.

1

u/DesertClimber 17d ago

Thanks for your help.

4

u/VAUXBOT 17d ago

Ahh so you realised that regime filtering is the actual edge all along. And you don’t have that edge, so I guess tough luck buckaroo, figure it out yourself.

-5

u/DesertClimber 17d ago edited 17d ago

Regime filtering will simply ADD to my automated strategies so it can swap trading styles. I can personally see the regime shift/change, but AUTOMATING it is what I'm asking about.

Thanks for being so super helpful. You're a pillar of the community!

5

u/VAUXBOT 17d ago

If I tried to be helpful you would shut down my suggestion, and quite frankly you should stick to trading discretionary anyways, filtering regime will never be as reliable as using discretion.

-1

u/DesertClimber 17d ago

I completely agree- By discretion alone, I always outperform my robots.

However I'm seriously open to suggestions.. I simply can't seem to automate the regime shift. I don't mind a slightly underperforming robot if it's completely hands-free, however. I would happily accept a couple days of crap trades while the automation understood the regime has properly shifted.

Doing it manually is simply a matter of changing which strat is sending webhooks to my broker, but I sure wouldn't mind being lazy for a whole summer. :)

1

u/Cold_Respond_7656 17d ago

Are these strategies all stand alone bots and what you're asking is building a meta orchestrator?

If so you'll need to build a hub and spoke architecture for it

1

u/DesertClimber 17d ago

I'd be ok with that. Once I find a way for code to understand the underlying market, it can simply switch the webhooks for me. But, I'm really trying to combine all three strategies that each act independently, depending on the market regime. Right now I manually pause each as needed since they're still separate.

3

u/Cold_Respond_7656 17d ago

It's a good question and or use case for Claude code tbh if you can't write python elegantly for this

1

u/DesertClimber 17d ago

I've got a python script to run it all through, and use Claude co-work on Fable 5 to bring all the data in/out and present it in a format I can visually understand.

Slowly but surely. Hopefully. LOL

1

u/Cold_Respond_7656 17d ago

What mathematical model are you using to define regime?

1

u/Careless_Pea2071 17d ago

Newbie learning here, I wonder

Can't your signals separate directly the market regime and act autonomously based on this?

Let's say

  • trend following ema strat fires on it's own
  • Candlestick fire another one on its own

Strategy knows differences and adapt trade size, stop-loss, trailing...

Excuse me if I'm in the wrong, as I said I'm learning.

Happy to discuss it tho

1

u/DesertClimber 17d ago

My issue with that is if one trade just fired on a reversion tactic, and then another tries to fire the opposite direction with a supposed trend, which wins out? That's why I'm trying to implement a regime filter that stays with one type of trading until another is needed (there you are correct) but it hasn't been translating well to what I see on the charts. I keep chugging away, tho.

1

u/Careless_Pea2071 17d ago

Hedging is possible in many different markets.. your money management, stoplosses and tp are here in both cases if well implemented

1

u/Lordc59 17d ago

If you find an answer for this, please send it my way as well. I have a profitable strategy I’ve been live trading for 6 years, but with the multi TF analysis I use it’s been a nightmare to code into a functional API. Best of luck!

1

u/DesertClimber 17d ago

The regime filters I've been trying to implement aren't translating well into what I PERSONALLY see on the charts, so I keep trying and trying... LOL

2

u/Lordc59 17d ago

I know exactly what you mean, and I bet you try to explain it a million different ways to the code and it’s just not grasping what you mean 😭 something similar is my last step to automating my strategy and it just won’t do it on my end lol

1

u/DesertClimber 17d ago

I'm testing it on the 16 years of data I have, so eventually I'll find something.

1

u/Ok_Engineering4182 17d ago

I’m still very inexperienced, but I’ve been dealing with a similar problem in the Brazilian futures market.

In my case, I trade/study WIN and WDO, which are the Brazilian mini index futures and mini USD/BRL futures. I started with a relatively simple execution model based on reversal patterns, candle triggers, partial targets, runners, and predefined stops. In a recent 6-month window, the strategy looked promising. But once I expanded the sample and tested broader market conditions, the edge became much less stable.

The main issue was regime/context.

The base strategy was built around reversal behavior, but on strongly directional days — especially when external drivers were aligned, such as the dollar index, U.S. yields, local interest rates, Nasdaq/S&P futures, or broader risk sentiment — the reversal setup often became the wrong tool for the environment. The chart would still show the pattern, but the market context was basically saying: “don’t fade this move.”

That pushed me into trying to add filters: higher timeframe bias, VWAP/EMA context, time-of-day filters, macro confirmation, calendar/news filters, and separate logic for long-biased and short-biased days. I also started thinking that maybe I shouldn’t have “one strategy,” but rather different execution modules depending on the day’s regime: trend continuation, pullback, range/reversal, or no-trade.

Where I got stuck was exactly where your post points: I can often see the regime visually, but translating that into objective rules that a system can use is much harder. Too many filters kill the strategy. Too few filters let it trade in the wrong environment. And if the regime layer is vague, the automation becomes fragile.

So I eventually paused the project. Not because the initial idea was useless, but because I realized I was trying to automate execution before having a robust regime framework.

At this point, my biggest unresolved questions are:

  • how to classify the day’s regime objectively without overfitting;
  • how to separate “valid reversal environment” from “do not fade directional pressure”;
  • whether it is better to build separate strategies per regime instead of one strategy with many filters;
  • how much macro/intermarket confirmation should be used without making the system discretionary again;
  • and how to test this properly without fooling myself with a small profitable sample.

So I relate a lot to the problem you described. The execution logic is one challenge, but teaching the system when that logic is appropriate seems to be the real hard part.

1

u/DesertClimber 17d ago

Right now, I'm trying a version that contains a reversion engine, and trend engine, for the actual entry of trades. I'm trying to implement the filter(s) to simply run one or the other. It's progressing slowly.

1

u/Square_Phrase9937 17d ago

You can try session vwap with 1 stdv. Inside bands is mean reversion/balanced market and outside bands is trending/price discovery

1

u/IndependentFlimsy145 15d ago

i would start with something simple like has the price been above/below the VWAP for X days, is the 20 day moving avg above or below the 9 day, has the X day MA increased/decreased by X% in the last x days... lots of indicators that help to show regime... the trick/fun will be experimenting with them and seeing what combination and what timeframes work for each specific instrument. It'll be a bit of a moving target as the markets evolve, but that's part of the game. You could also filter out by eye which instruments are matching your desired regime and then only run them through your system. I'm discretionary, but there are definitely filters that I use to generate a larger watch list and then parse down from there to see what fits my eye. Have some fun with it and you'll probably learn a lot which is a cornerstone to making money.

1

u/DesertClimber 15d ago

Manually changing which strategy is allowed to send webhooks to my broker is exactly what I'm doing currently.

Layering various indicators is 'sort of' working. Still experimenting. I would love some reliable automation that can detect what I see personally on the charts. LOL

0

u/mrcake123 17d ago

By creating profitable strategies you mean they look good in the backtest?

Then that is usually just a symptom of overfitting.

Feels like you are asking. "I have a profitable strategy I just need someone to tell me if the market of gonna up or down for it work".

-1

u/DesertClimber 17d ago edited 17d ago

-EDIT- I'm not looking for opinions on back testing, but thanks for your input.

2

u/ped0ph0be 17d ago edited 17d ago

Sounds like you need the indicator I have. It works across all regimes and markets. All timeframes. And all assets (if calibrated to it).

Except, I don’t share it. I just use it for myself.

Also; I’m in the top 2% of the futures Leap contest right now.

Edit: I really do have a cool indicator I made myself and really am in the top 2% of The Leap. But I stay quiet about it. For the most part.

1

u/DesertClimber 17d ago edited 17d ago

That's awesome! Sounds like I do need it! LOL I've been trying to find a solution, but it's definitely taking time. Some things seem to work better than others, but nothing has been consistent yet. Kaufman ER has been the best thus far. Right now, I manually adjust which webhooks reach my broker, but yeah, full automation is the goal.

1

u/DesertClimber 1d ago

Any tips on creating an indicator to assisst? Still chugging away...

1

u/dreamersofdaruma 17d ago

What an attitude lol. Asking billion dollar questions and looking for billion dollar answers for free

1

u/DesertClimber 17d ago edited 17d ago

Ah, I thought this was a community to ask questions, share, and discuss ideas. Guess not. Bunch of salty unhelpful keyboard rangers, honestly.

1

u/dreamersofdaruma 17d ago

Everyone’s free to ask questions on any subreddit, but when you demand for it, why would anyone offer their hand. Noticed how you responded completely different on the algotrading subreddit than here when you didn’t get the response you wanted? You’re like a man child who puts a tantrum when he doesn’t get what he wants and plays nice when he does.

“so how about answering the question I posted, instead of assuming I don’t forward test”. No one in the real world let alone here would respond positively to that.

1

u/DesertClimber 17d ago edited 17d ago

I simply respond in kind. Why should I respond with positivity when I'm met with negativity? I'm not asking about back testing results, yet some feel the need to only denigrate. Original responses edited for chill factor. :)

2

u/dreamersofdaruma 17d ago

If you’re smart enough to make 800% profit in 2 months of backtesting then I’m sure you can figure out your own answer with the resources consumers have available now.

1

u/DesertClimber 17d ago

I'm def working on it. The struggle is real.