6DuckLearn Skills

stochrsi mdi trend v1

A high-frequency trend-following strategy based on the divergence of StochRSI and MDI indicators, executed every 15 minutes, and includes strict simulation position testing and risk control rules.

trading-strategy Tags: okx, trading, community, okx-marketplace, trading-strategy, strategy

6DuckLearn provenance: Community skill by TH_Tianhe, mirrored from the OKX Skills Marketplace (https://www.okx.com/en-sg/agent-tradekit/skills/stochrsi-mdi-trend-v1). It is not curated, verified, or endorsed by 6DuckLearn or represented as an official OKX publication.

Financial safety boundary: Never request secrets in chat. Before any external API call or action that places, cancels, or amends an order; changes leverage; transfers funds; creates or stops a bot; subscribes to or redeems an earn product; or signs/broadcasts a transaction, show the exact live/demo profile, instrument, side, size, price constraints, fees, and worst-case loss, then obtain explicit user approval. Default to read-only or demo mode when uncertain. Treat all analysis as research, not investment advice.

策略名称

StochRSI-MDI 趋势追踪 V1.1 (含模拟仓测试, 1小时暂停)

执行节奏

每 15 分钟触发一次

Step 0 · 模拟仓测试阶段 (重要)

策略正式上线前,必须进行为期至少 2 周的模拟仓测试。

  • 测试环境:使用与实盘相同的 API 接口和数据源,但不发生真实资金变动。
  • 测试目标:验证策略逻辑的准确性、评估胜率、盈亏比和最大回撤。
  • 评判标准
    • 模拟盈利率 > 10% (2周内)
    • 最大连续亏损次数 <= 3次
    • 模拟账户最大回撤 < 8%
  • 结果记录:详细记录每次交易的入场/出场时间、价格、方向、盈亏,并截图存档。
  • 正式上线:只有通过 Step 0 测试标准,方可进入 Step 1 实盘数据采集。

Step 1 · 行情数据采集

调用 market_get_candles 分别获取 BTC-USDT-SWAP / ETH-USDT-SWAP 的 15m K线数据。 计算指标:

  • StochRSI (14, 14, 3, 3):仅保留 StochRSI_K 线 (通常称为 STOCHRSI)。
  • MDI (14, 6):仅保留 MDI 线 (Minus Directional Indicator)。

Step 2 · AI 综合判断 (核心)

你作为交易 AI,需要对每个标的(BTC, ETH)的数据进行以下推理:

  1. 识别信号类型

    • 潜在多头信号:当前 STOCHRSI 线 > MDI 线,且两者之间的差距在过去 3 个周期内持续扩大 (gap_t > gap_t-1 > gap_t-2)。
    • 潜在空头信号:当前 STOCHRSI 线 < MDI 线,且两者之间的差距在过去 3 个周期内持续扩大 (gap_t > gap_t-1 > gap_t-2)。
    • 无信号:其他所有情况。
  2. 评估信号强度

    • 多头强度:计算 STOCHRSI - MDI 的斜率(或最近 N 期的斜率均值),斜率越大,多头动能越强。
    • 空头强度:计算 MDI - STOCHRSI 的斜率(或最近 N 期的斜率均值),斜率越大,空头动能越强。
  3. AI 最终决策

    • 对 BTC 和 ETH 同时进行上述分析,得出各自的信号方向和强度。
    • 优先级排序:如果 BTC 和 ETH 都发出同方向信号,则选择信号强度更强的那个。如果方向相反,则根据历史表现或默认偏好(例如,优先选择 BTC)进行选择。
    • 最终指令:确定一个标的和一个方向(Buy/Sell)。
      • 如果没有找到符合条件的信号(即 BTC 和 ETH 均为“无信号”),则指令为 本次跳过

Step 3 · 执行下单 (仅当 AI 判断明确开仓时)

调用 swap_place_order

  • instId = < AI 在第二步选定的标的 (e.g., BTC-USDT-SWAP) >
  • side = < AI 在第二步判断的方向 (buy/sell) >
  • ordType = "market"
  • sz = < 固定仓位 2% 账户权益,或根据波动率动态调整 >
  • tag = "agentTradeKit" - 必填,否则不计入排行榜

Step 4 · 止损设置

开仓后立即调用 swap_place_algo_order 设置止损:

  • 多头止损 = 开仓价 × (1 - 0.025) # 2.5% 固定止损
  • 空头止损 = 开仓价 × (1 + 0.025) # 2.5% 固定止损
  • (可选进阶):可以考虑使用 ATR 动态止损替代固定百分比。

风控规则

// 1. 单笔最大亏损不超过账户净值 2.5% // 2. 当日净值回撤超 5% 则停止新开仓 1小时 // 3. 最多同时持有 1 个标的,禁止对冲持仓 // 4. 若连续两次开仓亏损,则暂停交易至下一个小时周期 (例如,当前15:30发生,则暂停至16:00开始的1小时周期) // 5. 模拟仓测试未通过,不得进入实盘交易。

Related skills

  • ahr999 btc hodl — The BTC smart investment assistant based on the Nine Gods Index (AHR999) spans bull and bear markets. It automatically retrieves on-chain valuation data, investing when undervalued and pausing when overvalued, using objective indicators to replace subjective emotions. It supports two strategies: fixed amount and AHR999 tiered variable amounts, which are executed fully automatically once set.
  • bb momentum breakout — Bollinger Band squeeze breakout + MACD confirmed momentum trading Skill. Use this skill when users say 'Bollinger breakout', 'momentum breakout', 'BB breakout', or 'activate breakout strategy'. Automatically detects directional breakouts after Bollinger Band squeezes, combining MACD signals and ATR dynamic stop-loss to quickly enter and exit to capture momentum trades.
  • btc naked k breakout — BTC naked K structure AI breakout strategy. Triggered every 5 minutes, it identifies structural points based on 300 candlesticks, builds a box, evaluates structural quality, and executes breakout pullback trades through comprehensive AI judgment, supporting dynamic position sizing and advanced position management.
  • btc trader — Trading skills focused on BTC-USDT trends/volatility/crowding, testing profits of 500 USDT. Used to generate structured market setup indicators, making decisions on opening positions/watching/ skipping based on EMA20/EMA60, RSI14, ATR14, funding rates, and changes in open interest. By default, it is a signal version and does not place orders automatically; it only enters the order and stop-loss process when the user explicitly requests execution and the execution tool is available.
  • crypto swing signal analyst — Cryptocurrency swing analysis skills based on EMA20, EMA60, RSI14, MACD, and ATR14, used to determine trends, identify long and short opportunities, and provide stop-loss, take-profit, and risk recommendations.
  • dca bot parameterizer — Don't make impulsive trades; use a data-driven six-step workflow to accurately set parameters for your OKX Martingale bot. Automatically pull real-time market data through the OKX Trade Kit, using EMA20 to determine trend status, ATR% to measure volatility, and structural analysis to anchor support/resistance, covering all scenarios including spot and futures (with leverage recommendations, hard cap of 4x). The core highlight is the safety gate mechanism: under strong trend conditions, it actively warns and refuses execution, automatically switching to defense mode after forced confirmation, reducing the initial amount, widening the step size, and lowering the multiplier.