-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathrun.js
More file actions
28 lines (27 loc) · 723 Bytes
/
run.js
File metadata and controls
28 lines (27 loc) · 723 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
const Backtest = require('./lib');
const candles = require('./bitfinex_BTCUSD_15m.json');
const {ema200Strategy} = require('./strategies');
const drawChart = require('./src/util/drawChart');
const indicators = [
{name: 'rsi', period: 14},
{name: 'ema', period: 9},
{name: 'ema', period: 21},
{
name: 'stochasticrsi',
period: 14,
rsiPeriod: 14,
stochasticPeriod: 14,
kPeriod: 3,
dPeriod: 3,
},
// {name: 'adx', period: 14},
{name: 'bollingerbands', period: 14, stddev: 2},
];
const takeProfit = 0.05;
const stopLoss = 0.04;
const backtesting = new Backtest({
candles, strategy: ema200Strategy, indicators, takeProfit, stopLoss,
});
const result = backtesting.start();
drawChart(result);
process.exit();