UNPKG

stock-indicator-mapper

Version:

A function given to map on an array of objects containing daily stock EOD data.

13 lines (10 loc) 316 B
import max from 'lodash/max'; function minusDMCalculation(currentHigh, previousHigh, currentLow, previousLow) { const highDiff = currentHigh - previousHigh; const lowDiff = previousLow - currentLow; if (lowDiff > highDiff) { return max([lowDiff, 0]); } return 0; } export default minusDMCalculation;