Skip to content
This repository has been archived by the owner on Feb 15, 2022. It is now read-only.

Merged DEMA Strategies #1067

Merged
merged 3 commits into from
Jan 7, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 1 addition & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -325,20 +325,7 @@ dema
--down_trend_threshold=<value> threshold to trigger a sold signal (default: 0)
--overbought_rsi_periods=<value> number of periods for overbought RSI (default: 9)
--overbought_rsi=<value> sold when RSI exceeds this value (default: 80)
--noise_level_pct=<value> do not trade when short ema is with this % of last short ema (default: 2)

dema
description:
Buy when (short ema > long ema) and sell when (short ema < long ema).
options:
--period=<value> period length (default: 1h)
--min_periods=<value> min. number of history periods (default: 21)
--ema_short_period=<value> number of periods for the shorter EMA (default: 10)
--ema_long_period=<value> number of periods for the longer EMA (default: 21)
--up_trend_threshold=<value> threshold to trigger a buy signal (default: 0)
--down_trend_threshold=<value> threshold to trigger a sold signal (default: 0)
--overbought_rsi_periods=<value> number of periods for overbought RSI (default: 9)
--overbought_rsi=<value> sold when RSI exceeds this value (default: 80)
--noise_level_pct=<value> do not trade when short ema is with this % of last short ema, 0 disables this feature (default: 0)

forex_analytics
description:
Expand Down
6 changes: 0 additions & 6 deletions extensions/strategies/dema-lessnoise/_codemap.js

This file was deleted.

83 changes: 0 additions & 83 deletions extensions/strategies/dema-lessnoise/strategy.js

This file was deleted.

5 changes: 4 additions & 1 deletion extensions/strategies/dema/strategy.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ module.exports = function container (get, set, clear) {
this.option('down_trend_threshold', 'threshold to trigger a sold signal', Number, 0)
this.option('overbought_rsi_periods', 'number of periods for overbought RSI', Number, 9)
this.option('overbought_rsi', 'sold when RSI exceeds this value', Number, 80)
this.option('noise_level_pct', 'do not trade when short ema is with this % of last short ema', Number, 0)
},

calculate: function (s) {
Expand Down Expand Up @@ -47,7 +48,9 @@ module.exports = function container (get, set, clear) {
}

if (typeof s.period.dema_histogram === 'number' && typeof s.lookback[0].dema_histogram === 'number') {
if ((s.period.dema_histogram - s.options.up_trend_threshold) > 0 && (s.lookback[0].dema_histogram - s.options.up_trend_threshold) <= 0) {
if (s.options.noise_level_pct != 0 && (s.period.ema_short / s.lookback[0].ema_short * 100 < s.options.noise_level_pct)) {
s.signal = 'null';
} else if ((s.period.dema_histogram - s.options.up_trend_threshold) > 0 && (s.lookback[0].dema_histogram - s.options.up_trend_threshold) <= 0) {
s.signal = 'buy';
} else if ((s.period.dema_histogram + s.options.down_trend_threshold) < 0 && (s.lookback[0].dema_histogram + s.options.down_trend_threshold) >= 0) {
s.signal = 'sell';
Expand Down