Strategy design

Put a trend meter on your chart

Most strategies are secretly two strategies: one that works when the market trends, and one that works when it ranges. A trend meter on your TradingView chart tells you which regime you're in — so you can fire the right setup, avoid the wrong one, and see whether your strategies hand off to each other cleanly as the market shifts.

Why it matters for TradeLayer. TradeLayer places whatever your alert tells it to. A trend meter lets your strategy decide when to send that alert, and lets you tag each trade with the regime it fired in — so your review shows exactly where your edge lives.

1What a trend meter does

A trend meter reads the market's regime — is price moving directionally (a trend) or oscillating inside a band (a range)? It doesn't predict; it classifies what's happening right now. That one signal changes how you should trade:

Trend

Breakouts, pullback-continuations and momentum entries tend to work. Mean-reversion gets run over.

Range

Fade the edges, mean-reversion and support/resistance bounces tend to work. Breakouts mostly fail (false breaks).

Run the wrong style in the wrong regime and even a good setup bleeds. The meter is how you stop doing that.

2Which meter to use

You don't need anything exotic — any of these, on TradingView, gives you a clean trend/range read. Pick one and stay consistent:

Add it to your chart the same way you add any indicator: Indicators → search the name → add. Put it in a separate pane so you can read it at a glance next to price.

Keep it honest. A trend meter is a filter, not a crystal ball. It tells you the odds are better for one style right now — it doesn't guarantee the trade.

3Gate your entries by regime

The highest-value use: let the meter decide whether your strategy is even allowed to fire. In a Pine strategy, read the regime and only send the alert when it matches. Example with ADX:

//@version=5
strategy("Trend-gated example", overlay=true)

// --- Trend meter: ADX ---
[diPlus, diMinus, adx] = ta.dmi(14, 14)
isTrend = adx > 25                 // trending market
isRange = adx < 20                 // ranging market

// --- your entry logic ---
fast = ta.sma(close, 9), slow = ta.sma(close, 21)
longSig = ta.crossover(fast, slow)

// Only fire the trend setup when the meter says "trend".
// msg() builds the alert JSON — see the Connect TradingView page.
if longSig and isTrend
    strategy.entry("L", strategy.long, alert_message = msg("LONG", "TREND"))

Now your alerts only reach TradeLayer when the regime is right. Same idea inverted for a range strategy (isRange, fade-the-edge entries).

4Tag the regime in your alert

Even if you don't gate, it's worth stamping each alert with the regime it fired in. TradeLayer keeps every field of your alert, so you can carry the meter's read through to your journal and review — and later see your win rate in trend vs range. Add it to the alert JSON (build the rest with Connect TradingView):

{
  "secret": "YOUR_SECRET",
  "event": "ALERT",
  "strategy": "My Strategy",
  "market": "FOREX",
  "asset": "{{ticker}}",
  "direction": "LONG",
  "order_type": "MARKET",
  "price": {{close}},
  "regime": "TREND",        // or "RANGE" — your meter's read
  "adx": {{plot_0}}            // optional: the raw ADX value
}
Note: TradeLayer doesn't split your metrics by regime automatically yet — but because it preserves these fields, the read travels with the trade in the raw record and your export. It's the groundwork for regime-based review.

5The trend ↔ range hand-off

Once each of your strategies is gated to a regime, you can run them as a pair: a trend strategy that only fires when the meter reads trend, and a range strategy that only fires when it reads range. As the market shifts, one goes quiet and the other wakes up — a clean hand-off instead of both fighting the same chart.

What you're checking, in TradeLayer's metrics, is whether that hand-off actually helps: does the pair together have a smoother equity curve and a shallower drawdown than either alone? If the trend book bleeds exactly when the range book earns (and vice-versa), they're complementing each other — that's the whole point of measuring the regime.

Start simple. One meter, one threshold, one strategy gated to it. Prove that gating by trend vs range improves your numbers before you run a whole pair. The meter earns its place in your review, not in theory.