0bps

Strategy vault / Mean reversion

Dual Thrust MyLanguage version

- Fundamental: At the close of the day, two values are calculated: the highest price - the closing price, and the closing price - the lowest price. Then take the larger one and multiply it by the value of k. The…

MyLanguageMean reversion
Author
阿基米德的浴缸
Complexity
Starter · 21 lines
Parameters
3
  • Fundamental: At the close of the day, two values are calculated: the highest price - the closing price, and the closing price - the lowest price. Then take the larger one and multiply it by the value of k. The result is called the trigger value. At the opening of the next day, record the opening price, then buy immediately when the price exceeds (opening price + trigger value), or sell short when the price is lower than (opening price - trigger value). This system is a reversal system with no separate stop loss. In other words, the reverse signal is also the closing signal.

    IMG
    IMG
    IMG

  • Main chart: Upper track: formula: UPTRACK^^O+KSRG; Lower track: formula: DOWNTRACK^^O-KXRG;

  • Secondary chart: none

Parameters

NameDefaultWhat it controls
N4Calculation cycle | Period: calculate period
KS0.5Upper rail coefficient | upper track coefficient
KX0.5Lower rail coefficient | lower track coefficient

Source MyLanguage

(*backtest
start: 2018-01-01 00:00:00
end: 2018-02-28 00:00:00
period: 1d
exchanges: [{"eid":"Futures_OKCoin","currency":"BTC_USD"}]
args: [["ContractType","this_week",126961]]
*)

HH:=HV(H,N);
HC:=HV(C,N);
LL:=LV(L,N);
LC:=LV(C,N);

RG:=MAX(HH-LC,HC-LL);
UPTRACK^^O+KS*RG;
DOWNTRACK^^O-KX*RG;


C>UPTRACK,BPK;
C<DOWNTRACK,SPK;

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/Dual-Thrust-MyLanguage-version.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