trading-indicator
trading-indicator copied to clipboard
sma.js & ema.js vwap function usage & wrong variable definition
const vwapCrossSMA = async (period, input) => { let vwap = await vwap(input) let maVal = await sma(parseInt(period), 'close', input), price = vwapval.slice(-2), up = crossover(price, maVal), down = crossunder(price, maVal) return { cross: up || down, direction: up ? 'up' : down ? 'down' : 'none', } }
let vwap usage is preventing vwap function to call. That's why it is causing error. After i change the let vwap variable as let vwapVal it is worked. sma.js & ema.js have the same error and needs to be updated.
You can see the files here.
For ema.js this line is also missing. const { vwap } = require('../indicators/vwap.js')