BeiDou TianShu
- Experts
- Version: 1.1
- Activations: 5
### Core Strategy
- **SAR Reversal Signal**: Trades on Parabolic SAR flips (step & maximum adjustable). The flip bar is defined as K0; the first pending order is placed at K1 open.
- **Pending Order Offset**: BUY STOP placed above K0 high, SELL STOP placed below K0 low, with a user-defined offset in points.
- **Fixed SL / TP**: Both measured from the pending price, independently adjustable, attached to every layer.
- **Auto Cancel on Reverse Signal**: If SAR flips against an unfilled pending order, the order is deleted immediately.
### Martingale Money Management
- **Adjustable Multiplier** (default 1.52): Lot size grows as `BaseLot × Multiplier^(Layer-1)`.
- **Max Layers** (default 5, including first order): Trading stops and state resets after reaching the limit.
- **Max Lot Cap**: Global upper bound to prevent runaway exposure; auto-adapts to broker's min/max/step.
- **Auto Next Layer on Stop Loss**: After any SL, the next layer is re-placed at the same price with increased lot size.
- **Take-Profit Stop & Daily Reset**: After any TP, the EA enters a "no-new-entry" state until **00:00 server time the next day**. Existing positions and pendings remain managed. Status and reset time are shown on the panel.
### Trading Modes
- **Auto-Trade Master Switch**: Pause signal generation while keeping all position/pending management active.
- **Auto / Manual Mutual Exclusion**: Only one mode can operate per Martingale round.
- **Manual Panel**: Lot input, price input, direction selector (Long Only / Short Only), Buy Stop / Sell Stop buttons.
- **Direction Control**: Panel direction applies to **both** auto and manual trading simultaneously.
### Visual Control Panel
- Dark-themed, card-based layout at chart top-left; all objects share a unified prefix.
- **Status Display**: Auto-trade state, current direction, Bid/Ask, spread / min distance, Martingale layer, next lot size, EA position & pending counts, floating P/L, TP amount, SL amount, cumulative closed net P/L (incl. commission & swap), TP-stop status.
- **Color Coding**: Profit / TP / cumulative gain in red; loss / SL / cumulative loss in green.
- **One-Click Close-All**: Double confirmation required; closes all EA positions, deletes all EA pendings, resets Martingale state.
- **Button Feedback**: Color states for on/off, direction, and order buttons; disabled buttons turn gray.
- **Error Reporting**: Order failures shown on chart + written to EA log with `[Beidou·Tianshu]` prefix.
### EA Restart Recovery
- **Position Recovery**: On restart, existing EA positions are taken over and original logic continues (next-layer on SL, TP-stop, max-layer reset).
- **Pending Recovery**: On restart, existing EA pendings are scanned. If SAR flipped against the direction during downtime, the pending is deleted; otherwise it is taken over.
- **State Persistence**: Layer, direction, lot, TP-stop timestamp are saved to global variables and restored automatically.
### Parameters & System
- **Chinese Parameter Sections**: Grouped as Indicator / Martingale / Pending / System.
- **Magic Number** (default 2472024): Isolates orders, pendings, and history from other EAs.
- **Order Comments**: `天枢首单`, `天枢马丁加仓N`, `手动天枢首单`, `手动天枢马丁加仓N`.
- **Version & Author**: Version shown on panel; startup/shutdown logs print version and author.
### Risk Notice
Martingale strategies can accumulate positions in strong trends. Always set reasonable max layers and max lot caps. Test on demo before live trading. Past performance does not guarantee future results.
---
