technical-indicator

SuperTrend code using pandas python

你说的曾经没有我的故事 提交于 2019-12-22 17:57:57
问题 I am trying to code the following algorithm for SuperTrend indicator in python using pandas. BASIC UPPERBAND = (HIGH + LOW) / 2 + Multiplier * ATR BASIC LOWERBAND = (HIGH + LOW) / 2 - Multiplier * ATR FINAL UPPERBAND = IF( (Current BASICUPPERBAND < Previous FINAL UPPERBAND) or (Previous Close > Previous FINAL UPPERBAND)) THEN (Current BASIC UPPERBAND) ELSE Previous FINALUPPERBAND) FINAL LOWERBAND = IF( (Current BASIC LOWERBAND > Previous FINAL LOWERBAND) or (Previous Close < Previous FINAL

MACD Function Returning Incorrect Values

♀尐吖头ヾ 提交于 2019-12-17 19:24:00
问题 I am trying to use PHPs trader functions (available as a PECL extension) to calculate the moving average convergence/divergence (MACD) of various securities. However, the values returned do not seem to match my calculations. Consider the following array of close prices for a stock: $close = array ( 0 => 459.99, 1 => 448.85, 2 => 446.06, 3 => 450.81, 4 => 442.8, 5 => 448.97, 6 => 444.57, 7 => 441.4, 8 => 430.47, 9 => 420.05, 10 => 431.14, 11 => 425.66, 12 => 430.58, 13 => 431.72, 14 => 437.87,

Calculating weighted moving average using pandas Rolling method

半城伤御伤魂 提交于 2019-12-09 07:03:25
问题 I calculate simple moving average: def sma(data_frame, length=15): # TODO: Be sure about default values of length. smas = data_frame.Close.rolling(window=length, center=False).mean() return smas Using the rolling function is it possible to calculate weighted moving average? As I read in the documentation, I think that I have to pass win_type parameter. But I'm not sure which one I have to choose. Here is a definition for weighted moving average. Thanks in advance, 回答1: Yeah, that part of

SuperTrend code using pandas python

别说谁变了你拦得住时间么 提交于 2019-12-06 06:56:04
I am trying to code the following algorithm for SuperTrend indicator in python using pandas. BASIC UPPERBAND = (HIGH + LOW) / 2 + Multiplier * ATR BASIC LOWERBAND = (HIGH + LOW) / 2 - Multiplier * ATR FINAL UPPERBAND = IF( (Current BASICUPPERBAND < Previous FINAL UPPERBAND) or (Previous Close > Previous FINAL UPPERBAND)) THEN (Current BASIC UPPERBAND) ELSE Previous FINALUPPERBAND) FINAL LOWERBAND = IF( (Current BASIC LOWERBAND > Previous FINAL LOWERBAND) or (Previous Close < Previous FINAL LOWERBAND)) THEN (Current BASIC LOWERBAND) ELSE Previous FINAL LOWERBAND) SUPERTREND = IF((Previous

Calculating weighted moving average using pandas Rolling method

若如初见. 提交于 2019-12-03 08:44:55
I calculate simple moving average: def sma(data_frame, length=15): # TODO: Be sure about default values of length. smas = data_frame.Close.rolling(window=length, center=False).mean() return smas Using the rolling function is it possible to calculate weighted moving average? As I read in the documentation , I think that I have to pass win_type parameter. But I'm not sure which one I have to choose. Here is a definition for weighted moving average. Thanks in advance, Yeah, that part of pandas really isn't very well documented. I think you might have to use rolling.apply() if you aren't using one

quantstrat: how to create multiple indicators, signal rules

放肆的年华 提交于 2019-12-02 09:48:11
问题 I want to add multiple rules based on different signals like SMA50 > SMA10 and MACD > 0 . However, I am getting an error using sigComparision . Can anyone suggest a better way to do it? 回答1: There are two obvious approaches you could use: You can build a composite signal function in add rules, or you could use sigFormula . The latter is known to be slow. For example see this thread: https://stat.ethz.ch/pipermail/r-sig-finance/2012q1/009310.html I highlight a key section here: sigFormula uses

MACD Function Returning Incorrect Values

你离开我真会死。 提交于 2019-11-28 10:19:59
I am trying to use PHPs trader functions (available as a PECL extension) to calculate the moving average convergence/divergence (MACD) of various securities. However, the values returned do not seem to match my calculations. Consider the following array of close prices for a stock: $close = array ( 0 => 459.99, 1 => 448.85, 2 => 446.06, 3 => 450.81, 4 => 442.8, 5 => 448.97, 6 => 444.57, 7 => 441.4, 8 => 430.47, 9 => 420.05, 10 => 431.14, 11 => 425.66, 12 => 430.58, 13 => 431.72, 14 => 437.87, 15 => 428.43, 16 => 428.35, 17 => 432.5, 18 => 443.66, 19 => 455.72, 20 => 454.49, 21 => 452.08, 22 =>