Equity Percentage Order + TP / SL Workflow
Overview
This is a fully automated perpetual futures trading system built on the Inventor Quant platform's workflow engine, executing at second-level frequency. Through a modular node architecture, the strategy chains position sizing, order placement, conditional SL/TP order management, and status monitoring into a complete, self-contained trading loop. It supports both long and short directions and is designed for USDT-margined perpetual swap contracts.
Core Logic
1. Market Trigger
The strategy is driven by candlestick close events. Each time a candle closes, the full decision-making pipeline is triggered at second-level precision, keeping execution tightly synchronized with market rhythm.
2. Equity-Based Position Sizing
On every trigger, the system automatically retrieves the account's available balance and dynamically calculates the number of contracts to open based on a user-defined risk ratio. The calculation accounts for contract face value, quantity precision, and minimum/maximum order size constraints to ensure a compliant and executable position size.
3. State Machine–Driven Trade Management
The strategy employs a three-state flow:
- Unfinished: Executes the entry logic — places a market order and awaits fill confirmation;
- Monitor: Actively monitors the status of both conditional SL and TP orders while tracking real-time P&L percentage;
- Finished: Once either conditional order is triggered, the other is automatically cancelled and the state resets, preparing the system for the next trade cycle.
4. Automated Stop Loss & Take Profit
Upon order fill, the system calculates stop loss and take profit prices based on the average fill price and the user-defined percentage thresholds, then simultaneously submits two conditional orders. If the stop loss fires, the take profit order is cancelled automatically — and vice versa — eliminating any risk of duplicate position closure.
Strategy Highlights
- Fully unattended operation, running automatically 24/7
- Risk exposure strictly governed by equity percentage — disciplined capital management
- Persistent state storage ensures seamless recovery of monitoring after restarts
- Modular node design offers clean logic, easy extensibility, and straightforward customization
Vedio Link:Equity Percentage Order + TP / SL Workflow
- 1