Relative Strength Strategy Based on Price
- Strategy Name: Relative Strength Strategy Based on Price - Data cycle: 1H - Support: Commodity Futures, Digital Currency and Digital Currency Futures - Main chart: MA, formula: MAN^^MA(C,N); - Secondary chart: none
Strategy Name: Relative Strength Strategy Based on Price
Data cycle: 1H
Support: Commodity Futures, Digital Currency and Digital Currency Futures

Main chart: MA, formula: MAN^^MA(C,N);
Secondary chart: none
Parameters
| Name | Default | What it controls |
|---|---|---|
| N | 100 | Moving average indicator parameters | MA index parameter |
| M | 2 | Stop loss spread coefficient | stop loss difference coefficient |
Source MyLanguage
(*backtest
start: 2018-02-01 00:00:00
end: 2018-04-27 00:00:00
period: 1h
exchanges: [{"eid":"Futures_CTP","currency":"FUTURES"}]
args: [["ContractType","rb888",126961]]
*)
MAN^^MA(C,N);
B_MA:=C>MAN;
S_MA:=C<MAN;
S_K1:=SUM((H-C)*V,N)/SUM((H-L)*V,N)>0.5;
B_K1:=SUM((C-L)*V,N)/SUM((H-L)*V,N)>0.5;
CO:=IF(C>O,C-O,0);
OC:=IF(C<O,O-C,0);
S_K2:=SUM(OC*V,N)/SUM(ABS(C-O)*V,N)>0.5;
B_K2:=SUM(CO*V,N)/SUM(ABS(C-O)*V,N)>0.5;
B_K1 AND B_K2 AND B_MA AND H>=HHV(H,N),BPK;
S_K1 AND S_K2 AND S_MA AND L<=LLV(L,N),SPK;
STOPLOSS:=M*MA(H-L,N);
C<BKPRICE-STOPLOSS,SP(BKVOL);
C>SKPRICE+STOPLOSS,BP(SKVOL);
S_MA AND BKHIGH>BKPRICE+STOPLOSS,SP(BKVOL);
B_MA AND SKLOW<SKPRICE-STOPLOSS,BP(SKVOL);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.
/agenkit build a production-grade trading bot with a backtest engine, risk controls and paper trading by default from strategies/Relative-Strength-Strategy-Based-on-Price.md- npx agenkit install engineering-kit in your project
- Paste the command into your agent and approve each phase
- 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.