一键导入
bitmex-recipe-trailing-stop-runner
Ride a trend with a trailing stop that locks in profits on reversal.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Ride a trend with a trailing stop that locks in profits on reversal.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Price, funding, liquidation, and balance alerts using polling and WebSocket on bitmex-cli.
Autonomy progression for bitmex-cli agents: from read-only market data to autonomous fund management.
Delta-neutral basis trading between BitMEX perpetuals and fixed-date futures: entry, monitoring, and exit.
Dollar cost averaging on bitmex-cli: testnet-first, fixed qty per interval, limit orders, and position cap enforcement.
Error category handling, duplicate order prevention, retry logic, and partial fill management for bitmex-cli.
Minimize trading fees on bitmex-cli: maker vs taker, post-only orders, commission tiers, and fee audit.
| name | bitmex-recipe-trailing-stop-runner |
| description | Ride a trend with a trailing stop that locks in profits on reversal. |
Enter a directional position and manage it with a trailing stop that ratchets up as price moves in your favour, then exits on reversal.
BITMEX_API_KEY and BITMEX_API_SECRET set.jq installed.SYMBOL, QTY, TRAIL_PCT (e.g. 2 for 2%).ENTRY_PRICE=95000
bitmex order buy XBTUSD 100 --order-type Limit --price $ENTRY_PRICE --validate -o json
# If validate looks good, submit:
bitmex order buy XBTUSD 100 --order-type Limit --price $ENTRY_PRICE --yes -o json
Place a stop at 2% below entry with ReduceOnly so it can only close, not flip:
STOP_PRICE=$(echo "$ENTRY_PRICE * 0.98" | bc | xargs printf "%.0f")
bitmex order sell XBTUSD 100 --order-type Stop \
--stop-px $STOP_PRICE --exec-inst ReduceOnly --yes -o json \
| jq '{orderID, stopPx, ordStatus}'
Save the orderID returned for later cancellation.
bitmex ws instrument:XBTUSD -o json | jq -c '.data[0].lastPrice'
When price moves up by TRAIL_PCT, cancel the old stop and place a new one:
NEW_STOP=$(echo "$CURRENT_PRICE * 0.98" | bc | xargs printf "%.0f")
# Cancel old stop
bitmex order cancel --order-id $STOP_ORDER_ID --yes -o json
# Place new stop
STOP_ORDER_ID=$(bitmex order sell XBTUSD 100 --order-type Stop \
--stop-px $NEW_STOP --exec-inst ReduceOnly --yes -o json | jq -r '.orderID')
echo "Stop moved to $NEW_STOP"
bitmex ws --auth execution -o json | jq -c 'select(.data[].ordStatus == "Filled")'
When the stop fills, the position is closed and the trade is complete.
--testnet before running with real funds.