Function stopStrategy

  • Stops the strategy from generating new signals.

    Sets internal flag to prevent strategy from opening new signals. Current active signal (if any) will complete normally. Backtest/Live mode will stop at the next safe point (idle state or after signal closes).

    Automatically detects backtest/live mode from execution context.

    Parameters

    • symbol: string

      Trading pair symbol; the strategy is resolved from the active method context

    Returns Promise<void>

    Promise that resolves when stop flag is set

    import { stopStrategy } from "backtest-kit";

    // Stop strategy after some condition (inside a strategy/action callback)
    await stopStrategy("BTCUSDT");