RegimeGate setup

In plain words

Here you connect TrendOrFlat to your trading software in about 15 minutes. No coding: download a file, paste it, enter an access code. After that your robots stop themselves in bad periods and switch on in good ones. Pick your platform below.

Connect the TSLab cube to the TrendOrFlat market regime feed. 14-day trial — no card.

Open @TrendOrFlatBot

1. Start in the bot

Press Start at @TrendOrFlatBot. Plus trial for 14 days, no card required.

2. Receive materials

The bot sends RegimeGate.dll, your API token, and a link to this guide.

3. Install the DLL

Place the DLL into the TSLab handlers folder and restart TSLab.

4. Add the cube to the schema

Trend agent: AllowedRegimes=TREND_LONG (or TREND_SHORT / both). Flat agent: FLAT. SignalSource=url (TSLab parameter) — paste your Regime API URL and token.

5. Verify

The regime on the cube should match the current regime on the site home — setup complete.

6. Troubleshooting

DLL blocked by Windows → Unblock in file properties. HTTP 403 → /status in the bot (subscription or token). Regime OFF is normal: that is the ensemble decision.

MetaTrader 5

Expert Advisor TrendOrFlat Gate reads the Regime API, sets TOF_TRADE_ALLOWED_* globals, and can close positions when the regime is not allowed.

  1. In MT5: Tools → Options → Expert Advisors → allow WebRequest for https://bvqiqeytjbsgltyuizae.supabase.co (see image).
  2. In Telegram: /mt5 — download TrendOrFlatGate.mq5. Compile in MetaEditor, attach to the chart, paste your token.
  3. Map broker symbol (BTCUSD=BTCUSDT). Poll interval defaults to 60s. Fail-safe without data = OFF.
MT5 WebRequest allowlist

Live demo verification is a human step. Snippet for other EAs: GlobalVariableGet("TOF_TRADE_ALLOWED_BTCUSDT") > 0.5

TradingView + 3Commas + TrendOrFlat

Recipe for a TradingView strategy with a 3Commas bot as executor: entries from TV, trade permission from our filter.

  1. Your TradingView strategy sends alerts to a 3Commas DCA/Signal bot (standard link — see 3Commas docs).
  2. In our Telegram bot: /webhook_add with the 3commas preset — we enable/disable that bot by market regime.
  3. Run /webhook_test — confirm the receiver answers.
  4. Done: in the wrong regime the bot is off, so TradingView alerts go nowhere.

MetaTrader path — see the MT5 section above.

Webhooks (3Commas, WunderTrading, Veles…)

Plus/Max can push regime changes to any TradingView-compatible webhook URL. We send STOP of the old regime, then START of the new one — only when the regime actually changes.

  1. In Telegram: /webhook_add 3commas https://api.3commas.io/signal_bots/webhooks BTCUSDT (or generic / wundertrading / veles).
  2. Save the secret shown once. For 3Commas, paste your Signal Bot secret + bot_uuid into the JSON templates (replace YOUR_3COMMAS_SECRET / YOUR_BOT_UUID).
  3. Run /webhook_test <id> — your endpoint should receive a synthetic STOP→START with test=true.
  4. Live: each new ensemble regime for that symbol fires the webhook automatically.

Limits: Plus = 1 webhook, Max = 5. HMAC header X-TrendOrFlat-Signature is always sent.