0bps

Strategy vault / Other

Trading Strategy of Traditional MA Index and KD Index

- Data Cycle: 15M, 30M, etc. - Support: Commodity Futures - Indicators are EMA, KD lines, and KD line use default parameters (index parameters fixed 3, 3, 9) - Main chart: EMA mean, formula: MAC ^^ EMA (C, N); -…

MyLanguageOtherEMASMA
Author
阿基米德的浴缸
Complexity
Starter · 29 lines
Parameters
2
  • Data Cycle: 15M, 30M, etc.

  • Support: Commodity Futures

  • Indicators are EMA, KD lines, and KD line use default parameters (index parameters fixed 3, 3, 9)

    IMG
    IMG

  • Main chart: EMA mean, formula: MAC ^^ EMA (C, N);

  • Secondary chart: K line in KD, formula: K: SMA (RSV, M1, 1); //RSV moving average D line in KD, formula: D: SMA (K, M2, 1); //K moving average value

Parameters

NameDefaultWhat it controls
SLOSS2Stop Loss Percentage | stop loss percentage
N120EMAParameters | EMA parameter

Source MyLanguage

(*backtest
start: 2018-04-01 00:00:00
end: 2018-05-15 00:00:00
period: 30m
exchanges: [{"eid":"Futures_BitMEX","currency":"XBT_USD"}]
args: [["TradeAmount",100,126961],["ContractType","XBTUSD",126961]]
*)

MAC^^EMA(C,N);

NKD:=9;
M1:=3;
M2:=3;
RSV:=(CLOSE-LLV(LOW,NKD))/(HHV(HIGH,NKD)-LLV(LOW,NKD))*100;  //Make the difference between the closing price and the lowest value of the NKD period, make the difference between the highest value of the NKD period and the lowest value of the NKD period, and make the ratio between the two differences.
// (1)closing price minus the lowest value in NKD cycle, 
// (2)the highest value in NKD cycle minus the lowest value in NKD cycle, then (1) divided by (2).

K:SMA(RSV,M1,1);     // RSVMoving average of
                     // MA of RSV
                     
D:SMA(K,M2,1);       // KMoving average of
                     // MA of K

BARPOS>N AND C>MAC AND K<D,BK;
BARPOS>N AND C<MAC AND K>D,SK;
C<=BKPRICE*(1-SLOSS*0.01),SP(BKVOL);
C>=SKPRICE*(1+SLOSS*0.01),BP(SKVOL);
C>=BKPRICE*(1+SLOSS*0.01) AND C<MAC,SP(BKVOL);
C<=SKPRICE*(1-SLOSS*0.01) AND C>MAC,BP(SKVOL);

Published by 阿基米德的浴缸 on the FMZ strategy square · last modified 2019-08-20. 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/Trading-Strategy-of-Traditional-MA-Index-and-KD-Index.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