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

Commit

Permalink
Update strategy.js (#1646)
Browse files Browse the repository at this point in the history
* Update strategy.js

Added overbought parameters to trade with crypto assets directly (the original code works fine if starts with FIAT, but not with asset) and use red color to mark RSI with red (sell signal). Tested and works fine.

* Update strategy.js
  • Loading branch information
diegstroyer authored and DeviaVir committed Jul 5, 2018
1 parent 64c6361 commit 962efee
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions extensions/strategies/rsi/strategy.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ module.exports = {
s.rsi_high = s.period.rsi
}
}
if (s.trend !== 'overbought' && s.trend !== 'short' && s.period.rsi >= s.options.overbought_rsi) {
s.rsi_high = s.period.rsi
s.trend = 'long'
}
if (s.trend === 'long') {
s.rsi_high = Math.max(s.rsi_high, s.period.rsi)
if (s.period.rsi <= s.rsi_high / s.options.rsi_divisor) {
Expand Down Expand Up @@ -67,6 +71,9 @@ module.exports = {
if (s.period.rsi <= s.options.oversold_rsi) {
color = 'green'
}
if (s.period.rsi >= s.options.overbought_rsi) {
color = 'red'
}
cols.push(z(4, n(s.period.rsi).format('0'), ' ')[color])
}
return cols
Expand Down

0 comments on commit 962efee

Please sign in to comment.