0bps

Strategy vault / Other

Break High and Low Volume Index Weighting Strategy

- Data cycle: multiple cycles - Backtest can choose OKEX futures - Contract: this week contract - Main chart: none - Secondary chart: VJQ, calculation formula: VJQ: EMA (V (C-REF (C, NC)), N)

MyLanguageOtherEMA
Author
阿基米德的浴缸
Complexity
Starter · 32 lines
Parameters
4
  • Data cycle: multiple cycles

  • Backtest can choose OKEX futures

  • Contract: this_week contract

    IMG
    IMG

  • Main chart: none

  • Secondary chart: VJQ, calculation formula: VJQ: EMA (V* (C-REF (C, NC)), N)

Parameters

NameDefaultWhat it controls
SLOSS2Stop Loss Percentage | percentage of stop loss
N300EMAMetric parameters | EMA index parameter
NC50Closing price from how many periods ago | closing price of how many cycles ago
MINAMOUNTtrueMinimum order quantity per time | minimum order quantity at a time

Source MyLanguage

(*backtest
start: 2018-04-01 00:00:00
end: 2018-05-28 00:00:00
period: 1h
exchanges: [{"eid":"Futures_OKCoin","currency":"BTC_USD"}]
args: [["N",100],["MINAMOUNT",10],["TradeAmount",10,126961],["ContractType","this_week",126961]]
*)

LOTS:=MAX(MINAMOUNT,INTPART(MONEYTOT/O * 0.8));
VJQ:EMA(V*(C-REF(C,NC)),N);
B:=VJQ>0;
S:=VJQ<0;
BUYPK:=BARPOS>N AND BKVOL=0 AND B AND H>=HHV(H,N);
SELLPK:=BARPOS>N AND SKVOL=0 AND S AND L<=LLV(L,N);
BUYP:=SKVOL>0 AND B;
SELLP:=BKVOL>0 AND S;

// Admission
// Enter
SELLPK,SPK(LOTS);
BUYPK,BPK(LOTS);

// Exit position
// Leave
BUYP,BP(SKVOL);
SELLP,SP(BKVOL);

// stop loss
// Stop loss
C>=SKPRICE*(1+SLOSS*0.01),BP(SKVOL);
C<=BKPRICE*(1-SLOSS*0.01),SP(BKVOL);
AUTOFILTER;

Published by 阿基米德的浴缸 on the FMZ strategy square · last modified 2018-12-15. 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/Break-High-and-Low-Volume-Index-Weighting-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