Strategy vault / Tools & templates
Share Notify When the ADX Value Reaches the Conditions
In order to give back to the FMZ platform and community, share strategies & codes & ideas & templates Introduction: Call the ADX indicator and send FMZ communication notifications when certain conditions are met Can…
In order to give back to the FMZ platform and community, share strategies & codes & ideas & templates
Introduction: Call the ADX indicator and send FMZ communication notifications when certain conditions are met Can sequentially poll multiple trading pairs
Welcome to cooperate and communicate, learn and progress together~ v:haiyanyydss
Parameters
| Name | Default | What it controls |
|---|---|---|
| P_interval_time | 1000 | Polling interval (milliseconds) |
| P_contract | quarter | contract |
| P_adx_len | 50 | ADXParameters |
| P_adx_val | 10 | WeChat notification trigger value (ADX greater than this value)) |
Source JavaScript
/*backtest
start: 2020-01-01 00:00:00
end: 2021-02-02 00:00:00
period: 1h
basePeriod: 1h
exchanges: [{"eid":"Futures_OKCoin","currency":"ETH_USD"},{"eid":"Futures_OKCoin","currency":"BTC_USD"}]
args: [["P_contract","quarter|quarter"],["P_contract_value","10|100"]]
*/
/*
In order to give back to the FMZ platform and community, share strategies & codes & ideas & templates
Introduction:
Call the ADX indicator and send FMZ communication notifications when certain conditions are met
Can sequentially poll multiple trading pairs
Welcome to cooperate and communicate, learn and progress together~
v:haiyanyydss
*/
function getPara(val, i){
val = ""+val;
var ret = val.split("|").length>i?val.split("|")[i]:val.split("|")[val.split("|").length-1];
return ret.trim();
}
function Trade(e){
this.e = e;
this.last_alert_time = 0;
this.ontick = function(){
var records = _C(this.e.GetRecords);
var last_record = records[records.length-1];
var adx = talib.ADX(records, this.adx_len);
if(this.last_alert_time < last_record.Time && adx[adx.length-1] > this.adx_val){
this.last_alert_time = last_record.Time;
Log(this.e.GetCurrency(), this.contract, "adxValue exceeds"+this.adx_val , new Date(), "@");
}
}
}
function main() {
LogReset();
var tradeArr = [];
for(var i in exchanges){
var trade = new Trade(exchanges[i]);
trade.adx_len = 1*getPara(P_adx_len, i);
trade.adx_val = 1*getPara(P_adx_val, i);
trade.contract = getPara(P_contract, i);
trade.e.SetContractType(trade.contract);
tradeArr.push(trade)
}
while (true) {
for(var i in tradeArr){
Sleep(P_interval_time);
tradeArr[i].ontick();
}
}
}
Published by 作手君TradeMan on the FMZ strategy square · last modified 2023-02-09. 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 tested, production-ready module from strategies/Share-Notify-When-the-ADX-Value-Reaches-the-Conditions.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.
Related specs
- Multi Indicator Configurable Strategy GeneratorPine Script · Tools & templates · 5m
- Indicator Library Python VersionPython · Tools & templates
- Dual Moving Average Monitoring ModelPine Script · Tools & templates · 1h
- Universal Strategy Backtest TemplatePine Script · Tools & templates · 1m
- Binance Account Cross Transfer Small ToolJavaScript · Tools & templates
- Get cryptocurrency current and max supplyJavaScript · Tools & templates