05-02-2018, 03:02 PM
Hi
If this is the whole code then it could not work
The strat needs some basics:
but thats not everything
You need also to initialize some var (like drivers added in the beginnig of the strat:
The full BASSic tulip RSI strat:
and the settings file:
You can erase and copie/paste your code to it.
If you dont know about how to use these examples please watch my tutorials,
about how to build a strat:
TUT #1 RSI
If this is the whole code then it could not work
The strat needs some basics:
Code:
var method = {};
method.init = function()
{
}
method.update = function(candle) {
}
method.log = function() {
}
method.check = function(candle)
{
}
module.exports = method;
You need also to initialize some var (like drivers added in the beginnig of the strat:
Code:
var _ = require('lodash');
var log = require('../core/log.js');
var config = require ('../core/util.js').getConfig();
The full BASSic tulip RSI strat:
Code:
/*
BASSic tulip_RSI
*/
var _ = require('lodash');
var log = require('../core/log.js');
var config = require('../core/util.js').getConfig();
var strat = {};
strat.init = function () {
//add candle.close
price =
{
close: 0//this.candle
};
this.price = price;
logic =
{
longpos: false
};
this.logic = logic;
//first fetch settings from .toml
var customRSIsettings = this.settings.RSI;
// define the indicators we need //move the settings into >>>rsi input length
this.addTulipIndicator('myrsi', 'rsi', customRSIsettings);
}
strat.update = function (candle) {
}
strat.log = function () {
}
strat.check = function (candle) {
//update price.close
this.price.close = this.candle.close;
//update the indicator before using it
var resultRSI = this.tulipIndicators.myrsi.result.result;
//lets trade...
if (resultRSI > this.settings.trsRSI.high && this.logic.longpos !== false) {
this.logic.longpos = false;
this.advice('short');
log.debug('goShort price ' + this.price.close + ' rsi ' + resultRSI.toFixed(2));
}
else if (resultRSI < this.settings.trsRSI.low && this.logic.longpos !== true) {
this.logic.longpos = true;
this.advice('long');
log.debug('goLong price ' + this.price.close + ' rsi ' + resultRSI.toFixed(2));
}
}
module.exports = strat;
Code:
[RSI]
optInTimePeriod = 15
[trsRSI]
high = 71
low = 28
#_try_1min_candles_#
#_binance_BTC_USDT_#
You can erase and copie/paste your code to it.
If you dont know about how to use these examples please watch my tutorials,
about how to build a strat:
TUT #1 RSI