1
Follow
2
Followers
Esta é uma função ATR de código aberto, escrita pelo chefe do grupo, e eu peço a todos os ministros de energia que escrevam uma versão do PANDAS, sem usar a função TALIB.
def ATR(records, period=14):
if len(records) == 0:
return []
if 'Close' not in records[0]:
raise "TA.ATR argument must KLine"
R = Std._zeros(len(records))
m = 0.0
n = 0.0
for i in xrange(0, len(records)):
TR = 0
if i == 0:
TR = records[i]['High'] - records[i]['Low']
else:
TR = max(records[i]['High'] - records[i]['Low'], abs(records[i]['High'] - records[i - 1]['Close']), abs(records[i - 1]['Close'] - records[i]['Low']))
m += TR
if i < period:
n = m / (i + 1)
else:
n = (((period - 1) * n) + TR) / period
R[i] = n
return R
Related Recommendations
How to Specify Different Versions of Data for the Rented Strategy by Its Rental Code MetadataAdvanced Tutorial for FMZ Quant platform Strategy WritingElementary Tutorial for FMZ Quant platform Strategy WritingGet Started with FMZ Quant PlatformSECURITY BUGI keep getting error: Exchange_GetAccount: Invalid ContractTypeWe have an incredibly profitable market making algorithm for sideways markets on Bitmex - but need expert to help eliminate wait times during downward volatility in the marketError with deribitLimitations of the backtesting engineHow to install ta-lib on linux docker?
Comment
All comments (1)
- 1
