Gekko 交易機器人 - TEMA 策略 (Triple EMA strategy),附帶有安全網機制 (SafetyNet) 來避免在熊市被套牢
這是一個以 EMA (指數移動平均) 決定做多做空的交易策略, 但當短期趨勢超過了 EMA 線則會在上方使用一個更長時間的 SMA (簡單移動平均) 作為整個交易系統的安全網 (SafetyNet) ,在短期的 SMA 超越這個安全網前會避免任何可能被套牢的交易。所以簡單理解的概念就是在市場看多的時候進行交易,而市場下跌時則避免摻入其中,但實際上的運作狀況仍然有待測試。 JS Code : /* TEMA Triple EMA strategy with 'safety net' --- Uses 1x TEMA to go long/short if short trend is over TEMA. On top of this it uses a longer SMA as a safety net and simple stays out of the market if short SMA is under that SMA. --- The general idea is to buy in good market conditions and simply not be a part of longer downwards trends. */ // req's var log = require ('../core/log.js'); var config = require ('../core/util.js').getConfig(); // strategy var strat = { /* INIT */ init: function() { // base this.name = 'TEMA'; this.requiredHistory = config.tradingAdvisor.historySize; this.debug = false; // outputs messages, set to false to increase performance // add indicators and reset trend this.resetTrend(); this.addTulipIndicator...