MCPcopy Create free account
hub / github.com/ScottfreeLLC/AlphaPy / dminus

Function dminus

alphapy/transforms.py:304–331  ·  view source on GitHub ↗

r"""Calculate the Minus Directional Movement (-DM). Parameters ---------- f : pandas.DataFrame Dataframe with columns ``high`` and ``low``. Returns ------- new_column : pandas.Series (float) The array containing the new feature. References ---------

(f)

Source from the content-addressed store, hash-verified

302#
303
304def dminus(f):
305 r"""Calculate the Minus Directional Movement (-DM).
306
307 Parameters
308 ----------
309 f : pandas.DataFrame
310 Dataframe with columns ``high`` and ``low``.
311
312 Returns
313 -------
314 new_column : pandas.Series (float)
315 The array containing the new feature.
316
317 References
318 ----------
319 *Directional movement is negative (minus) when the prior low minus
320 the current low is greater than the current high minus the prior high.
321 This so-called Minus Directional Movement (-DM) equals the prior low
322 minus the current low, provided it is positive. A negative value
323 would simply be entered as zero* [SC_ADX]_.
324
325 """
326 c1 = 'downmove'
327 f[c1] = -net(f, 'low')
328 c2 = 'upmove'
329 f[c2] = net(f, 'high')
330 new_column = f.apply(gtval0, axis=1, args=[c1, c2])
331 return new_column
332
333
334#

Callers 1

diminusFunction · 0.85

Calls 1

netFunction · 0.85

Tested by

no test coverage detected