0bps

Strategy vault / Volatility

Channel strategy based on ATR

- Strategy name: Channel strategy based on ATR volatility index - Strategy idea: Channel Adaptive Strategy, Fixed Stop + Floating Stop - Data Cycle: Multi-Cycle - Main chart: Draw UBAND, formula: UBAND ^^ MAC + MATR…

MyLanguageVolatilityATR
Author
阿基米德的浴缸
Complexity
Starter · 22 lines
Parameters
3
  • Strategy name: Channel strategy based on ATR volatility index

  • Strategy idea: Channel Adaptive Strategy, Fixed Stop + Floating Stop

  • Data Cycle: Multi-Cycle

    IMG
    IMG

  • Main chart: Draw UBAND, formula: UBAND ^^ MAC + MATR; Draw DBAND, formula: DBAND ^^ MAC-MATR;

  • Secondary chart: none

Parameters

NameDefaultWhat it controls
SLOSS2Stop Loss Percentage | stop loss percentage
N200ATRMetric parameters | ATR index parameter
M4Upper and lower rail coefficients | upper and lower track coefficients

Source MyLanguage

(*backtest
start: 2018-06-01 00:00:00
end: 2018-07-01 00:00:00
period: 1h
exchanges: [{"eid":"Futures_OKCoin","currency":"BTC_USD"}]
args: [["TradeAmount",10,126961],["ContractType","this_week",126961]]
*)

TR1:=MAX(MAX((HIGH-LOW),ABS(REF(CLOSE,1)-HIGH)),ABS(REF(CLOSE,1)-LOW));
ATR:=MA(TR1,N);
MAC:=MA(C,N);
UBAND^^MAC+M*ATR;
DBAND^^MAC-M*ATR;
H>=HHV(H,N),BPK;
L<=LLV(L,N),SPK;
(H>=HHV(H,M*N) OR C<=UBAND) AND BKHIGH>=BKPRICE*(1+M*SLOSS*0.01),SP;
(L<=LLV(L,M*N) OR C>=DBAND) AND SKLOW<=SKPRICE*(1-M*SLOSS*0.01),BP;
// stop loss
// stop loss
C>=SKPRICE*(1+SLOSS*0.01),BP;
C<=BKPRICE*(1-SLOSS*0.01),SP;
AUTOFILTER;

Published by 阿基米德的浴缸 on the FMZ strategy square · last modified 2018-12-18. 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/Channel-strategy-based-on-ATR.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