TrendOrFlat and TradingView

In plain words

Trade with TradingView? Our filter already works with you — three ways. Pick your path below: by hand, via an execution bot, or via MetaTrader. To check a strategy on history — use the library on this page.

Three ways to use the filter

I trade by hand on the chart

You watch TradingView and enter on the exchange yourself. You get: a Telegram traffic-light on regime change, colored history on the chart, and a CSV simulator for your fills.

Telegram → · Simulator

TV strategy → 3Commas / Wunder bot

TradingView alerts are executed by a bot. Second key: your strategy generates entries; our webhook grants permission — the bot is off in the wrong regime, so alerts go nowhere.

TV + 3Commas recipe →

TV strategy → MT5

Alerts execute in MetaTrader (bridges like PineConnector). The TrendOrFlat Gate expert blocks and closes trades in the wrong regime.

MT5 setup →

Test your strategy

TrendOrFlatFilter library for backtests: embedded public regime history (~90 days, 3h delay). For backtests that is full data. For live trading — the gate sits on the executor (scenarios above).

trendorflat_filter.pine SMA demo


    
Library source

    

Colored background on the chart

Ready-made indicator with the same embedded history — just a regime background. Not live data: refresh by copying the script again.

  1. Open TradingView → Pine Editor → New blank indicator.
  2. Click “Copy script” below (or download the file) and paste it into the editor.
  3. Add it to the chart. The background paints our history: trend up / trend down / sideways / stop.

trendorflat.pine

Honest limit

Live regime cannot be shown inside the TradingView chart: their scripts are barred from the internet — for everyone, not only us. So the live switch sits where a strategy becomes trades: on the execution bot or in MT5. For backtests there is no such limit — history is embedded in the library above.

Technical details

TradingView scripts cannot call the internet, so we embed ~90 days of public history (about a 3-hour delay) into the code. To refresh — copy the script from this page again. This is not entry/exit tips — it is a permission filter: when trend or flat trading is allowed.


    

Start 14-day trial in the cabinet