TP/SL Engine
Stop, target and size for any Binance perp, in Telegram.
1 tapFrom launch to a full trade plan
01Problem
Every entry meant a calculator and a guess
The client trades perpetual futures and worked out the stop, the target and the position size by hand before every entry. Stops sat at round percentages rather than where the market actually turns, and leverage was picked without seeing where liquidation sat against the stop.
The goal: a complete trade plan in seconds, right in Telegram, with every level placed for a reason and the position sized to a fixed risk.
02Solution
Pick a coin and a side, get the plan
A Telegram Mini App. Choose a coin and tap Long or Short, and the plan appears: stop, target, size and leverage, each level with a one-line reason and copy buttons with plain digits for the exchange.
The levels come from live Binance Futures data. The stop goes just beyond the nearest swing with an ATR buffer against wicks, and past a liquidation cluster if one sits right behind it; the target is set by R:R. The plan warns when liquidation would come before the stop, or when fees eat too much of the risk.
03Build
From calculator to backtested planner
One shared core holds all the trading math, covered by tests, and both the mini app and the server use it.
Live calculator on real data
Levels from ATR(14) on real Binance data, the position sized to the account's risk %, and an interactive chart with live candles. Leverage shows margin, liquidation price and ROE, with the range where liquidation comes before the stop shaded red.
Futures data and the liquidation map
Prices moved to Binance USDT-M perpetuals. An estimated liquidation map is built from 7 days of 15-minute open interest. A server keeps one Binance stream per coin and timeframe for every user, and refills any gap after a reconnect.
Level engine and trade screen
Stops from market structure instead of a fixed percentage, every level with its reason, and one tap from launch to a plan. Saved trades are replayed against later candles to show whether they hit the target or the stop, with win rate and P&L in the profile.
Testing
Every change runs through the full suite in CI before it ships.
- 66 unit tests on the core math: ATR, levels, liquidations, trade outcomes
- 14 server tests against a fake Binance, REST and WebSocket
- 18 end-to-end scenarios in a real browser, on every push
Backtest and retune
A 3-year backtest on 15 Binance perps, fees included, retuned the defaults: the target is now set by R:R, stops start one step wider, and fees are shown in R with a warning above 0.1R.
04Stack
What it's built with
- TypeScriptThe whole project: mini app, server and shared core
- React + ViteThe Telegram Mini App
- Telegram Mini AppRuns inside Telegram, no install
- FastifyMarket-data server with shared live streams
- Binance FuturesCandles, open interest and live prices
- Lightweight ChartsThe interactive price chart
- Vitest + PlaywrightUnit, server and end-to-end tests
- DockerOne container serves the app and the API
05Result
A full plan in one tap
- From launch to a full plan
- 1 tap
- Of backtest behind the defaults
- 3 years
- Automated tests on every push
- 98
Each level comes with the reason it's there, the size follows the risk, and leverage is checked against liquidation before the trade, not after. Saved trades show how they ended, so the plan can be judged by results.
06Client review
I used to set stops by hand and forget half of them. Now every position gets its stop and targets the second it opens, and the stop follows price on its own.
07Next step
Need something like this?
Custom Developmentfrom $7,500around 14 days
- Tell me about your strategy and what it should do
- A call and a written plan within 24 hours
- A fixed price and timeline before any work starts




