0bps

Strategy vault / Other

KST Strategy

Pine Script strategy by 镜花水月,.

Pine ScriptOtherSMA
Author
镜花水月,
Complexity
Starter · 31 lines
Parameters
5
Backtest bar
1h · intraday
Tested on
BTC/USDT · futures

The original spec has no written description. Read the source below.

Parameters

NameDefaultWhat it controls
v_input_110ROC1
v_input_215ROC2
v_input_320ROC3
v_input_430ROC4
v_input_59SMA1

Source Pine Script

/*backtest
start: 2022-11-28 00:00:00
end: 2023-12-04 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=4
strategy("KSTStrategy", overlay = false, pyramiding=1, default_qty_type= strategy.percent_of_equity, default_qty_value = 100,commission_type=strategy.commission.percent,commission_value=0.07)

ROC1 = input(10)
ROC2 = input(15)
ROC3 = input(20)
ROC4 = input(30)
SMA1 = input(9)

ROCma1 = sma(roc(close, ROC1), 10)
ROCma2 = sma(roc(close, ROC2), 10)
ROCma3 = sma(roc(close, ROC3), 10)
ROCma4 = sma(roc(close, ROC4), 15)
hline(0)

KST = ROCma1 + ROCma2 * 2 + ROCma3 * 3 + ROCma4 * 4
signal = sma(KST, SMA1)

plot(KST, color=color.green)
plot(signal, color=color.red)
if ta.crossover(KST,signal) //and KST >= 0 //and signal >=0
    strategy.entry("L",strategy.long)
if ta.crossunder(KST,signal) //and KST <= 0 //and signal <=0
    strategy.entry("S",strategy.short)

Published by 镜花水月, on the FMZ strategy square · last modified 2023-12-26. Collected in the Quant Trading Vault. Unvalidated research: re-test with your own data and costs before trusting it.

Build this with AgenKit

A spec is not a trading system. Paste this into your coding agent and AgenKit runs a specialist team — architecture, test-first build, risk gates, review — with paper trading on by default.

in Claude Code, Cursor, Codex & 4 more
/agenkit build a production-grade trading bot with a backtest engine, risk controls and paper trading by default from strategies/KST-Strategy.md
  1. npx agenkit install engineering-kit in your project
  2. Paste the command into your agent and approve each phase
  3. Get tests, backtest, risk controls and a paper-trading switch

Understand it first

Before you run this, read the lesson behind the idea and how to backtest it honestly. Specs like this one are the survivors of an unknown number of trials; deflate their results accordingly.

Related specs

esc

Try , , or .

↑↓ move↵ open