0bps

Strategy vault / Other

Nik Stoch

Stochastics Oscillator with settings of 5,3,3 Levels : 15, 85, 30, 70 backtest

Author
ChaoZhang
Complexity
Starter · 42 lines
Parameters
6
Backtest bar
1h · intraday
Tested on
BTC/USDT · futures

Stochastics Oscillator with settings of 5,3,3 Levels : 15, 85, 30, 70

backtest IMG

Parameters

NameDefaultWhat it controls
v_input_int_114lookback_period
v_input_int_23m1
v_input_int_33m2
v_input_int_45lookback_period1
v_input_int_53m3
v_input_int_63m4

Source Pine Script

/*backtest
start: 2022-04-09 00:00:00
end: 2022-05-08 23:59:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=5
indicator('Nik Stoch')
lookback_period = input.int(14, minval=1)
m1 = input.int(3, minval=1)
m2 = input.int(3, minval=1)

k = ta.sma(ta.stoch(close, high, low, lookback_period), m1)
d = ta.sma(k, m2)
//plot(k)
//plot(d, color=color.red)
h0 = hline(15)
h1 = hline(85)
h2 = hline(50)
h3 = hline(30)
h4 = hline(70)

fill(h0, h1, color=color.new(color.purple, 95))

/////stoch fast
lookback_period1 = input.int(5, minval=1)
m3 = input.int(3, minval=1)
m4 = input.int(3, minval=1)

k1 = ta.sma(ta.stoch(close, high, low, lookback_period1), m3)
d1 = ta.sma(k1, m4)
plot(k1, color=color.new(color.aqua, 0))
plot(d1, color=color.new(color.red, 0))


if k1[1] < d1[1] and k1 > d1
    strategy.entry("Enter Short", strategy.short)
else if k1[1] > d1[1] and k1 < d1
    strategy.entry("Enter Long", strategy.long)
    

Published by ChaoZhang on the FMZ strategy square · last modified 2022-05-10. 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/Nik-Stoch.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