"I don't need to know which way the market will move. I just need to be the ONLY ONE who knows when it moves." β Nathan Mayer Rothschild
Bot trading kripto 100% engineering, zero AI cost untuk Indodax.
396 commits. Fully autonomous. Zero human intervention.
| File | Fungsi |
|---|---|
main.py |
Orchestrator β portfolio cycle, momentum scanner, state machine, Telegram poller, deadman |
rules.py |
Regime-gated decision engine β BULL/BEAR β momentum, SIDEWAYS β mean-reversion, HIGH_VOL β survival |
risk_manager.py |
ATR SL/TP, per-regime Kelly, circuit breaker, validate_allocation |
executor.py |
Indodax HMAC-SHA512 signing, market/maker_first/maker orders |
data_layer.py |
Indodax REST API (ticker, pairs, depth, OHLCV) |
market_ws.py |
WebSocket realtime tickers (24h summary) |
private_ws.py |
WebSocket order fill notification |
deadman.py |
/countdownCancelAll safety net (15 menit) |
indicators.py |
Teknikal indikator (RSI, MACD, BB, EMA, ADX, MFI, Hurst, Skew) |
hmm_regime.py |
HMM regime detector (4 states) |
momentum.py |
Velocity-aware momentum engine |
patterns.py |
Paradiddle pattern matching (RLRL reversal detection) |
persist.py |
JSON state persistence (semua survive restart) |
db.py |
SQLite trade log + chat history |
notifier.py |
Telegram sender |
config.py |
Semua konfigurasi |
.env |
Environment variables (gitignored) |
BUY β MARKET (keisi pasti, fee taker 0.31%)
β
STATE MACHINE (kelola exit)
βββ SIDEWAYS β TP_ACTIVE: pasang TP limit @ ATRΓ2, SL @ ATRΓ1.2
βββ BULL β TRAILING: initial SL @ ATRΓ0.5, trailing SL @ ATRΓ1.5
βββ HIGH_VOL β survival (no entry)
β
Transisi otomatis via WS tick:
TP_ACTIVE β harga turun ke SL? β cancel TP, place SL
SL_ACTIVE β harga balik? β cancel SL, place TP
TRAILING β harga naik? β trailing SL ikut naik
β
FILLED β closed, cooldown 24h (gak ambil coin user)
| State | Strategi | Entry | Exit | Kelly |
|---|---|---|---|---|
| BULL (β₯5 cycle β π΄ Rothschild) | Momentum + trailing | Market buy | Trailing SL (ATRΓ1.5) + pyramid | 25% |
| BEAR | Momentum defensif | Market buy | TP limit @ ATRΓ2 | 15% |
| SIDEWAYS | Mean-reversion (BB fade, RSI) | Market buy | TP limit @ ATRΓ0.5 | 10% |
| HIGH_VOL | Survival | β No entry | Exit only | 5% |
Setiap posisi punya state yang di-track di _position_states:
| State | Deskripsi |
|---|---|
NEW |
Init, segera overwrite |
PENDING |
TP/SL gagal β retry tiap cycle |
TP_ACTIVE |
TP fixed @ entry + ATRΓ2. Harga turun? β cancel TP, place SL |
SL_ACTIVE |
SL active. Harga balik? β cancel SL, place TP |
TRAILING |
No TP, trailing SL. Harga naik? β SL ikut naik. Pyramid ON |
Transisi realtime via WS tick (bukan nunggu cycle 60 detik):
- TP limit order nangkring di exchange β keisi otomatis
- SL limit order nangkring β keisi kalau harga turun
- HARD SL: kalau harga >3% di bawah SL β force close di bid
Aktif saat HMM = SIDEWAYS:
Entry: Close β€ BB_lower + RSI < 35 + volume surge
Exit: TP ATRΓ0.5 (0.5-1%)
SL: ATRΓ0.8
WR: 65-70%
Maks: 2 posisi
Deteksi pola RLRL (Resistance/Low):
| Pola | Arti | Aksi |
|---|---|---|
RLRR |
Fake breakout | SELL |
LRLL |
Fake breakdown | BUY |
RRL after RRR |
Exhaustion | SELL |
LLR after LLL |
Exhaustion | BUY |
Initial SL: ATRΓ0.5 (2.5%) β tight cut
Trailing SL: ATRΓ1.5 β ride runner
Pyramid: profit ATRΓ0.5 β tambah 50% market buy
Entry_mode per posisi: exit pake aturan saat entry, bukan mode aktif
Matematika:
- 9 trade rugi 2.5% Γ 9 = -22.5%
- 1 trade profit 10% Γ 1.5 (pyramid) = +15%
- Masih negatif tanpa trailing. Trailing SL bikin winner bisa 15-20% β NET POSITIF.
Bukan ngukur magnitude sinyal, tapi phase alignment 4 loop:
- Price acceleration β velocity makin cepat
- Volume surge β volume > price velocity
- Order book imbalance β tekanan beli/jual real-time
- HMM confidence β BULL/BEAR > 0.9
| Loop Aligned | Aksi | Size |
|---|---|---|
| β₯3 (VORTEX) | ALL-IN, trailing ATRΓ3, no TP | 50%+ |
| 2 | Rothschild normal | 15-25% |
| 0-1 | Skip | 0-10% |
| Lapis | Trigger | Aksi | Persist |
|---|---|---|---|
| Daily loss | Equity turun Rp15k dari peak | Stop entry, TP-only | β |
| Consecutive loss | 5 hari loss berturut | Stop total 72 jam | β |
| Equity floor | Equity < Rp10k | Shutdown total | β |
| Drawdown | 15% dari all-time peak | Warning | β |
| Deadman | Bot crash 15 menit | Exchange cancel order | Exchange |
| SM cooldown | 24h setelah SM FILLED | Skip re-init (aman buat user) | β |
| Transaksi | Fee |
|---|---|
| BUY market | 0.31% (taker) |
| SELL limit (TP) | 0.20% + PPh 0.21% + CFX 0.0111% |
| Round trip | ~0.73% |
Procfile: worker: python main.py
Runtime: python-3.12
Platform: Railway (auto-deploy from GitHub)
Volume: /data (state.json + trades.db)
Total: 396 commits, ~4000 baris kode
| Command | Fungsi |
|---|---|
/status |
Portfolio & posisi |
/ask <coin> |
Detail sinyal & ATR koin |
/atr |
ATR, SL, TP semua posisi |
/greed |
Bypass daily loss (1Γ/hari) |
/why |
Alasan bot gak trading |
/commands |
Daftar lengkap |
/project |
Proyeksi harian, bulanan, tahunan |
/today |
Performa hari ini |
/perf |
Win rate & stats |
Dari riset independen: "Boutique systematic prop-trading system" β secara risk-management dan signal architecture, bot ini jauh di atas retail bot (3Commas/Bitsgap/Cryptohopper/Gunbot) dan setara junior prop desk institusional.
Unik: Satu-satunya bot dengan Full Indodax API Coverage β tidak ada platform retail besar yang support Indodax.
Copyright (C) 2026 FMA ALPHA QUANT LABS β AGPL-3.0
"Yang penting bukan profit di bear market. Yang penting masih idup pas bull datang." β FMA