ta_lib_ffi 0.2.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +35 -3
- data/README.md +51 -56
- data/Rakefile +13 -0
- data/lib/ta_lib_ffi/doc.rb +138 -0
- data/lib/ta_lib_ffi/version.rb +5 -0
- data/lib/ta_lib_ffi.rb +2396 -248
- data/ta_lib_ffi.gemspec +9 -6
- metadata +52 -11
data/lib/ta_lib_ffi.rb
CHANGED
|
@@ -2,13 +2,27 @@
|
|
|
2
2
|
|
|
3
3
|
require "fiddle"
|
|
4
4
|
require "fiddle/import"
|
|
5
|
+
require "rubygems/version"
|
|
6
|
+
require_relative "ta_lib_ffi/version"
|
|
5
7
|
|
|
6
8
|
# Ruby FFI wrapper for TA-Lib (Technical Analysis Library)
|
|
9
|
+
#
|
|
10
|
+
# This module provides a Ruby interface to the TA-Lib technical analysis library
|
|
11
|
+
# using FFI (Foreign Function Interface). It allows you to perform various
|
|
12
|
+
# technical analysis calculations on financial market data.
|
|
13
|
+
#
|
|
14
|
+
# @example Basic usage
|
|
15
|
+
# require 'ta_lib_ffi'
|
|
16
|
+
#
|
|
17
|
+
# # Calculate Simple Moving Average
|
|
18
|
+
# prices = [10.0, 11.0, 12.0, 11.0, 10.0]
|
|
19
|
+
# result = TALibFFI.sma(prices, time_period: 3)
|
|
20
|
+
#
|
|
21
|
+
# @see https://ta-lib.org/ TA-Lib Official Website
|
|
7
22
|
module TALibFFI
|
|
8
|
-
VERSION = "0.2.0"
|
|
9
|
-
|
|
10
23
|
if defined?(Zeitwerk)
|
|
11
|
-
#
|
|
24
|
+
# https://github.com/fxn/zeitwerk?tab=readme-ov-file#custom-inflector
|
|
25
|
+
# @!visibility private
|
|
12
26
|
class Inflector < Zeitwerk::GemInflector
|
|
13
27
|
def camelize(basename, _abspath)
|
|
14
28
|
case basename
|
|
@@ -23,17 +37,14 @@ module TALibFFI
|
|
|
23
37
|
|
|
24
38
|
extend Fiddle::Importer
|
|
25
39
|
|
|
26
|
-
lib_path =
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
else
|
|
35
|
-
raise "Unsupported platform"
|
|
36
|
-
end
|
|
40
|
+
lib_path = ENV.fetch("TA_LIB_PATH") do
|
|
41
|
+
case RUBY_PLATFORM
|
|
42
|
+
when /darwin/ then "#{`brew --prefix`.chomp}/lib/libta-lib.dylib"
|
|
43
|
+
when /linux/ then "libta-lib.so"
|
|
44
|
+
when /cygwin|mswin|mingw|bccwin|wince|emx/ then "C:/Program Files/TA-Lib/bin/ta-lib.dll"
|
|
45
|
+
else raise "Unsupported platform: #{RUBY_PLATFORM}"
|
|
46
|
+
end
|
|
47
|
+
end
|
|
37
48
|
|
|
38
49
|
dlload lib_path
|
|
39
50
|
|
|
@@ -59,16 +70,6 @@ module TALibFFI
|
|
|
59
70
|
TA_INTERNAL_ERROR = 5000
|
|
60
71
|
TA_UNKNOWN_ERR = 0xFFFF
|
|
61
72
|
|
|
62
|
-
# {0,"SMA"},
|
|
63
|
-
# {1,"EMA"},
|
|
64
|
-
# {2,"WMA"},
|
|
65
|
-
# {3,"DEMA" },
|
|
66
|
-
# {4,"TEMA" },
|
|
67
|
-
# {5,"TRIMA"},
|
|
68
|
-
# {6,"KAMA" },
|
|
69
|
-
# {7,"MAMA" },
|
|
70
|
-
# {8,"T3"}
|
|
71
|
-
|
|
72
73
|
typealias "TA_Real", "double"
|
|
73
74
|
typealias "TA_Integer", "int"
|
|
74
75
|
typealias "TA_RetCode", "int"
|
|
@@ -88,11 +89,19 @@ module TALibFFI
|
|
|
88
89
|
"void *hiddenData"
|
|
89
90
|
]
|
|
90
91
|
|
|
92
|
+
# TA-Lib 0.8.1 removed camelCaseName. Older Windows DLLs can omit
|
|
93
|
+
# TA_GetVersionString entirely and use the original struct layout.
|
|
94
|
+
version_export = handler.sym("TA_GetVersionString")
|
|
95
|
+
if version_export
|
|
96
|
+
version_string = Fiddle::Function.new(version_export, [], Fiddle::TYPE_VOIDP).call.to_s
|
|
97
|
+
native_version = Gem::Version.new(version_string.split.first)
|
|
98
|
+
end
|
|
99
|
+
legacy_func_info = !native_version || native_version < Gem::Version.new("0.8.1")
|
|
91
100
|
TA_FuncInfo = struct [
|
|
92
101
|
"const char *name",
|
|
93
102
|
"const char *group",
|
|
94
103
|
"const char *hint",
|
|
95
|
-
"const char *camelCaseName",
|
|
104
|
+
*(["const char *camelCaseName"] if legacy_func_info),
|
|
96
105
|
"TA_FuncFlags flags",
|
|
97
106
|
"unsigned int nbInput",
|
|
98
107
|
"unsigned int nbOptInput",
|
|
@@ -139,6 +148,13 @@ module TALibFFI
|
|
|
139
148
|
TA_Output_Integer: 1
|
|
140
149
|
}.freeze
|
|
141
150
|
|
|
151
|
+
PRICE_FIELDS = %w[open high low close volume open_interest].freeze
|
|
152
|
+
OUTPUT_LAYOUTS = {
|
|
153
|
+
TA_PARAM_TYPE[:TA_Output_Real] => ["d", Fiddle::SIZEOF_DOUBLE, :TA_SetOutputParamRealPtr].freeze,
|
|
154
|
+
TA_PARAM_TYPE[:TA_Output_Integer] => ["i!", Fiddle::SIZEOF_INT, :TA_SetOutputParamIntegerPtr].freeze
|
|
155
|
+
}.freeze
|
|
156
|
+
private_constant :PRICE_FIELDS, :OUTPUT_LAYOUTS
|
|
157
|
+
|
|
142
158
|
TA_FLAGS = {
|
|
143
159
|
TA_InputFlags: {
|
|
144
160
|
TA_IN_PRICE_OPEN: 0x00000001,
|
|
@@ -168,7 +184,10 @@ module TALibFFI
|
|
|
168
184
|
TA_OUT_NEGATIVE: 0x00000200,
|
|
169
185
|
TA_OUT_ZERO: 0x00000400,
|
|
170
186
|
TA_OUT_UPPER_LIMIT: 0x00000800,
|
|
171
|
-
TA_OUT_LOWER_LIMIT: 0x00001000
|
|
187
|
+
TA_OUT_LOWER_LIMIT: 0x00001000,
|
|
188
|
+
TA_OUT_NULLABLE: 0x00002000,
|
|
189
|
+
TA_OUT_DISPLAY_SHIFT: 0x00004000,
|
|
190
|
+
TA_OUT_PATTERN_WEAK: 0x00008000
|
|
172
191
|
}
|
|
173
192
|
}.freeze
|
|
174
193
|
|
|
@@ -178,7 +197,7 @@ module TALibFFI
|
|
|
178
197
|
extern "int TA_GroupTableFree(TA_StringTable*)"
|
|
179
198
|
extern "TA_RetCode TA_FuncTableAlloc(const char *group, TA_StringTable **table)"
|
|
180
199
|
extern "TA_RetCode TA_FuncTableFree(TA_StringTable *table)"
|
|
181
|
-
extern "
|
|
200
|
+
extern "TA_RetCode TA_GetFuncHandle(const char *name, const TA_FuncHandle **handle)"
|
|
182
201
|
extern "TA_RetCode TA_GetFuncInfo(const TA_FuncHandle *handle, const TA_FuncInfo **funcInfo)"
|
|
183
202
|
extern "TA_RetCode TA_ForEachFunc(TA_CallForEachFunc functionToCall, void *opaqueData)"
|
|
184
203
|
extern "TA_RetCode TA_GetInputParameterInfo(const TA_FuncHandle *handle, unsigned int paramIndex, const TA_InputParameterInfo **info)"
|
|
@@ -210,51 +229,66 @@ module TALibFFI
|
|
|
210
229
|
|
|
211
230
|
module_function
|
|
212
231
|
|
|
232
|
+
# Extracts flags from a bitmask value based on the flag type
|
|
233
|
+
#
|
|
234
|
+
# @param value [Integer] The bitmask value to extract flags from
|
|
235
|
+
# @param type [Symbol] The type of flags to extract (:TA_InputFlags, :TA_OptInputFlags, or :TA_OutputFlags)
|
|
236
|
+
# @return [Array<Symbol>] Array of flag names that are set in the bitmask
|
|
213
237
|
def extract_flags(value, type)
|
|
214
|
-
|
|
215
|
-
TA_FLAGS[type].each do |k, v|
|
|
216
|
-
flags_set << k if (value & v) != 0
|
|
217
|
-
end
|
|
218
|
-
flags_set
|
|
238
|
+
TA_FLAGS.fetch(type).filter_map { |name, bit| name if (value & bit) != 0 }
|
|
219
239
|
end
|
|
220
240
|
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
group_names = Fiddle::Pointer.new(string_table["string"])[0, Fiddle::SIZEOF_VOIDP * string_table["size"]].unpack("Q*").collect { |ptr| Fiddle::Pointer.new(ptr).to_s }
|
|
228
|
-
TA_GroupTableFree(string_table_ptr)
|
|
229
|
-
|
|
230
|
-
group_names
|
|
241
|
+
# The caller owns only the pointer-sized output slot. TA-Lib determines the
|
|
242
|
+
# lifetime of the address written into it (static metadata, a table or a holder).
|
|
243
|
+
def native_pointer
|
|
244
|
+
slot = [0].pack("J")
|
|
245
|
+
check_ta_return_code(yield(slot))
|
|
246
|
+
Fiddle::Pointer.new(slot.unpack1("J"))
|
|
231
247
|
end
|
|
248
|
+
private_class_method :native_pointer
|
|
232
249
|
|
|
233
|
-
def
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
check_ta_return_code(ret_code)
|
|
250
|
+
def string_table_names(pointer)
|
|
251
|
+
table = TA_StringTable.new(pointer)
|
|
252
|
+
return [] if table["size"].zero?
|
|
237
253
|
|
|
238
|
-
|
|
239
|
-
|
|
254
|
+
table["string"].to_s(table["size"] * Fiddle::SIZEOF_VOIDP).unpack("J*").map { |address| Fiddle::Pointer.new(address).to_s }
|
|
255
|
+
end
|
|
256
|
+
private_class_method :string_table_names
|
|
240
257
|
|
|
241
|
-
|
|
258
|
+
# Returns a list of all available function groups in TA-Lib
|
|
259
|
+
#
|
|
260
|
+
# @return [Array<String>] Array of group names
|
|
261
|
+
def group_table
|
|
262
|
+
table = native_pointer { |slot| TA_GroupTableAlloc(slot) }
|
|
263
|
+
string_table_names(table)
|
|
264
|
+
ensure
|
|
265
|
+
TA_GroupTableFree(table) if table
|
|
266
|
+
end
|
|
242
267
|
|
|
243
|
-
|
|
268
|
+
# Returns a list of all functions in a specific group
|
|
269
|
+
#
|
|
270
|
+
# @param group [String] The name of the group to get functions for
|
|
271
|
+
# @return [Array<String>] Array of function names in the group
|
|
272
|
+
def function_table(group)
|
|
273
|
+
table = native_pointer { |slot| TA_FuncTableAlloc(group, slot) }
|
|
274
|
+
string_table_names(table)
|
|
275
|
+
ensure
|
|
276
|
+
TA_FuncTableFree(table) if table
|
|
244
277
|
end
|
|
245
278
|
|
|
279
|
+
# Gets detailed information about a specific TA-Lib function
|
|
280
|
+
#
|
|
281
|
+
# @param name [String] The name of the function to get information for
|
|
282
|
+
# @return [Fiddle::CStructEntity] Struct containing function information
|
|
246
283
|
def function_info(name)
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
check_ta_return_code(ret_code)
|
|
250
|
-
|
|
251
|
-
info_ptr = Fiddle::Pointer.malloc(Fiddle::SIZEOF_VOIDP)
|
|
252
|
-
ret_code = TA_GetFuncInfo(handle_ptr, info_ptr.ref)
|
|
253
|
-
check_ta_return_code(ret_code)
|
|
254
|
-
|
|
255
|
-
TA_FuncInfo.new(info_ptr)
|
|
284
|
+
handle = get_function_handle(name)
|
|
285
|
+
TA_FuncInfo.new(native_pointer { |slot| TA_GetFuncInfo(handle, slot) })
|
|
256
286
|
end
|
|
257
287
|
|
|
288
|
+
# Iterates over all available TA-Lib functions
|
|
289
|
+
#
|
|
290
|
+
# @yield [func_info] Yields function information for each function
|
|
291
|
+
# @yieldparam func_info [Fiddle::CStructEntity] Function information struct
|
|
258
292
|
def each_function(&block)
|
|
259
293
|
callback = Fiddle::Closure::BlockCaller.new(
|
|
260
294
|
Fiddle::TYPE_VOID,
|
|
@@ -268,13 +302,14 @@ module TALibFFI
|
|
|
268
302
|
check_ta_return_code(ret_code)
|
|
269
303
|
end
|
|
270
304
|
|
|
271
|
-
#
|
|
272
|
-
#
|
|
273
|
-
|
|
305
|
+
# Prints detailed information about a TA-Lib function
|
|
306
|
+
#
|
|
307
|
+
# @param func_info [Fiddle::CStructEntity] Function information struct to print
|
|
308
|
+
def print_function_info(func_info) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
|
|
274
309
|
puts "Function Name: #{func_info["name"]}"
|
|
275
310
|
puts "Function Group: #{func_info["group"]}"
|
|
276
311
|
puts "Function Hint: #{func_info["hint"]}"
|
|
277
|
-
puts "Camel Case Name: #{func_info["camelCaseName"]}"
|
|
312
|
+
puts "Camel Case Name: #{func_info["camelCaseName"]}" if TA_FuncInfo.members.include?("camelCaseName")
|
|
278
313
|
puts "Flags: #{func_info["flags"]}"
|
|
279
314
|
puts "Number of Inputs: #{func_info["nbInput"]}"
|
|
280
315
|
puts "Number of Optional Inputs: #{func_info["nbOptInput"]}"
|
|
@@ -282,11 +317,7 @@ module TALibFFI
|
|
|
282
317
|
puts "Function Handle: #{func_info["handle"].to_i}"
|
|
283
318
|
|
|
284
319
|
puts "\nInput Parameter Info:"
|
|
285
|
-
func_info
|
|
286
|
-
param_info_ptr = Fiddle::Pointer.malloc(Fiddle::SIZEOF_VOIDP)
|
|
287
|
-
ret_code = TA_GetInputParameterInfo(func_info["handle"], i, param_info_ptr.ref)
|
|
288
|
-
check_ta_return_code(ret_code)
|
|
289
|
-
param_info = TA_InputParameterInfo.new(param_info_ptr)
|
|
320
|
+
collect_input_info(func_info).each_with_index do |param_info, i|
|
|
290
321
|
puts " Parameter #{i + 1}:"
|
|
291
322
|
puts " Name: #{param_info["paramName"]}"
|
|
292
323
|
puts " Type: #{param_info["type"]}"
|
|
@@ -294,11 +325,7 @@ module TALibFFI
|
|
|
294
325
|
end
|
|
295
326
|
|
|
296
327
|
puts "\nOptional Input Parameter Info:"
|
|
297
|
-
func_info
|
|
298
|
-
param_info_ptr = Fiddle::Pointer.malloc(Fiddle::SIZEOF_VOIDP)
|
|
299
|
-
ret_code = TA_GetOptInputParameterInfo(func_info["handle"], i, param_info_ptr.ref)
|
|
300
|
-
check_ta_return_code(ret_code)
|
|
301
|
-
param_info = TA_OptInputParameterInfo.new(param_info_ptr)
|
|
328
|
+
collect_opt_input_info(func_info).each_with_index do |param_info, i|
|
|
302
329
|
puts " Parameter #{i + 1}:"
|
|
303
330
|
puts " Name: #{param_info["paramName"]}"
|
|
304
331
|
puts " Type: #{param_info["type"]}"
|
|
@@ -309,127 +336,209 @@ module TALibFFI
|
|
|
309
336
|
end
|
|
310
337
|
|
|
311
338
|
puts "\nOutput Parameter Info:"
|
|
312
|
-
func_info
|
|
313
|
-
param_info_ptr = Fiddle::Pointer.malloc(Fiddle::SIZEOF_VOIDP)
|
|
314
|
-
ret_code = TA_GetOutputParameterInfo(func_info["handle"], i, param_info_ptr.ref)
|
|
315
|
-
check_ta_return_code(ret_code)
|
|
316
|
-
param_info = TA_OutputParameterInfo.new(param_info_ptr)
|
|
339
|
+
collect_output_info(func_info).each_with_index do |param_info, i|
|
|
317
340
|
puts " Parameter #{i + 1}:"
|
|
318
341
|
puts " Name: #{param_info["paramName"]}"
|
|
319
342
|
puts " Type: #{param_info["type"]}"
|
|
320
343
|
puts " Flags: #{extract_flags(param_info["flags"], :TA_OutputFlags)}"
|
|
321
344
|
end
|
|
322
345
|
end
|
|
323
|
-
# rubocop:enable Metrics/MethodLength
|
|
324
|
-
# rubocop:enable Metrics/AbcSize
|
|
325
346
|
|
|
326
|
-
#
|
|
347
|
+
# Calls a TA-Lib function with the given arguments
|
|
348
|
+
#
|
|
349
|
+
# @param func_name [String] The name of the function to call
|
|
350
|
+
# @param args [Array] Array of input arrays and optional parameters
|
|
351
|
+
# @return [Array, Hash] Function results (single array or hash of named outputs)
|
|
352
|
+
# @raise [TALibError] If there is an error in function execution
|
|
327
353
|
def call_func(func_name, args)
|
|
328
|
-
|
|
329
|
-
|
|
354
|
+
info = function_info_map.fetch(func_name) { raise TALibError, "Unknown TA-Lib function #{func_name.inspect}" }
|
|
355
|
+
inputs, options = args.last.is_a?(Hash) ? [args[0...-1], args.last] : [args, {}]
|
|
356
|
+
size = validate_inputs!(inputs, func_name)
|
|
357
|
+
validate_options!(func_name, options, info[:keywords])
|
|
358
|
+
run_indicator(info[:handle], func_name, inputs, options, size)
|
|
359
|
+
end
|
|
330
360
|
|
|
331
|
-
|
|
361
|
+
def run_indicator(handle, name, inputs, options, size)
|
|
362
|
+
params = create_parameter_holder(handle)
|
|
363
|
+
setup_input_parameters(params, inputs, name, size: size)
|
|
364
|
+
setup_optional_parameters(params, options, name)
|
|
365
|
+
calculate_results(params, inputs, name, input_size: size)
|
|
366
|
+
rescue TALibError, TypeError, RangeError => e
|
|
367
|
+
arguments = options.map { |key, value| "#{key}=#{value.inspect}" }.join(", ")
|
|
368
|
+
raise TALibError, "#{name}(#{arguments}): #{e.message}"
|
|
369
|
+
ensure
|
|
370
|
+
TA_ParamHolderFree(params) if params
|
|
371
|
+
end
|
|
372
|
+
private_class_method :run_indicator
|
|
332
373
|
|
|
333
|
-
|
|
334
|
-
|
|
374
|
+
# Calculates the lookback period for a function with given parameters
|
|
375
|
+
#
|
|
376
|
+
# @param params_ptr [Fiddle::Pointer] Pointer to parameter holder
|
|
377
|
+
# @return [Integer] The lookback period
|
|
378
|
+
def calculate_lookback(params_ptr)
|
|
379
|
+
lookback = [0].pack("i!")
|
|
380
|
+
check_ta_return_code(TA_GetLookback(params_ptr, lookback))
|
|
381
|
+
lookback.unpack1("i!")
|
|
382
|
+
end
|
|
335
383
|
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
384
|
+
# Validates input arrays for TA-Lib functions
|
|
385
|
+
#
|
|
386
|
+
# @param arrays [Array<Array>] Arrays to validate
|
|
387
|
+
# @raise [TALibError] If any array is invalid
|
|
388
|
+
def validate_inputs!(arrays, func_name = nil)
|
|
389
|
+
series = if func_name
|
|
390
|
+
input_series(func_name, arrays)
|
|
391
|
+
else
|
|
392
|
+
arrays.flat_map { |arg| arg.is_a?(Array) && arg.first.is_a?(Array) ? arg : [arg] }
|
|
393
|
+
end
|
|
394
|
+
series_length!(series, func_name)
|
|
344
395
|
end
|
|
345
|
-
# rubocop:enable Metrics/MethodLength
|
|
346
396
|
|
|
347
|
-
def
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
397
|
+
def series_length!(series, func_name)
|
|
398
|
+
raise TALibError, "Expected input arrays" unless series.all?(Array)
|
|
399
|
+
|
|
400
|
+
lengths = series.map(&:length).uniq
|
|
401
|
+
raise TALibError, "Input arrays cannot be empty" unless lengths.fetch(0, 0).positive?
|
|
402
|
+
raise TALibError, "#{func_name} input series must have equal lengths (got #{lengths.join(", ")})" unless lengths.one?
|
|
403
|
+
raise TALibError, "Input arrays must contain only numbers" unless series.all? { |values| values.all?(Numeric) }
|
|
404
|
+
|
|
405
|
+
lengths.first
|
|
352
406
|
end
|
|
407
|
+
private_class_method :series_length!
|
|
353
408
|
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
409
|
+
def input_series(name, args)
|
|
410
|
+
layout = function_info_map.fetch(name)[:input_names]
|
|
411
|
+
input_shape_error!(name, layout) unless layout.size == args.size
|
|
412
|
+
args.zip(layout).flat_map do |arg, fields|
|
|
413
|
+
next [arg] unless fields.is_a?(Array)
|
|
358
414
|
|
|
359
|
-
|
|
360
|
-
|
|
415
|
+
input_shape_error!(name, layout) unless arg.is_a?(Array) && arg.size == fields.size && arg.all?(Array)
|
|
416
|
+
arg
|
|
361
417
|
end
|
|
418
|
+
end
|
|
419
|
+
private_class_method :input_series
|
|
362
420
|
|
|
363
|
-
|
|
364
|
-
|
|
421
|
+
def input_shape_error!(name, layout)
|
|
422
|
+
args = layout.map { |input| input.is_a?(Array) ? "[#{input.join(", ")}]" : input }
|
|
423
|
+
raise TALibError, "Expected TALibFFI.#{name.downcase}(#{args.join(", ")}) with optional parameters passed by keyword"
|
|
424
|
+
end
|
|
425
|
+
private_class_method :input_shape_error!
|
|
365
426
|
|
|
366
|
-
|
|
367
|
-
|
|
427
|
+
def validate_options!(name, options, keywords)
|
|
428
|
+
options.each do |key, value|
|
|
429
|
+
unless keywords.key?(key)
|
|
430
|
+
allowed = keywords.empty? ? "no keywords accepted" : "available keywords: #{keywords.keys.join(", ")}"
|
|
431
|
+
raise TALibError, "#{name} unknown keyword #{key.inspect} (#{allowed})"
|
|
432
|
+
end
|
|
433
|
+
raise TALibError, "#{name} keyword #{key.inspect} requires a number" unless value.is_a?(Numeric)
|
|
368
434
|
end
|
|
369
435
|
end
|
|
370
|
-
|
|
371
|
-
# rubocop:enable Metrics/PerceivedComplexity
|
|
436
|
+
private_class_method :validate_options!
|
|
372
437
|
|
|
438
|
+
# Gets a function handle for a given function name
|
|
439
|
+
#
|
|
440
|
+
# @param func_name [String] The name of the function
|
|
441
|
+
# @return [Fiddle::Pointer] Pointer to function handle
|
|
373
442
|
def get_function_handle(func_name)
|
|
374
|
-
|
|
375
|
-
ret_code = TA_GetFuncHandle(func_name, handle_ptr.ref)
|
|
376
|
-
check_ta_return_code(ret_code)
|
|
377
|
-
handle_ptr
|
|
443
|
+
native_pointer { |slot| TA_GetFuncHandle(func_name, slot) }
|
|
378
444
|
end
|
|
379
445
|
|
|
446
|
+
# Creates a parameter holder for a function
|
|
447
|
+
#
|
|
448
|
+
# @param handle_ptr [Fiddle::Pointer] Function handle pointer
|
|
449
|
+
# @return [Fiddle::Pointer] Pointer to parameter holder
|
|
380
450
|
def create_parameter_holder(handle_ptr)
|
|
381
|
-
|
|
382
|
-
ret_code = TA_ParamHolderAlloc(handle_ptr, params_ptr.ref)
|
|
383
|
-
check_ta_return_code(ret_code)
|
|
384
|
-
params_ptr
|
|
451
|
+
native_pointer { |slot| TA_ParamHolderAlloc(handle_ptr, slot) }
|
|
385
452
|
end
|
|
386
453
|
|
|
387
|
-
|
|
454
|
+
# Sets up input parameters for a function call
|
|
455
|
+
#
|
|
456
|
+
# @param params_ptr [Fiddle::Pointer] Parameter holder pointer
|
|
457
|
+
# @param input_arrays [Array<Array>] Input data arrays
|
|
458
|
+
# @param func_name [String] Function name
|
|
459
|
+
def setup_input_parameters(params_ptr, input_arrays, func_name, size: nil)
|
|
388
460
|
func_info = function_info_map[func_name]
|
|
389
461
|
input_arrays.each_with_index do |array, index|
|
|
390
462
|
input_info = func_info[:inputs][index]
|
|
391
|
-
ret_code = set_input_parameter(params_ptr, index, array, input_info)
|
|
463
|
+
ret_code = set_input_parameter(params_ptr, index, array, input_info, size: size)
|
|
392
464
|
check_ta_return_code(ret_code)
|
|
393
465
|
end
|
|
394
466
|
end
|
|
395
467
|
|
|
396
|
-
|
|
468
|
+
# Sets a single input parameter
|
|
469
|
+
#
|
|
470
|
+
# @param params_ptr [Fiddle::Pointer] Parameter holder pointer
|
|
471
|
+
# @param index [Integer] Parameter index
|
|
472
|
+
# @param array [Array] Input data array
|
|
473
|
+
# @param input_info [Hash] Input parameter information
|
|
474
|
+
# @return [Integer] TA-Lib return code
|
|
475
|
+
def set_input_parameter(params_ptr, index, array, input_info, size: nil)
|
|
397
476
|
case input_info["type"]
|
|
398
477
|
when TA_PARAM_TYPE[:TA_Input_Real]
|
|
399
|
-
|
|
400
|
-
TA_SetInputParamRealPtr(params_ptr, index, input_ptr)
|
|
478
|
+
bind_input(params_ptr, index, prepare_double_array(array, size: size)) { |ptr| TA_SetInputParamRealPtr(params_ptr, index, ptr) }
|
|
401
479
|
when TA_PARAM_TYPE[:TA_Input_Integer]
|
|
402
|
-
|
|
403
|
-
TA_SetInputParamIntegerPtr(params_ptr, index, input_ptr)
|
|
480
|
+
bind_input(params_ptr, index, prepare_integer_array(array, size: size)) { |ptr| TA_SetInputParamIntegerPtr(params_ptr, index, ptr) }
|
|
404
481
|
when TA_PARAM_TYPE[:TA_Input_Price]
|
|
405
|
-
setup_price_inputs(params_ptr, index, array, input_info["flags"])
|
|
482
|
+
setup_price_inputs(params_ptr, index, array, input_info["flags"], size: size)
|
|
406
483
|
end
|
|
407
484
|
end
|
|
408
485
|
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
486
|
+
# TA-Lib borrows these pointers until TA_CallFunc returns. Keep the pointers
|
|
487
|
+
# (and the packed Ruby strings they pin) alive on this particular holder.
|
|
488
|
+
def bind_input(holder, index, buffer)
|
|
489
|
+
status = yield(buffer)
|
|
490
|
+
if status == TA_SUCCESS
|
|
491
|
+
inputs = holder.instance_variable_get(:@ta_input_buffers) || holder.instance_variable_set(:@ta_input_buffers, [])
|
|
492
|
+
inputs[index] = buffer
|
|
413
493
|
end
|
|
414
|
-
|
|
494
|
+
status
|
|
495
|
+
end
|
|
496
|
+
private_class_method :bind_input
|
|
497
|
+
|
|
498
|
+
# Prepares a double array for TA-Lib input
|
|
499
|
+
#
|
|
500
|
+
# @param array [Array<Numeric>] Array of numbers to prepare
|
|
501
|
+
# @return [Fiddle::Pointer] Pointer to prepared array
|
|
502
|
+
def prepare_double_array(array, size: nil)
|
|
503
|
+
packed_input(array.pack("d*"), Fiddle::SIZEOF_DOUBLE, size)
|
|
415
504
|
end
|
|
416
505
|
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
506
|
+
# Prepares an integer array for TA-Lib input
|
|
507
|
+
#
|
|
508
|
+
# @param array [Array<Numeric>] Array of numbers to prepare
|
|
509
|
+
# @return [Fiddle::Pointer] Pointer to prepared array
|
|
510
|
+
def prepare_integer_array(array, size: nil)
|
|
511
|
+
packed_input(array.pack("i!*"), Fiddle::SIZEOF_INT, size)
|
|
512
|
+
end
|
|
513
|
+
|
|
514
|
+
# Check the actual snapshot too. Other Ruby threads can change an input
|
|
515
|
+
# array between validation and packing while Fiddle releases the GVL.
|
|
516
|
+
def packed_input(bytes, width, size)
|
|
517
|
+
raise TALibError, "Input length changed during calculation" if size && bytes.bytesize != size * width
|
|
518
|
+
|
|
519
|
+
Fiddle::Pointer[bytes]
|
|
423
520
|
end
|
|
521
|
+
private_class_method :packed_input
|
|
424
522
|
|
|
523
|
+
# Sets up optional parameters for a function call
|
|
524
|
+
#
|
|
525
|
+
# @param params_ptr [Fiddle::Pointer] Parameter holder pointer
|
|
526
|
+
# @param options [Hash] Optional parameters
|
|
527
|
+
# @param func_name [String] Function name
|
|
425
528
|
def setup_optional_parameters(params_ptr, options, func_name)
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
set_optional_parameter(params_ptr, index,
|
|
529
|
+
keywords = function_info_map.fetch(func_name)[:keywords]
|
|
530
|
+
options.each do |name, value|
|
|
531
|
+
index, type = keywords.fetch(name)
|
|
532
|
+
set_optional_parameter(params_ptr, index, value, type)
|
|
430
533
|
end
|
|
431
534
|
end
|
|
432
535
|
|
|
536
|
+
# Sets a single optional parameter
|
|
537
|
+
#
|
|
538
|
+
# @param params_ptr [Fiddle::Pointer] Parameter holder pointer
|
|
539
|
+
# @param index [Integer] Parameter index
|
|
540
|
+
# @param value [Numeric] Parameter value
|
|
541
|
+
# @param type [Integer] Parameter type
|
|
433
542
|
def set_optional_parameter(params_ptr, index, value, type)
|
|
434
543
|
case type
|
|
435
544
|
when TA_PARAM_TYPE[:TA_OptInput_RealRange], TA_PARAM_TYPE[:TA_OptInput_RealList]
|
|
@@ -440,133 +549,160 @@ module TALibFFI
|
|
|
440
549
|
check_ta_return_code(ret_code)
|
|
441
550
|
end
|
|
442
551
|
|
|
443
|
-
#
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
output_arrays.each(&:free)
|
|
459
|
-
end
|
|
552
|
+
# Calculates function results
|
|
553
|
+
#
|
|
554
|
+
# @param params_ptr [Fiddle::Pointer] Parameter holder pointer
|
|
555
|
+
# @param input_arrays [Array] Input data
|
|
556
|
+
# @param func_name [String] Function name
|
|
557
|
+
# @return [Array, Hash] Function results
|
|
558
|
+
def calculate_results(params_ptr, input_arrays, func_name, input_size: validate_inputs!(input_arrays, func_name))
|
|
559
|
+
out_begin = [0].pack("i!")
|
|
560
|
+
out_size = [0].pack("i!")
|
|
561
|
+
buffers = setup_output_buffers(params_ptr, input_size, func_name)
|
|
562
|
+
check_ta_return_code(TA_CallFunc(params_ptr, 0, input_size - 1, out_begin, out_size))
|
|
563
|
+
count = out_size.unpack1("i!")
|
|
564
|
+
raise TALibError, "Invalid output count #{count} for #{func_name}" unless count.between?(0, input_size)
|
|
565
|
+
|
|
566
|
+
format_output_results(buffers, count, func_name)
|
|
460
567
|
end
|
|
461
|
-
# rubocop:enable Metrics/MethodLength
|
|
462
568
|
|
|
463
|
-
#
|
|
464
|
-
#
|
|
569
|
+
# Sets up output buffers for function results
|
|
570
|
+
#
|
|
571
|
+
# @param params_ptr [Fiddle::Pointer] Parameter holder pointer
|
|
572
|
+
# @param size [Integer] Size of output buffer
|
|
573
|
+
# @param func_name [String] Function name
|
|
574
|
+
# @return [Array<Fiddle::Pointer>] Array of output buffer pointers
|
|
465
575
|
def setup_output_buffers(params_ptr, size, func_name)
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
ptr = case output["type"]
|
|
471
|
-
when TA_PARAM_TYPE[:TA_Output_Real]
|
|
472
|
-
Fiddle::Pointer.malloc(Fiddle::SIZEOF_DOUBLE * size)
|
|
473
|
-
when TA_PARAM_TYPE[:TA_Output_Integer]
|
|
474
|
-
Fiddle::Pointer.malloc(Fiddle::SIZEOF_INT * size)
|
|
475
|
-
end
|
|
476
|
-
|
|
477
|
-
output_ptrs << ptr
|
|
478
|
-
|
|
479
|
-
ret_code = case output["type"]
|
|
480
|
-
when TA_PARAM_TYPE[:TA_Output_Real]
|
|
481
|
-
TA_SetOutputParamRealPtr(params_ptr, index, ptr)
|
|
482
|
-
when TA_PARAM_TYPE[:TA_Output_Integer]
|
|
483
|
-
TA_SetOutputParamIntegerPtr(params_ptr, index, ptr)
|
|
484
|
-
end
|
|
485
|
-
|
|
486
|
-
check_ta_return_code(ret_code)
|
|
576
|
+
function_info_map.fetch(func_name)[:output_layout].map.with_index do |(_format, width, setter), index|
|
|
577
|
+
ptr = Fiddle::Pointer["\0".b * (size * width)]
|
|
578
|
+
check_ta_return_code(public_send(setter, params_ptr, index, ptr))
|
|
579
|
+
ptr
|
|
487
580
|
end
|
|
488
|
-
|
|
489
|
-
output_ptrs
|
|
490
581
|
end
|
|
491
|
-
# rubocop:enable Metrics/MethodLength
|
|
492
|
-
# rubocop:enable Metrics/AbcSize
|
|
493
582
|
|
|
494
|
-
#
|
|
495
|
-
#
|
|
583
|
+
# Formats output results from TA-Lib function
|
|
584
|
+
#
|
|
585
|
+
# @param output_ptrs [Array<Fiddle::Pointer>] Array of output buffer pointers
|
|
586
|
+
# @param size [Integer] Size of output data
|
|
587
|
+
# @param func_name [String] Function name
|
|
588
|
+
# @return [Array, Hash] Formatted results
|
|
496
589
|
def format_output_results(output_ptrs, size, func_name)
|
|
497
|
-
|
|
498
|
-
results = output_ptrs.zip(
|
|
499
|
-
|
|
500
|
-
when TA_PARAM_TYPE[:TA_Output_Real]
|
|
501
|
-
ptr[0, Fiddle::SIZEOF_DOUBLE * size].unpack("d#{size}")
|
|
502
|
-
when TA_PARAM_TYPE[:TA_Output_Integer]
|
|
503
|
-
ptr[0, Fiddle::SIZEOF_INT * size].unpack("l#{size}")
|
|
504
|
-
end
|
|
590
|
+
info = function_info_map.fetch(func_name)
|
|
591
|
+
results = output_ptrs.zip(info[:output_layout]).map do |ptr, (format, width, _)|
|
|
592
|
+
ptr.to_s(size * width).unpack("#{format}*")
|
|
505
593
|
end
|
|
506
|
-
|
|
507
|
-
return results.first if results.length == 1
|
|
508
|
-
|
|
509
|
-
output_names = func_info[:outputs].map do |output|
|
|
510
|
-
normalize_parameter_name(output["paramName"].to_s).to_sym
|
|
511
|
-
end
|
|
512
|
-
output_names.zip(results).to_h
|
|
594
|
+
results.one? ? results.first : info[:output_names].zip(results).to_h
|
|
513
595
|
end
|
|
514
|
-
# rubocop:enable Metrics/AbcSize
|
|
515
|
-
# rubocop:enable Metrics/MethodLength
|
|
516
596
|
|
|
597
|
+
# Gets XML description of all TA-Lib functions
|
|
598
|
+
#
|
|
599
|
+
# @return [String] XML function descriptions
|
|
517
600
|
def function_description_xml
|
|
518
601
|
TA_FunctionDescriptionXML().to_s
|
|
519
602
|
end
|
|
520
603
|
|
|
604
|
+
# Gets or builds the function information map
|
|
605
|
+
#
|
|
606
|
+
# @return [Hash] Map of function information
|
|
521
607
|
def function_info_map
|
|
522
608
|
@function_info_map ||= build_function_info_map
|
|
523
609
|
end
|
|
524
610
|
|
|
611
|
+
# Builds a map of function information for all functions
|
|
612
|
+
#
|
|
613
|
+
# @return [Hash] Map of function information
|
|
525
614
|
def build_function_info_map
|
|
526
615
|
info_map = {}
|
|
527
616
|
each_function do |func_info|
|
|
528
|
-
info_map[func_info["name"].to_s] =
|
|
529
|
-
info: func_info,
|
|
530
|
-
inputs: collect_input_info(func_info),
|
|
531
|
-
outputs: collect_output_info(func_info),
|
|
532
|
-
opt_inputs: collect_opt_input_info(func_info)
|
|
533
|
-
}
|
|
617
|
+
info_map[func_info["name"].to_s] = function_parameters(func_info)
|
|
534
618
|
end
|
|
535
619
|
info_map
|
|
536
620
|
end
|
|
537
621
|
|
|
622
|
+
def function_parameters(info)
|
|
623
|
+
inputs = collect_input_info(info)
|
|
624
|
+
options = collect_opt_input_info(info)
|
|
625
|
+
outputs = collect_output_info(info)
|
|
626
|
+
{
|
|
627
|
+
info: info, handle: info["handle"], inputs: inputs, opt_inputs: options, outputs: outputs,
|
|
628
|
+
input_names: inputs.map { |input| input_name(input) },
|
|
629
|
+
keywords: keyword_index(options),
|
|
630
|
+
output_layout: outputs.map { |output| OUTPUT_LAYOUTS.fetch(output["type"]) },
|
|
631
|
+
output_names: outputs.map { |output| parameter_key(output) }
|
|
632
|
+
}
|
|
633
|
+
end
|
|
634
|
+
private_class_method :function_parameters
|
|
635
|
+
|
|
636
|
+
def keyword_index(options)
|
|
637
|
+
options.each_with_index.to_h { |option, index| [parameter_key(option), [index, option["type"]]] }
|
|
638
|
+
end
|
|
639
|
+
private_class_method :keyword_index
|
|
640
|
+
|
|
641
|
+
def parameter_key(parameter)
|
|
642
|
+
normalize_parameter_name(parameter["paramName"].to_s).to_sym
|
|
643
|
+
end
|
|
644
|
+
private_class_method :parameter_key
|
|
645
|
+
def input_name(input)
|
|
646
|
+
return normalize_parameter_name(input["paramName"].to_s) unless input["type"] == TA_PARAM_TYPE[:TA_Input_Price]
|
|
647
|
+
|
|
648
|
+
PRICE_FIELDS.values_at(*price_indexes(input["flags"]))
|
|
649
|
+
end
|
|
650
|
+
private_class_method :input_name
|
|
651
|
+
|
|
652
|
+
def price_indexes(flags)
|
|
653
|
+
raise TALibError, "Unsupported TA-Lib price flags #{flags}" unless (flags >> PRICE_FIELDS.size).zero?
|
|
654
|
+
|
|
655
|
+
PRICE_FIELDS.each_index.select { |i| flags.anybits?(1 << i) }
|
|
656
|
+
end
|
|
657
|
+
private_class_method :price_indexes
|
|
658
|
+
|
|
659
|
+
# Collects input parameter information for a function
|
|
660
|
+
#
|
|
661
|
+
# @param func_info [Fiddle::CStructEntity] Function information
|
|
662
|
+
# @return [Array<Fiddle::CStructEntity>] Array of input parameter information
|
|
538
663
|
def collect_input_info(func_info)
|
|
539
|
-
func_info["
|
|
540
|
-
|
|
541
|
-
TA_GetInputParameterInfo(
|
|
542
|
-
TA_InputParameterInfo.new(param_info_ptr)
|
|
664
|
+
handle = func_info["handle"]
|
|
665
|
+
func_info["nbInput"].times.map do |index|
|
|
666
|
+
TA_InputParameterInfo.new(native_pointer { |slot| TA_GetInputParameterInfo(handle, index, slot) })
|
|
543
667
|
end
|
|
544
668
|
end
|
|
545
669
|
|
|
670
|
+
# Collects optional input parameter information for a function
|
|
671
|
+
#
|
|
672
|
+
# @param func_info [Fiddle::CStructEntity] Function information
|
|
673
|
+
# @return [Array<Fiddle::CStructEntity>] Array of optional input parameter information
|
|
546
674
|
def collect_opt_input_info(func_info)
|
|
547
|
-
func_info["
|
|
548
|
-
|
|
549
|
-
TA_GetOptInputParameterInfo(
|
|
550
|
-
TA_OptInputParameterInfo.new(param_info_ptr)
|
|
675
|
+
handle = func_info["handle"]
|
|
676
|
+
func_info["nbOptInput"].times.map do |index|
|
|
677
|
+
TA_OptInputParameterInfo.new(native_pointer { |slot| TA_GetOptInputParameterInfo(handle, index, slot) })
|
|
551
678
|
end
|
|
552
679
|
end
|
|
553
680
|
|
|
681
|
+
# Collects output parameter information for a function
|
|
682
|
+
#
|
|
683
|
+
# @param func_info [Fiddle::CStructEntity] Function information
|
|
684
|
+
# @return [Array<Fiddle::CStructEntity>] Array of output parameter information
|
|
554
685
|
def collect_output_info(func_info)
|
|
555
|
-
func_info["
|
|
556
|
-
|
|
557
|
-
TA_GetOutputParameterInfo(
|
|
558
|
-
TA_OutputParameterInfo.new(param_info_ptr)
|
|
686
|
+
handle = func_info["handle"]
|
|
687
|
+
func_info["nbOutput"].times.map do |index|
|
|
688
|
+
TA_OutputParameterInfo.new(native_pointer { |slot| TA_GetOutputParameterInfo(handle, index, slot) })
|
|
559
689
|
end
|
|
560
690
|
end
|
|
561
691
|
|
|
692
|
+
# Generates Ruby methods for all TA-Lib functions
|
|
693
|
+
#
|
|
694
|
+
# This method iterates through all available TA-Lib functions and creates
|
|
695
|
+
# corresponding Ruby methods with proper documentation.
|
|
562
696
|
def generate_ta_functions
|
|
563
|
-
|
|
564
|
-
define_ta_function(func_info["name"].to_s.downcase, func_info["name"].to_s)
|
|
565
|
-
end
|
|
697
|
+
function_info_map.each_key { |name| define_ta_function(name.downcase, name) }
|
|
566
698
|
end
|
|
567
699
|
|
|
700
|
+
# Normalizes parameter names to Ruby style
|
|
701
|
+
#
|
|
702
|
+
# @param name [String] Parameter name to normalize
|
|
703
|
+
# @return [String] Normalized parameter name
|
|
568
704
|
def normalize_parameter_name(name)
|
|
569
|
-
name.sub(/^(optIn|outReal|outInteger|out)/, "")
|
|
705
|
+
name.sub(/^(optIn|outReal|outInteger|out|in)/, "")
|
|
570
706
|
.gsub(/::/, "/")
|
|
571
707
|
.gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
|
|
572
708
|
.gsub(/([a-z\d])([A-Z])/, '\1_\2')
|
|
@@ -574,10 +710,11 @@ module TALibFFI
|
|
|
574
710
|
.downcase
|
|
575
711
|
end
|
|
576
712
|
|
|
577
|
-
#
|
|
578
|
-
#
|
|
579
|
-
#
|
|
580
|
-
|
|
713
|
+
# Checks TA-Lib return codes and raises appropriate errors
|
|
714
|
+
#
|
|
715
|
+
# @param code [Integer] TA-Lib return code
|
|
716
|
+
# @raise [TALibError] If the return code indicates an error
|
|
717
|
+
def check_ta_return_code(code) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength
|
|
581
718
|
return if code == TA_SUCCESS
|
|
582
719
|
|
|
583
720
|
error_message = case code
|
|
@@ -623,10 +760,8 @@ module TALibFFI
|
|
|
623
760
|
|
|
624
761
|
raise TALibError, error_message
|
|
625
762
|
end
|
|
626
|
-
# rubocop:enable Metrics/CyclomaticComplexity
|
|
627
|
-
# rubocop:enable Metrics/MethodLength
|
|
628
|
-
# rubocop:enable Metrics/AbcSize
|
|
629
763
|
|
|
764
|
+
# Initializes the TA-Lib library
|
|
630
765
|
def initialize_ta_lib
|
|
631
766
|
return if @initialized
|
|
632
767
|
|
|
@@ -636,26 +771,2039 @@ module TALibFFI
|
|
|
636
771
|
@initialized = true
|
|
637
772
|
end
|
|
638
773
|
|
|
774
|
+
# Defines a TA-Lib function as a Ruby method with documentation
|
|
775
|
+
#
|
|
776
|
+
# @param method_name [String] Name of the Ruby method to define
|
|
777
|
+
# @param func_name [String] Name of the TA-Lib function
|
|
639
778
|
def define_ta_function(method_name, func_name)
|
|
640
779
|
define_singleton_method(method_name) do |*args|
|
|
641
780
|
call_func(func_name, args)
|
|
642
781
|
end
|
|
643
782
|
end
|
|
644
783
|
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
TA_SetInputParamPricePtr(params_ptr, index, *data_pointers)
|
|
784
|
+
# Sets up price inputs for functions that take price data
|
|
785
|
+
#
|
|
786
|
+
# @param params_ptr [Fiddle::Pointer] Parameter holder pointer
|
|
787
|
+
# @param index [Integer] Parameter index
|
|
788
|
+
# @param price_data [Array] Price data array
|
|
789
|
+
# @param flags [Integer] Input flags
|
|
790
|
+
def setup_price_inputs(params_ptr, index, price_data, flags, size: nil)
|
|
791
|
+
pointers = Array.new(PRICE_FIELDS.size)
|
|
792
|
+
price_indexes(flags).zip(price_data) { |slot, series| pointers[slot] = prepare_double_array(series, size: size) }
|
|
793
|
+
bind_input(params_ptr, index, pointers) { |prices| TA_SetInputParamPricePtr(params_ptr, index, *prices) }
|
|
657
794
|
end
|
|
658
795
|
|
|
659
796
|
initialize_ta_lib
|
|
660
797
|
generate_ta_functions
|
|
798
|
+
|
|
799
|
+
# Placeholder for generated TA-Lib function documentation.
|
|
800
|
+
# Available functions and their defaults depend on the installed C library.
|
|
801
|
+
# Run: rake yard
|
|
802
|
+
class << self
|
|
803
|
+
### GENERATED DOCUMENTATION START ###
|
|
804
|
+
# @!method ac(price_hl, fast_period: 5.0, slow_period: 34.0, signal_period: 5.0)
|
|
805
|
+
# Accelerator/Decelerator Oscillator
|
|
806
|
+
#
|
|
807
|
+
# @param price_hl [Array(Array<Float>, Array<Float>)] Required price arrays: high, low
|
|
808
|
+
# @param fast_period [Integer] Period of the fast MA (default: 5.0)
|
|
809
|
+
# @param slow_period [Integer] Period of the slow MA (default: 34.0)
|
|
810
|
+
# @param signal_period [Integer] Smoothing for the signal line (period length) (default: 5.0)
|
|
811
|
+
# @return [Array<Float>]
|
|
812
|
+
# @raise [TALibError] If there is an error in function execution
|
|
813
|
+
|
|
814
|
+
# @!method accbands(price_hlc, time_period: 20.0)
|
|
815
|
+
# Acceleration Bands
|
|
816
|
+
#
|
|
817
|
+
# @param price_hlc [Array(Array<Float>, Array<Float>, Array<Float>)] Required price arrays: high, low, close
|
|
818
|
+
# @param time_period [Integer] Time period (default: 20.0)
|
|
819
|
+
# @return [Hash] Hash containing the following arrays:
|
|
820
|
+
# @option result [Array<Float>] :upper_band Output values
|
|
821
|
+
# @option result [Array<Float>] :middle_band Output values
|
|
822
|
+
# @option result [Array<Float>] :lower_band Output values
|
|
823
|
+
# @raise [TALibError] If there is an error in function execution
|
|
824
|
+
|
|
825
|
+
# @!method acos(real)
|
|
826
|
+
# Vector Trigonometric ACos
|
|
827
|
+
#
|
|
828
|
+
# @param real [Array<Float>] Input values
|
|
829
|
+
# @return [Array<Float>]
|
|
830
|
+
# @raise [TALibError] If there is an error in function execution
|
|
831
|
+
|
|
832
|
+
# @!method ad(price_hlcv)
|
|
833
|
+
# Chaikin A/D Line
|
|
834
|
+
#
|
|
835
|
+
# @param price_hlcv [Array(Array<Float>, Array<Float>, Array<Float>, Array<Float>)] Required price arrays: high, low, close, volume
|
|
836
|
+
# @return [Array<Float>]
|
|
837
|
+
# @raise [TALibError] If there is an error in function execution
|
|
838
|
+
|
|
839
|
+
# @!method add(real0, real1)
|
|
840
|
+
# Vector Arithmetic Add
|
|
841
|
+
#
|
|
842
|
+
# @param real0 [Array<Float>] Input values
|
|
843
|
+
# @param real1 [Array<Float>] Input values
|
|
844
|
+
# @return [Array<Float>]
|
|
845
|
+
# @raise [TALibError] If there is an error in function execution
|
|
846
|
+
|
|
847
|
+
# @!method adosc(price_hlcv, fast_period: 3.0, slow_period: 10.0)
|
|
848
|
+
# Chaikin A/D Oscillator
|
|
849
|
+
#
|
|
850
|
+
# @param price_hlcv [Array(Array<Float>, Array<Float>, Array<Float>, Array<Float>)] Required price arrays: high, low, close, volume
|
|
851
|
+
# @param fast_period [Integer] Period of the fast MA (default: 3.0)
|
|
852
|
+
# @param slow_period [Integer] Period of the slow MA (default: 10.0)
|
|
853
|
+
# @return [Array<Float>]
|
|
854
|
+
# @raise [TALibError] If there is an error in function execution
|
|
855
|
+
|
|
856
|
+
# @!method adr(price_hl, time_period: 14.0)
|
|
857
|
+
# Average Day Range
|
|
858
|
+
#
|
|
859
|
+
# @param price_hl [Array(Array<Float>, Array<Float>)] Required price arrays: high, low
|
|
860
|
+
# @param time_period [Integer] Time period (default: 14.0)
|
|
861
|
+
# @return [Array<Float>]
|
|
862
|
+
# @raise [TALibError] If there is an error in function execution
|
|
863
|
+
|
|
864
|
+
# @!method adx(price_hlc, time_period: 14.0)
|
|
865
|
+
# Average Directional Movement Index
|
|
866
|
+
#
|
|
867
|
+
# @param price_hlc [Array(Array<Float>, Array<Float>, Array<Float>)] Required price arrays: high, low, close
|
|
868
|
+
# @param time_period [Integer] Time period (default: 14.0)
|
|
869
|
+
# @return [Array<Float>]
|
|
870
|
+
# @raise [TALibError] If there is an error in function execution
|
|
871
|
+
|
|
872
|
+
# @!method adxr(price_hlc, time_period: 14.0)
|
|
873
|
+
# Average Directional Movement Index Rating
|
|
874
|
+
#
|
|
875
|
+
# @param price_hlc [Array(Array<Float>, Array<Float>, Array<Float>)] Required price arrays: high, low, close
|
|
876
|
+
# @param time_period [Integer] Time period (default: 14.0)
|
|
877
|
+
# @return [Array<Float>]
|
|
878
|
+
# @raise [TALibError] If there is an error in function execution
|
|
879
|
+
|
|
880
|
+
# @!method alma(real, time_period: 9.0, sigma: 6.0, offset: 0.85)
|
|
881
|
+
# Arnaud Legoux Moving Average
|
|
882
|
+
#
|
|
883
|
+
# @param real [Array<Float>] Input values
|
|
884
|
+
# @param time_period [Integer] Time period (default: 9.0)
|
|
885
|
+
# @param sigma [Float] Gaussian width divisor (default: 6.0)
|
|
886
|
+
# @param offset [Float] Position of the peak weight (default: 0.85)
|
|
887
|
+
# @return [Array<Float>]
|
|
888
|
+
# @raise [TALibError] If there is an error in function execution
|
|
889
|
+
|
|
890
|
+
# @!method ao(price_hl, fast_period: 5.0, slow_period: 34.0)
|
|
891
|
+
# Awesome Oscillator
|
|
892
|
+
#
|
|
893
|
+
# @param price_hl [Array(Array<Float>, Array<Float>)] Required price arrays: high, low
|
|
894
|
+
# @param fast_period [Integer] Period of the fast MA (default: 5.0)
|
|
895
|
+
# @param slow_period [Integer] Period of the slow MA (default: 34.0)
|
|
896
|
+
# @return [Array<Float>]
|
|
897
|
+
# @raise [TALibError] If there is an error in function execution
|
|
898
|
+
|
|
899
|
+
# @!method apo(real, fast_period: 12.0, slow_period: 26.0, ma_type: 1.0)
|
|
900
|
+
# Absolute Price Oscillator
|
|
901
|
+
#
|
|
902
|
+
# @param real [Array<Float>] Input values
|
|
903
|
+
# @param fast_period [Integer] Period of the fast MA (default: 12.0)
|
|
904
|
+
# @param slow_period [Integer] Period of the slow MA (default: 26.0)
|
|
905
|
+
# @param ma_type [Integer] Type of Moving Average (default: 1.0)
|
|
906
|
+
# @return [Array<Float>]
|
|
907
|
+
# @raise [TALibError] If there is an error in function execution
|
|
908
|
+
|
|
909
|
+
# @!method aroon(price_hl, time_period: 14.0)
|
|
910
|
+
# Aroon
|
|
911
|
+
#
|
|
912
|
+
# @param price_hl [Array(Array<Float>, Array<Float>)] Required price arrays: high, low
|
|
913
|
+
# @param time_period [Integer] Time period (default: 14.0)
|
|
914
|
+
# @return [Hash] Hash containing the following arrays:
|
|
915
|
+
# @option result [Array<Float>] :aroon_down Output values
|
|
916
|
+
# @option result [Array<Float>] :aroon_up Output values
|
|
917
|
+
# @raise [TALibError] If there is an error in function execution
|
|
918
|
+
|
|
919
|
+
# @!method aroonosc(price_hl, time_period: 14.0)
|
|
920
|
+
# Aroon Oscillator
|
|
921
|
+
#
|
|
922
|
+
# @param price_hl [Array(Array<Float>, Array<Float>)] Required price arrays: high, low
|
|
923
|
+
# @param time_period [Integer] Time period (default: 14.0)
|
|
924
|
+
# @return [Array<Float>]
|
|
925
|
+
# @raise [TALibError] If there is an error in function execution
|
|
926
|
+
|
|
927
|
+
# @!method asi(price_ohlc, limit_move: 3.0)
|
|
928
|
+
# Wilder Accumulative Swing Index
|
|
929
|
+
#
|
|
930
|
+
# @param price_ohlc [Array(Array<Float>, Array<Float>, Array<Float>, Array<Float>)] Required price arrays: open, high, low, close
|
|
931
|
+
# @param limit_move [Float] Largest one-bar price move the index is scaled against, in price units (default: 3.0)
|
|
932
|
+
# @return [Array<Float>]
|
|
933
|
+
# @raise [TALibError] If there is an error in function execution
|
|
934
|
+
|
|
935
|
+
# @!method asin(real)
|
|
936
|
+
# Vector Trigonometric ASin
|
|
937
|
+
#
|
|
938
|
+
# @param real [Array<Float>] Input values
|
|
939
|
+
# @return [Array<Float>]
|
|
940
|
+
# @raise [TALibError] If there is an error in function execution
|
|
941
|
+
|
|
942
|
+
# @!method atan(real)
|
|
943
|
+
# Vector Trigonometric ATan
|
|
944
|
+
#
|
|
945
|
+
# @param real [Array<Float>] Input values
|
|
946
|
+
# @return [Array<Float>]
|
|
947
|
+
# @raise [TALibError] If there is an error in function execution
|
|
948
|
+
|
|
949
|
+
# @!method atr(price_hlc, time_period: 14.0)
|
|
950
|
+
# Average True Range
|
|
951
|
+
#
|
|
952
|
+
# @param price_hlc [Array(Array<Float>, Array<Float>, Array<Float>)] Required price arrays: high, low, close
|
|
953
|
+
# @param time_period [Integer] Time period (default: 14.0)
|
|
954
|
+
# @return [Array<Float>]
|
|
955
|
+
# @raise [TALibError] If there is an error in function execution
|
|
956
|
+
|
|
957
|
+
# @!method avgdev(real, time_period: 14.0)
|
|
958
|
+
# Average Deviation
|
|
959
|
+
#
|
|
960
|
+
# @param real [Array<Float>] Input values
|
|
961
|
+
# @param time_period [Integer] Time period (default: 14.0)
|
|
962
|
+
# @return [Array<Float>]
|
|
963
|
+
# @raise [TALibError] If there is an error in function execution
|
|
964
|
+
|
|
965
|
+
# @!method avgprice(price_ohlc)
|
|
966
|
+
# Average Price
|
|
967
|
+
#
|
|
968
|
+
# @param price_ohlc [Array(Array<Float>, Array<Float>, Array<Float>, Array<Float>)] Required price arrays: open, high, low, close
|
|
969
|
+
# @return [Array<Float>]
|
|
970
|
+
# @raise [TALibError] If there is an error in function execution
|
|
971
|
+
|
|
972
|
+
# @!method bbands(real, time_period: 20.0, nb_dev_up: 2.0, nb_dev_dn: 2.0, ma_type: 0.0)
|
|
973
|
+
# Bollinger Bands
|
|
974
|
+
#
|
|
975
|
+
# @param real [Array<Float>] Input values
|
|
976
|
+
# @param time_period [Integer] Time period (default: 20.0)
|
|
977
|
+
# @param nb_dev_up [Float] Deviation multiplier for upper band (default: 2.0)
|
|
978
|
+
# @param nb_dev_dn [Float] Deviation multiplier for lower band (default: 2.0)
|
|
979
|
+
# @param ma_type [Integer] Type of Moving Average (default: 0.0)
|
|
980
|
+
# @return [Hash] Hash containing the following arrays:
|
|
981
|
+
# @option result [Array<Float>] :upper_band Output values
|
|
982
|
+
# @option result [Array<Float>] :middle_band Output values
|
|
983
|
+
# @option result [Array<Float>] :lower_band Output values
|
|
984
|
+
# @raise [TALibError] If there is an error in function execution
|
|
985
|
+
|
|
986
|
+
# @!method bbw(real, time_period: 20.0, nb_dev_up: 2.0, nb_dev_dn: 2.0, ma_type: 0.0)
|
|
987
|
+
# Bollinger BandWidth
|
|
988
|
+
#
|
|
989
|
+
# @param real [Array<Float>] Input values
|
|
990
|
+
# @param time_period [Integer] Time period (default: 20.0)
|
|
991
|
+
# @param nb_dev_up [Float] Deviation multiplier for upper band (default: 2.0)
|
|
992
|
+
# @param nb_dev_dn [Float] Deviation multiplier for lower band (default: 2.0)
|
|
993
|
+
# @param ma_type [Integer] Type of Moving Average (default: 0.0)
|
|
994
|
+
# @return [Array<Float>]
|
|
995
|
+
# @raise [TALibError] If there is an error in function execution
|
|
996
|
+
|
|
997
|
+
# @!method beta(real0, real1, time_period: 5.0)
|
|
998
|
+
# Beta
|
|
999
|
+
#
|
|
1000
|
+
# @param real0 [Array<Float>] Input values
|
|
1001
|
+
# @param real1 [Array<Float>] Input values
|
|
1002
|
+
# @param time_period [Integer] Time period (default: 5.0)
|
|
1003
|
+
# @return [Array<Float>]
|
|
1004
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1005
|
+
|
|
1006
|
+
# @!method bop(price_ohlc)
|
|
1007
|
+
# Balance Of Power
|
|
1008
|
+
#
|
|
1009
|
+
# @param price_ohlc [Array(Array<Float>, Array<Float>, Array<Float>, Array<Float>)] Required price arrays: open, high, low, close
|
|
1010
|
+
# @return [Array<Float>]
|
|
1011
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1012
|
+
|
|
1013
|
+
# @!method cci(price_hlc, time_period: 14.0)
|
|
1014
|
+
# Commodity Channel Index
|
|
1015
|
+
#
|
|
1016
|
+
# @param price_hlc [Array(Array<Float>, Array<Float>, Array<Float>)] Required price arrays: high, low, close
|
|
1017
|
+
# @param time_period [Integer] Time period (default: 14.0)
|
|
1018
|
+
# @return [Array<Float>]
|
|
1019
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1020
|
+
|
|
1021
|
+
# @!method cdl2crows(price_ohlc)
|
|
1022
|
+
# Two Crows
|
|
1023
|
+
#
|
|
1024
|
+
# @param price_ohlc [Array(Array<Float>, Array<Float>, Array<Float>, Array<Float>)] Required price arrays: open, high, low, close
|
|
1025
|
+
# @return [Array<Integer>]
|
|
1026
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1027
|
+
|
|
1028
|
+
# @!method cdl3blackcrows(price_ohlc)
|
|
1029
|
+
# Three Black Crows
|
|
1030
|
+
#
|
|
1031
|
+
# @param price_ohlc [Array(Array<Float>, Array<Float>, Array<Float>, Array<Float>)] Required price arrays: open, high, low, close
|
|
1032
|
+
# @return [Array<Integer>]
|
|
1033
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1034
|
+
|
|
1035
|
+
# @!method cdl3inside(price_ohlc)
|
|
1036
|
+
# Three Inside Up/Down
|
|
1037
|
+
#
|
|
1038
|
+
# @param price_ohlc [Array(Array<Float>, Array<Float>, Array<Float>, Array<Float>)] Required price arrays: open, high, low, close
|
|
1039
|
+
# @return [Array<Integer>]
|
|
1040
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1041
|
+
|
|
1042
|
+
# @!method cdl3linestrike(price_ohlc)
|
|
1043
|
+
# Three-Line Strike
|
|
1044
|
+
#
|
|
1045
|
+
# @param price_ohlc [Array(Array<Float>, Array<Float>, Array<Float>, Array<Float>)] Required price arrays: open, high, low, close
|
|
1046
|
+
# @return [Array<Integer>]
|
|
1047
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1048
|
+
|
|
1049
|
+
# @!method cdl3outside(price_ohlc)
|
|
1050
|
+
# Three Outside Up/Down
|
|
1051
|
+
#
|
|
1052
|
+
# @param price_ohlc [Array(Array<Float>, Array<Float>, Array<Float>, Array<Float>)] Required price arrays: open, high, low, close
|
|
1053
|
+
# @return [Array<Integer>]
|
|
1054
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1055
|
+
|
|
1056
|
+
# @!method cdl3starsinsouth(price_ohlc)
|
|
1057
|
+
# Three Stars In The South
|
|
1058
|
+
#
|
|
1059
|
+
# @param price_ohlc [Array(Array<Float>, Array<Float>, Array<Float>, Array<Float>)] Required price arrays: open, high, low, close
|
|
1060
|
+
# @return [Array<Integer>]
|
|
1061
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1062
|
+
|
|
1063
|
+
# @!method cdl3whitesoldiers(price_ohlc)
|
|
1064
|
+
# Three Advancing White Soldiers
|
|
1065
|
+
#
|
|
1066
|
+
# @param price_ohlc [Array(Array<Float>, Array<Float>, Array<Float>, Array<Float>)] Required price arrays: open, high, low, close
|
|
1067
|
+
# @return [Array<Integer>]
|
|
1068
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1069
|
+
|
|
1070
|
+
# @!method cdlabandonedbaby(price_ohlc, penetration: 0.3)
|
|
1071
|
+
# Abandoned Baby
|
|
1072
|
+
#
|
|
1073
|
+
# @param price_ohlc [Array(Array<Float>, Array<Float>, Array<Float>, Array<Float>)] Required price arrays: open, high, low, close
|
|
1074
|
+
# @param penetration [Float] Percentage of penetration of a candle within another candle (default: 0.3)
|
|
1075
|
+
# @return [Array<Integer>]
|
|
1076
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1077
|
+
|
|
1078
|
+
# @!method cdladvanceblock(price_ohlc)
|
|
1079
|
+
# Advance Block
|
|
1080
|
+
#
|
|
1081
|
+
# @param price_ohlc [Array(Array<Float>, Array<Float>, Array<Float>, Array<Float>)] Required price arrays: open, high, low, close
|
|
1082
|
+
# @return [Array<Integer>]
|
|
1083
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1084
|
+
|
|
1085
|
+
# @!method cdlbelthold(price_ohlc)
|
|
1086
|
+
# Belt-hold
|
|
1087
|
+
#
|
|
1088
|
+
# @param price_ohlc [Array(Array<Float>, Array<Float>, Array<Float>, Array<Float>)] Required price arrays: open, high, low, close
|
|
1089
|
+
# @return [Array<Integer>]
|
|
1090
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1091
|
+
|
|
1092
|
+
# @!method cdlbreakaway(price_ohlc)
|
|
1093
|
+
# Breakaway
|
|
1094
|
+
#
|
|
1095
|
+
# @param price_ohlc [Array(Array<Float>, Array<Float>, Array<Float>, Array<Float>)] Required price arrays: open, high, low, close
|
|
1096
|
+
# @return [Array<Integer>]
|
|
1097
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1098
|
+
|
|
1099
|
+
# @!method cdlclosingmarubozu(price_ohlc)
|
|
1100
|
+
# Closing Marubozu
|
|
1101
|
+
#
|
|
1102
|
+
# @param price_ohlc [Array(Array<Float>, Array<Float>, Array<Float>, Array<Float>)] Required price arrays: open, high, low, close
|
|
1103
|
+
# @return [Array<Integer>]
|
|
1104
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1105
|
+
|
|
1106
|
+
# @!method cdlconcealbabyswall(price_ohlc)
|
|
1107
|
+
# Concealing Baby Swallow
|
|
1108
|
+
#
|
|
1109
|
+
# @param price_ohlc [Array(Array<Float>, Array<Float>, Array<Float>, Array<Float>)] Required price arrays: open, high, low, close
|
|
1110
|
+
# @return [Array<Integer>]
|
|
1111
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1112
|
+
|
|
1113
|
+
# @!method cdlcounterattack(price_ohlc)
|
|
1114
|
+
# Counterattack
|
|
1115
|
+
#
|
|
1116
|
+
# @param price_ohlc [Array(Array<Float>, Array<Float>, Array<Float>, Array<Float>)] Required price arrays: open, high, low, close
|
|
1117
|
+
# @return [Array<Integer>]
|
|
1118
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1119
|
+
|
|
1120
|
+
# @!method cdldarkcloudcover(price_ohlc, penetration: 0.5)
|
|
1121
|
+
# Dark Cloud Cover
|
|
1122
|
+
#
|
|
1123
|
+
# @param price_ohlc [Array(Array<Float>, Array<Float>, Array<Float>, Array<Float>)] Required price arrays: open, high, low, close
|
|
1124
|
+
# @param penetration [Float] Percentage of penetration of a candle within another candle (default: 0.5)
|
|
1125
|
+
# @return [Array<Integer>]
|
|
1126
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1127
|
+
|
|
1128
|
+
# @!method cdldoji(price_ohlc)
|
|
1129
|
+
# Doji
|
|
1130
|
+
#
|
|
1131
|
+
# @param price_ohlc [Array(Array<Float>, Array<Float>, Array<Float>, Array<Float>)] Required price arrays: open, high, low, close
|
|
1132
|
+
# @return [Array<Integer>]
|
|
1133
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1134
|
+
|
|
1135
|
+
# @!method cdldojistar(price_ohlc)
|
|
1136
|
+
# Doji Star
|
|
1137
|
+
#
|
|
1138
|
+
# @param price_ohlc [Array(Array<Float>, Array<Float>, Array<Float>, Array<Float>)] Required price arrays: open, high, low, close
|
|
1139
|
+
# @return [Array<Integer>]
|
|
1140
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1141
|
+
|
|
1142
|
+
# @!method cdldragonflydoji(price_ohlc)
|
|
1143
|
+
# Dragonfly Doji
|
|
1144
|
+
#
|
|
1145
|
+
# @param price_ohlc [Array(Array<Float>, Array<Float>, Array<Float>, Array<Float>)] Required price arrays: open, high, low, close
|
|
1146
|
+
# @return [Array<Integer>]
|
|
1147
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1148
|
+
|
|
1149
|
+
# @!method cdlengulfing(price_ohlc)
|
|
1150
|
+
# Engulfing Pattern
|
|
1151
|
+
#
|
|
1152
|
+
# @param price_ohlc [Array(Array<Float>, Array<Float>, Array<Float>, Array<Float>)] Required price arrays: open, high, low, close
|
|
1153
|
+
# @return [Array<Integer>]
|
|
1154
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1155
|
+
|
|
1156
|
+
# @!method cdleveningdojistar(price_ohlc, penetration: 0.3)
|
|
1157
|
+
# Evening Doji Star
|
|
1158
|
+
#
|
|
1159
|
+
# @param price_ohlc [Array(Array<Float>, Array<Float>, Array<Float>, Array<Float>)] Required price arrays: open, high, low, close
|
|
1160
|
+
# @param penetration [Float] Percentage of penetration of a candle within another candle (default: 0.3)
|
|
1161
|
+
# @return [Array<Integer>]
|
|
1162
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1163
|
+
|
|
1164
|
+
# @!method cdleveningstar(price_ohlc, penetration: 0.3)
|
|
1165
|
+
# Evening Star
|
|
1166
|
+
#
|
|
1167
|
+
# @param price_ohlc [Array(Array<Float>, Array<Float>, Array<Float>, Array<Float>)] Required price arrays: open, high, low, close
|
|
1168
|
+
# @param penetration [Float] Percentage of penetration of a candle within another candle (default: 0.3)
|
|
1169
|
+
# @return [Array<Integer>]
|
|
1170
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1171
|
+
|
|
1172
|
+
# @!method cdlgapsidesidewhite(price_ohlc)
|
|
1173
|
+
# Up/Down-gap side-by-side white lines
|
|
1174
|
+
#
|
|
1175
|
+
# @param price_ohlc [Array(Array<Float>, Array<Float>, Array<Float>, Array<Float>)] Required price arrays: open, high, low, close
|
|
1176
|
+
# @return [Array<Integer>]
|
|
1177
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1178
|
+
|
|
1179
|
+
# @!method cdlgravestonedoji(price_ohlc)
|
|
1180
|
+
# Gravestone Doji
|
|
1181
|
+
#
|
|
1182
|
+
# @param price_ohlc [Array(Array<Float>, Array<Float>, Array<Float>, Array<Float>)] Required price arrays: open, high, low, close
|
|
1183
|
+
# @return [Array<Integer>]
|
|
1184
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1185
|
+
|
|
1186
|
+
# @!method cdlhammer(price_ohlc)
|
|
1187
|
+
# Hammer
|
|
1188
|
+
#
|
|
1189
|
+
# @param price_ohlc [Array(Array<Float>, Array<Float>, Array<Float>, Array<Float>)] Required price arrays: open, high, low, close
|
|
1190
|
+
# @return [Array<Integer>]
|
|
1191
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1192
|
+
|
|
1193
|
+
# @!method cdlhangingman(price_ohlc)
|
|
1194
|
+
# Hanging Man
|
|
1195
|
+
#
|
|
1196
|
+
# @param price_ohlc [Array(Array<Float>, Array<Float>, Array<Float>, Array<Float>)] Required price arrays: open, high, low, close
|
|
1197
|
+
# @return [Array<Integer>]
|
|
1198
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1199
|
+
|
|
1200
|
+
# @!method cdlharami(price_ohlc)
|
|
1201
|
+
# Harami Pattern
|
|
1202
|
+
#
|
|
1203
|
+
# @param price_ohlc [Array(Array<Float>, Array<Float>, Array<Float>, Array<Float>)] Required price arrays: open, high, low, close
|
|
1204
|
+
# @return [Array<Integer>]
|
|
1205
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1206
|
+
|
|
1207
|
+
# @!method cdlharamicross(price_ohlc)
|
|
1208
|
+
# Harami Cross Pattern
|
|
1209
|
+
#
|
|
1210
|
+
# @param price_ohlc [Array(Array<Float>, Array<Float>, Array<Float>, Array<Float>)] Required price arrays: open, high, low, close
|
|
1211
|
+
# @return [Array<Integer>]
|
|
1212
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1213
|
+
|
|
1214
|
+
# @!method cdlhighwave(price_ohlc)
|
|
1215
|
+
# High-Wave Candle
|
|
1216
|
+
#
|
|
1217
|
+
# @param price_ohlc [Array(Array<Float>, Array<Float>, Array<Float>, Array<Float>)] Required price arrays: open, high, low, close
|
|
1218
|
+
# @return [Array<Integer>]
|
|
1219
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1220
|
+
|
|
1221
|
+
# @!method cdlhikkake(price_ohlc)
|
|
1222
|
+
# Hikkake Pattern
|
|
1223
|
+
#
|
|
1224
|
+
# @param price_ohlc [Array(Array<Float>, Array<Float>, Array<Float>, Array<Float>)] Required price arrays: open, high, low, close
|
|
1225
|
+
# @return [Array<Integer>]
|
|
1226
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1227
|
+
|
|
1228
|
+
# @!method cdlhikkakemod(price_ohlc)
|
|
1229
|
+
# Modified Hikkake Pattern
|
|
1230
|
+
#
|
|
1231
|
+
# @param price_ohlc [Array(Array<Float>, Array<Float>, Array<Float>, Array<Float>)] Required price arrays: open, high, low, close
|
|
1232
|
+
# @return [Array<Integer>]
|
|
1233
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1234
|
+
|
|
1235
|
+
# @!method cdlhomingpigeon(price_ohlc)
|
|
1236
|
+
# Homing Pigeon
|
|
1237
|
+
#
|
|
1238
|
+
# @param price_ohlc [Array(Array<Float>, Array<Float>, Array<Float>, Array<Float>)] Required price arrays: open, high, low, close
|
|
1239
|
+
# @return [Array<Integer>]
|
|
1240
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1241
|
+
|
|
1242
|
+
# @!method cdlidentical3crows(price_ohlc)
|
|
1243
|
+
# Identical Three Crows
|
|
1244
|
+
#
|
|
1245
|
+
# @param price_ohlc [Array(Array<Float>, Array<Float>, Array<Float>, Array<Float>)] Required price arrays: open, high, low, close
|
|
1246
|
+
# @return [Array<Integer>]
|
|
1247
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1248
|
+
|
|
1249
|
+
# @!method cdlinneck(price_ohlc)
|
|
1250
|
+
# In-Neck Pattern
|
|
1251
|
+
#
|
|
1252
|
+
# @param price_ohlc [Array(Array<Float>, Array<Float>, Array<Float>, Array<Float>)] Required price arrays: open, high, low, close
|
|
1253
|
+
# @return [Array<Integer>]
|
|
1254
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1255
|
+
|
|
1256
|
+
# @!method cdlinvertedhammer(price_ohlc)
|
|
1257
|
+
# Inverted Hammer
|
|
1258
|
+
#
|
|
1259
|
+
# @param price_ohlc [Array(Array<Float>, Array<Float>, Array<Float>, Array<Float>)] Required price arrays: open, high, low, close
|
|
1260
|
+
# @return [Array<Integer>]
|
|
1261
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1262
|
+
|
|
1263
|
+
# @!method cdlkicking(price_ohlc)
|
|
1264
|
+
# Kicking
|
|
1265
|
+
#
|
|
1266
|
+
# @param price_ohlc [Array(Array<Float>, Array<Float>, Array<Float>, Array<Float>)] Required price arrays: open, high, low, close
|
|
1267
|
+
# @return [Array<Integer>]
|
|
1268
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1269
|
+
|
|
1270
|
+
# @!method cdlkickingbylength(price_ohlc)
|
|
1271
|
+
# Kicking - bull/bear determined by the longer marubozu
|
|
1272
|
+
#
|
|
1273
|
+
# @param price_ohlc [Array(Array<Float>, Array<Float>, Array<Float>, Array<Float>)] Required price arrays: open, high, low, close
|
|
1274
|
+
# @return [Array<Integer>]
|
|
1275
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1276
|
+
|
|
1277
|
+
# @!method cdlladderbottom(price_ohlc)
|
|
1278
|
+
# Ladder Bottom
|
|
1279
|
+
#
|
|
1280
|
+
# @param price_ohlc [Array(Array<Float>, Array<Float>, Array<Float>, Array<Float>)] Required price arrays: open, high, low, close
|
|
1281
|
+
# @return [Array<Integer>]
|
|
1282
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1283
|
+
|
|
1284
|
+
# @!method cdllongleggeddoji(price_ohlc)
|
|
1285
|
+
# Long Legged Doji
|
|
1286
|
+
#
|
|
1287
|
+
# @param price_ohlc [Array(Array<Float>, Array<Float>, Array<Float>, Array<Float>)] Required price arrays: open, high, low, close
|
|
1288
|
+
# @return [Array<Integer>]
|
|
1289
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1290
|
+
|
|
1291
|
+
# @!method cdllongline(price_ohlc)
|
|
1292
|
+
# Long Line Candle
|
|
1293
|
+
#
|
|
1294
|
+
# @param price_ohlc [Array(Array<Float>, Array<Float>, Array<Float>, Array<Float>)] Required price arrays: open, high, low, close
|
|
1295
|
+
# @return [Array<Integer>]
|
|
1296
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1297
|
+
|
|
1298
|
+
# @!method cdlmarubozu(price_ohlc)
|
|
1299
|
+
# Marubozu
|
|
1300
|
+
#
|
|
1301
|
+
# @param price_ohlc [Array(Array<Float>, Array<Float>, Array<Float>, Array<Float>)] Required price arrays: open, high, low, close
|
|
1302
|
+
# @return [Array<Integer>]
|
|
1303
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1304
|
+
|
|
1305
|
+
# @!method cdlmatchinglow(price_ohlc)
|
|
1306
|
+
# Matching Low
|
|
1307
|
+
#
|
|
1308
|
+
# @param price_ohlc [Array(Array<Float>, Array<Float>, Array<Float>, Array<Float>)] Required price arrays: open, high, low, close
|
|
1309
|
+
# @return [Array<Integer>]
|
|
1310
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1311
|
+
|
|
1312
|
+
# @!method cdlmathold(price_ohlc, penetration: 0.5)
|
|
1313
|
+
# Mat Hold
|
|
1314
|
+
#
|
|
1315
|
+
# @param price_ohlc [Array(Array<Float>, Array<Float>, Array<Float>, Array<Float>)] Required price arrays: open, high, low, close
|
|
1316
|
+
# @param penetration [Float] Percentage of penetration of a candle within another candle (default: 0.5)
|
|
1317
|
+
# @return [Array<Integer>]
|
|
1318
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1319
|
+
|
|
1320
|
+
# @!method cdlmorningdojistar(price_ohlc, penetration: 0.3)
|
|
1321
|
+
# Morning Doji Star
|
|
1322
|
+
#
|
|
1323
|
+
# @param price_ohlc [Array(Array<Float>, Array<Float>, Array<Float>, Array<Float>)] Required price arrays: open, high, low, close
|
|
1324
|
+
# @param penetration [Float] Percentage of penetration of a candle within another candle (default: 0.3)
|
|
1325
|
+
# @return [Array<Integer>]
|
|
1326
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1327
|
+
|
|
1328
|
+
# @!method cdlmorningstar(price_ohlc, penetration: 0.3)
|
|
1329
|
+
# Morning Star
|
|
1330
|
+
#
|
|
1331
|
+
# @param price_ohlc [Array(Array<Float>, Array<Float>, Array<Float>, Array<Float>)] Required price arrays: open, high, low, close
|
|
1332
|
+
# @param penetration [Float] Percentage of penetration of a candle within another candle (default: 0.3)
|
|
1333
|
+
# @return [Array<Integer>]
|
|
1334
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1335
|
+
|
|
1336
|
+
# @!method cdlonneck(price_ohlc)
|
|
1337
|
+
# On-Neck Pattern
|
|
1338
|
+
#
|
|
1339
|
+
# @param price_ohlc [Array(Array<Float>, Array<Float>, Array<Float>, Array<Float>)] Required price arrays: open, high, low, close
|
|
1340
|
+
# @return [Array<Integer>]
|
|
1341
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1342
|
+
|
|
1343
|
+
# @!method cdlpiercing(price_ohlc)
|
|
1344
|
+
# Piercing Pattern
|
|
1345
|
+
#
|
|
1346
|
+
# @param price_ohlc [Array(Array<Float>, Array<Float>, Array<Float>, Array<Float>)] Required price arrays: open, high, low, close
|
|
1347
|
+
# @return [Array<Integer>]
|
|
1348
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1349
|
+
|
|
1350
|
+
# @!method cdlrickshawman(price_ohlc)
|
|
1351
|
+
# Rickshaw Man
|
|
1352
|
+
#
|
|
1353
|
+
# @param price_ohlc [Array(Array<Float>, Array<Float>, Array<Float>, Array<Float>)] Required price arrays: open, high, low, close
|
|
1354
|
+
# @return [Array<Integer>]
|
|
1355
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1356
|
+
|
|
1357
|
+
# @!method cdlrisefall3methods(price_ohlc)
|
|
1358
|
+
# Rising/Falling Three Methods
|
|
1359
|
+
#
|
|
1360
|
+
# @param price_ohlc [Array(Array<Float>, Array<Float>, Array<Float>, Array<Float>)] Required price arrays: open, high, low, close
|
|
1361
|
+
# @return [Array<Integer>]
|
|
1362
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1363
|
+
|
|
1364
|
+
# @!method cdlseparatinglines(price_ohlc)
|
|
1365
|
+
# Separating Lines
|
|
1366
|
+
#
|
|
1367
|
+
# @param price_ohlc [Array(Array<Float>, Array<Float>, Array<Float>, Array<Float>)] Required price arrays: open, high, low, close
|
|
1368
|
+
# @return [Array<Integer>]
|
|
1369
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1370
|
+
|
|
1371
|
+
# @!method cdlshootingstar(price_ohlc)
|
|
1372
|
+
# Shooting Star
|
|
1373
|
+
#
|
|
1374
|
+
# @param price_ohlc [Array(Array<Float>, Array<Float>, Array<Float>, Array<Float>)] Required price arrays: open, high, low, close
|
|
1375
|
+
# @return [Array<Integer>]
|
|
1376
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1377
|
+
|
|
1378
|
+
# @!method cdlshortline(price_ohlc)
|
|
1379
|
+
# Short Line Candle
|
|
1380
|
+
#
|
|
1381
|
+
# @param price_ohlc [Array(Array<Float>, Array<Float>, Array<Float>, Array<Float>)] Required price arrays: open, high, low, close
|
|
1382
|
+
# @return [Array<Integer>]
|
|
1383
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1384
|
+
|
|
1385
|
+
# @!method cdlspinningtop(price_ohlc)
|
|
1386
|
+
# Spinning Top
|
|
1387
|
+
#
|
|
1388
|
+
# @param price_ohlc [Array(Array<Float>, Array<Float>, Array<Float>, Array<Float>)] Required price arrays: open, high, low, close
|
|
1389
|
+
# @return [Array<Integer>]
|
|
1390
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1391
|
+
|
|
1392
|
+
# @!method cdlstalledpattern(price_ohlc)
|
|
1393
|
+
# Stalled Pattern
|
|
1394
|
+
#
|
|
1395
|
+
# @param price_ohlc [Array(Array<Float>, Array<Float>, Array<Float>, Array<Float>)] Required price arrays: open, high, low, close
|
|
1396
|
+
# @return [Array<Integer>]
|
|
1397
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1398
|
+
|
|
1399
|
+
# @!method cdlsticksandwich(price_ohlc)
|
|
1400
|
+
# Stick Sandwich
|
|
1401
|
+
#
|
|
1402
|
+
# @param price_ohlc [Array(Array<Float>, Array<Float>, Array<Float>, Array<Float>)] Required price arrays: open, high, low, close
|
|
1403
|
+
# @return [Array<Integer>]
|
|
1404
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1405
|
+
|
|
1406
|
+
# @!method cdltakuri(price_ohlc)
|
|
1407
|
+
# Takuri (Dragonfly Doji with very long lower shadow)
|
|
1408
|
+
#
|
|
1409
|
+
# @param price_ohlc [Array(Array<Float>, Array<Float>, Array<Float>, Array<Float>)] Required price arrays: open, high, low, close
|
|
1410
|
+
# @return [Array<Integer>]
|
|
1411
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1412
|
+
|
|
1413
|
+
# @!method cdltasukigap(price_ohlc)
|
|
1414
|
+
# Tasuki Gap
|
|
1415
|
+
#
|
|
1416
|
+
# @param price_ohlc [Array(Array<Float>, Array<Float>, Array<Float>, Array<Float>)] Required price arrays: open, high, low, close
|
|
1417
|
+
# @return [Array<Integer>]
|
|
1418
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1419
|
+
|
|
1420
|
+
# @!method cdlthrusting(price_ohlc)
|
|
1421
|
+
# Thrusting Pattern
|
|
1422
|
+
#
|
|
1423
|
+
# @param price_ohlc [Array(Array<Float>, Array<Float>, Array<Float>, Array<Float>)] Required price arrays: open, high, low, close
|
|
1424
|
+
# @return [Array<Integer>]
|
|
1425
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1426
|
+
|
|
1427
|
+
# @!method cdltristar(price_ohlc)
|
|
1428
|
+
# Tristar Pattern
|
|
1429
|
+
#
|
|
1430
|
+
# @param price_ohlc [Array(Array<Float>, Array<Float>, Array<Float>, Array<Float>)] Required price arrays: open, high, low, close
|
|
1431
|
+
# @return [Array<Integer>]
|
|
1432
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1433
|
+
|
|
1434
|
+
# @!method cdlunique3river(price_ohlc)
|
|
1435
|
+
# Unique 3 River
|
|
1436
|
+
#
|
|
1437
|
+
# @param price_ohlc [Array(Array<Float>, Array<Float>, Array<Float>, Array<Float>)] Required price arrays: open, high, low, close
|
|
1438
|
+
# @return [Array<Integer>]
|
|
1439
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1440
|
+
|
|
1441
|
+
# @!method cdlupsidegap2crows(price_ohlc)
|
|
1442
|
+
# Upside Gap Two Crows
|
|
1443
|
+
#
|
|
1444
|
+
# @param price_ohlc [Array(Array<Float>, Array<Float>, Array<Float>, Array<Float>)] Required price arrays: open, high, low, close
|
|
1445
|
+
# @return [Array<Integer>]
|
|
1446
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1447
|
+
|
|
1448
|
+
# @!method cdlxsidegap3methods(price_ohlc)
|
|
1449
|
+
# Upside/Downside Gap Three Methods
|
|
1450
|
+
#
|
|
1451
|
+
# @param price_ohlc [Array(Array<Float>, Array<Float>, Array<Float>, Array<Float>)] Required price arrays: open, high, low, close
|
|
1452
|
+
# @return [Array<Integer>]
|
|
1453
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1454
|
+
|
|
1455
|
+
# @!method ceil(real)
|
|
1456
|
+
# Vector Ceil
|
|
1457
|
+
#
|
|
1458
|
+
# @param real [Array<Float>] Input values
|
|
1459
|
+
# @return [Array<Float>]
|
|
1460
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1461
|
+
|
|
1462
|
+
# @!method cg(real, time_period: 10.0)
|
|
1463
|
+
# Center of Gravity Oscillator
|
|
1464
|
+
#
|
|
1465
|
+
# @param real [Array<Float>] Input values
|
|
1466
|
+
# @param time_period [Integer] Number of bars in the window (default: 10.0)
|
|
1467
|
+
# @return [Array<Float>]
|
|
1468
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1469
|
+
|
|
1470
|
+
# @!method chop(price_hlc, time_period: 14.0)
|
|
1471
|
+
# Choppiness Index
|
|
1472
|
+
#
|
|
1473
|
+
# @param price_hlc [Array(Array<Float>, Array<Float>, Array<Float>)] Required price arrays: high, low, close
|
|
1474
|
+
# @param time_period [Integer] Time period (default: 14.0)
|
|
1475
|
+
# @return [Array<Float>]
|
|
1476
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1477
|
+
|
|
1478
|
+
# @!method choptr(price_hlc, time_period: 14.0)
|
|
1479
|
+
# Choppiness Index (True Range Box)
|
|
1480
|
+
#
|
|
1481
|
+
# @param price_hlc [Array(Array<Float>, Array<Float>, Array<Float>)] Required price arrays: high, low, close
|
|
1482
|
+
# @param time_period [Integer] Time period (default: 14.0)
|
|
1483
|
+
# @return [Array<Float>]
|
|
1484
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1485
|
+
|
|
1486
|
+
# @!method cksp(price_hlc, time_period: 10.0, multiplier: 1.0, stop_period: 9.0)
|
|
1487
|
+
# Chande Kroll Stop
|
|
1488
|
+
#
|
|
1489
|
+
# @param price_hlc [Array(Array<Float>, Array<Float>, Array<Float>)] Required price arrays: high, low, close
|
|
1490
|
+
# @param time_period [Integer] ATR and extreme window (default: 10.0)
|
|
1491
|
+
# @param multiplier [Float] ATR multiplier (default: 1.0)
|
|
1492
|
+
# @param stop_period [Integer] Stop window (default: 9.0)
|
|
1493
|
+
# @return [Hash] Hash containing the following arrays:
|
|
1494
|
+
# @option result [Array<Float>] :high_stop Output values
|
|
1495
|
+
# @option result [Array<Float>] :low_stop Output values
|
|
1496
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1497
|
+
|
|
1498
|
+
# @!method cmf(price_hlcv, time_period: 20.0)
|
|
1499
|
+
# Chaikin Money Flow
|
|
1500
|
+
#
|
|
1501
|
+
# @param price_hlcv [Array(Array<Float>, Array<Float>, Array<Float>, Array<Float>)] Required price arrays: high, low, close, volume
|
|
1502
|
+
# @param time_period [Integer] Time period (default: 20.0)
|
|
1503
|
+
# @return [Array<Float>]
|
|
1504
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1505
|
+
|
|
1506
|
+
# @!method cmo(real, time_period: 14.0)
|
|
1507
|
+
# Chande Momentum Oscillator
|
|
1508
|
+
#
|
|
1509
|
+
# @param real [Array<Float>] Input values
|
|
1510
|
+
# @param time_period [Integer] Time period (default: 14.0)
|
|
1511
|
+
# @return [Array<Float>]
|
|
1512
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1513
|
+
|
|
1514
|
+
# @!method cmou(real, time_period: 14.0)
|
|
1515
|
+
# Chande Momentum Oscillator (Unsmoothed)
|
|
1516
|
+
#
|
|
1517
|
+
# @param real [Array<Float>] Input values
|
|
1518
|
+
# @param time_period [Integer] Time period (default: 14.0)
|
|
1519
|
+
# @return [Array<Float>]
|
|
1520
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1521
|
+
|
|
1522
|
+
# @!method coppock(real, wma_period: 10.0, roc1_period: 11.0, roc2_period: 14.0)
|
|
1523
|
+
# Coppock Curve
|
|
1524
|
+
#
|
|
1525
|
+
# @param real [Array<Float>] Input values
|
|
1526
|
+
# @param wma_period [Integer] Smoothing period for the ROC sum (default: 10.0)
|
|
1527
|
+
# @param roc1_period [Integer] Short rate-of-change period (default: 11.0)
|
|
1528
|
+
# @param roc2_period [Integer] Long rate-of-change period (default: 14.0)
|
|
1529
|
+
# @return [Array<Float>]
|
|
1530
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1531
|
+
|
|
1532
|
+
# @!method correl(real0, real1, time_period: 30.0)
|
|
1533
|
+
# Pearson's Correlation Coefficient (r)
|
|
1534
|
+
#
|
|
1535
|
+
# @param real0 [Array<Float>] Input values
|
|
1536
|
+
# @param real1 [Array<Float>] Input values
|
|
1537
|
+
# @param time_period [Integer] Time period (default: 30.0)
|
|
1538
|
+
# @return [Array<Float>]
|
|
1539
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1540
|
+
|
|
1541
|
+
# @!method cos(real)
|
|
1542
|
+
# Vector Trigonometric Cos
|
|
1543
|
+
#
|
|
1544
|
+
# @param real [Array<Float>] Input values
|
|
1545
|
+
# @return [Array<Float>]
|
|
1546
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1547
|
+
|
|
1548
|
+
# @!method cosh(real)
|
|
1549
|
+
# Vector Trigonometric Cosh
|
|
1550
|
+
#
|
|
1551
|
+
# @param real [Array<Float>] Input values
|
|
1552
|
+
# @return [Array<Float>]
|
|
1553
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1554
|
+
|
|
1555
|
+
# @!method crsi(real, time_period: 3.0, streak_period: 2.0, rank_period: 100.0)
|
|
1556
|
+
# Connors Relative Strength Index
|
|
1557
|
+
#
|
|
1558
|
+
# @param real [Array<Float>] Input values
|
|
1559
|
+
# @param time_period [Integer] Time period (default: 3.0)
|
|
1560
|
+
# @param streak_period [Integer] Time period of the RSI of the up/down streak (default: 2.0)
|
|
1561
|
+
# @param rank_period [Integer] Number of previous one-bar returns the current one is ranked against (default: 100.0)
|
|
1562
|
+
# @return [Array<Float>]
|
|
1563
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1564
|
+
|
|
1565
|
+
# @!method cti(real, time_period: 20.0)
|
|
1566
|
+
# Correlation Trend Indicator
|
|
1567
|
+
#
|
|
1568
|
+
# @param real [Array<Float>] Input values
|
|
1569
|
+
# @param time_period [Integer] Number of bars correlated against the ramp (default: 20.0)
|
|
1570
|
+
# @return [Array<Float>]
|
|
1571
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1572
|
+
|
|
1573
|
+
# @!method cumsum(real)
|
|
1574
|
+
# Cumulative Sum
|
|
1575
|
+
#
|
|
1576
|
+
# @param real [Array<Float>] Input values
|
|
1577
|
+
# @return [Array<Float>]
|
|
1578
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1579
|
+
|
|
1580
|
+
# @!method cvi(price_hl, time_period: 10.0, roc_period: 10.0)
|
|
1581
|
+
# Chaikin's Volatility
|
|
1582
|
+
#
|
|
1583
|
+
# @param price_hl [Array(Array<Float>, Array<Float>)] Required price arrays: high, low
|
|
1584
|
+
# @param time_period [Integer] Period of the EMA smoothing the high-low spread (default: 10.0)
|
|
1585
|
+
# @param roc_period [Integer] Number of bars the rate of change reaches back (default: 10.0)
|
|
1586
|
+
# @return [Array<Float>]
|
|
1587
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1588
|
+
|
|
1589
|
+
# @!method dema(real, time_period: 30.0)
|
|
1590
|
+
# Double Exponential Moving Average
|
|
1591
|
+
#
|
|
1592
|
+
# @param real [Array<Float>] Input values
|
|
1593
|
+
# @param time_period [Integer] Time period (default: 30.0)
|
|
1594
|
+
# @return [Array<Float>]
|
|
1595
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1596
|
+
|
|
1597
|
+
# @!method div(real0, real1)
|
|
1598
|
+
# Vector Arithmetic Div
|
|
1599
|
+
#
|
|
1600
|
+
# @param real0 [Array<Float>] Input values
|
|
1601
|
+
# @param real1 [Array<Float>] Input values
|
|
1602
|
+
# @return [Array<Float>]
|
|
1603
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1604
|
+
|
|
1605
|
+
# @!method donchian(price_hl, time_period: 20.0)
|
|
1606
|
+
# Donchian Channels
|
|
1607
|
+
#
|
|
1608
|
+
# @param price_hl [Array(Array<Float>, Array<Float>)] Required price arrays: high, low
|
|
1609
|
+
# @param time_period [Integer] Time period (default: 20.0)
|
|
1610
|
+
# @return [Hash] Hash containing the following arrays:
|
|
1611
|
+
# @option result [Array<Float>] :upper_band Output values
|
|
1612
|
+
# @option result [Array<Float>] :middle_band Output values
|
|
1613
|
+
# @option result [Array<Float>] :lower_band Output values
|
|
1614
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1615
|
+
|
|
1616
|
+
# @!method dosc(real, time_period: 14.0, first_period: 5.0, second_period: 3.0, signal_period: 9.0)
|
|
1617
|
+
# Derivative Oscillator
|
|
1618
|
+
#
|
|
1619
|
+
# @param real [Array<Float>] Input values
|
|
1620
|
+
# @param time_period [Integer] Period of the RSI (default: 14.0)
|
|
1621
|
+
# @param first_period [Integer] Period of the first smoothing, applied to the RSI (default: 5.0)
|
|
1622
|
+
# @param second_period [Integer] Period of the second smoothing, applied to the first (default: 3.0)
|
|
1623
|
+
# @param signal_period [Integer] Period of the simple average subtracted from the smoothed line (default: 9.0)
|
|
1624
|
+
# @return [Array<Float>]
|
|
1625
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1626
|
+
|
|
1627
|
+
# @!method dpo(real, time_period: 20.0)
|
|
1628
|
+
# Detrended Price Oscillator
|
|
1629
|
+
#
|
|
1630
|
+
# @param real [Array<Float>] Input values
|
|
1631
|
+
# @param time_period [Integer] Time period (default: 20.0)
|
|
1632
|
+
# @return [Array<Float>]
|
|
1633
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1634
|
+
|
|
1635
|
+
# @!method dx(price_hlc, time_period: 14.0)
|
|
1636
|
+
# Directional Movement Index
|
|
1637
|
+
#
|
|
1638
|
+
# @param price_hlc [Array(Array<Float>, Array<Float>, Array<Float>)] Required price arrays: high, low, close
|
|
1639
|
+
# @param time_period [Integer] Time period (default: 14.0)
|
|
1640
|
+
# @return [Array<Float>]
|
|
1641
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1642
|
+
|
|
1643
|
+
# @!method efi(price_cv, time_period: 13.0)
|
|
1644
|
+
# Elder's Force Index
|
|
1645
|
+
#
|
|
1646
|
+
# @param price_cv [Array(Array<Float>, Array<Float>)] Required price arrays: close, volume
|
|
1647
|
+
# @param time_period [Integer] Time period (default: 13.0)
|
|
1648
|
+
# @return [Array<Float>]
|
|
1649
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1650
|
+
|
|
1651
|
+
# @!method ema(real, time_period: 30.0)
|
|
1652
|
+
# Exponential Moving Average
|
|
1653
|
+
#
|
|
1654
|
+
# @param real [Array<Float>] Input values
|
|
1655
|
+
# @param time_period [Integer] Time period (default: 30.0)
|
|
1656
|
+
# @return [Array<Float>]
|
|
1657
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1658
|
+
|
|
1659
|
+
# @!method emv(price_hlv, time_period: 14.0, volume_divisor: 10000.0)
|
|
1660
|
+
# Arms Ease of Movement
|
|
1661
|
+
#
|
|
1662
|
+
# @param price_hlv [Array(Array<Float>, Array<Float>, Array<Float>)] Required price arrays: high, low, volume
|
|
1663
|
+
# @param time_period [Integer] Bars in the SMA of the one-bar values (1 = unsmoothed) (default: 14.0)
|
|
1664
|
+
# @param volume_divisor [Float] Volume is divided by this before forming the box ratio (default: 10000.0)
|
|
1665
|
+
# @return [Array<Float>]
|
|
1666
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1667
|
+
|
|
1668
|
+
# @!method er(real, time_period: 10.0)
|
|
1669
|
+
# Kaufman Efficiency Ratio
|
|
1670
|
+
#
|
|
1671
|
+
# @param real [Array<Float>] Input values
|
|
1672
|
+
# @param time_period [Integer] Number of one-bar changes in the path sum (default: 10.0)
|
|
1673
|
+
# @return [Array<Float>]
|
|
1674
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1675
|
+
|
|
1676
|
+
# @!method eri(price_hlc, time_period: 13.0)
|
|
1677
|
+
# Elder Ray Index (Bull Power / Bear Power)
|
|
1678
|
+
#
|
|
1679
|
+
# @param price_hlc [Array(Array<Float>, Array<Float>, Array<Float>)] Required price arrays: high, low, close
|
|
1680
|
+
# @param time_period [Integer] Number of bars in the EMA of close (default: 13.0)
|
|
1681
|
+
# @return [Hash] Hash containing the following arrays:
|
|
1682
|
+
# @option result [Array<Float>] :bull_power Output values
|
|
1683
|
+
# @option result [Array<Float>] :bear_power Output values
|
|
1684
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1685
|
+
|
|
1686
|
+
# @!method exp(real)
|
|
1687
|
+
# Vector Arithmetic Exp
|
|
1688
|
+
#
|
|
1689
|
+
# @param real [Array<Float>] Input values
|
|
1690
|
+
# @return [Array<Float>]
|
|
1691
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1692
|
+
|
|
1693
|
+
# @!method fisher(price_hl, time_period: 10.0)
|
|
1694
|
+
# Fisher Transform
|
|
1695
|
+
#
|
|
1696
|
+
# @param price_hl [Array(Array<Float>, Array<Float>)] Required price arrays: high, low
|
|
1697
|
+
# @param time_period [Integer] Time period (default: 10.0)
|
|
1698
|
+
# @return [Hash] Hash containing the following arrays:
|
|
1699
|
+
# @option result [Array<Float>] :fisher Output values
|
|
1700
|
+
# @option result [Array<Float>] :trigger Output values
|
|
1701
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1702
|
+
|
|
1703
|
+
# @!method floor(real)
|
|
1704
|
+
# Vector Floor
|
|
1705
|
+
#
|
|
1706
|
+
# @param real [Array<Float>] Input values
|
|
1707
|
+
# @return [Array<Float>]
|
|
1708
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1709
|
+
|
|
1710
|
+
# @!method fosc(real, time_period: 5.0)
|
|
1711
|
+
# Forecast Oscillator
|
|
1712
|
+
#
|
|
1713
|
+
# @param real [Array<Float>] Input values
|
|
1714
|
+
# @param time_period [Integer] Time period (default: 5.0)
|
|
1715
|
+
# @return [Array<Float>]
|
|
1716
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1717
|
+
|
|
1718
|
+
# @!method fractal(price_hl, left_bars: 2.0, right_bars: 2.0)
|
|
1719
|
+
# Williams Fractal
|
|
1720
|
+
#
|
|
1721
|
+
# @param price_hl [Array(Array<Float>, Array<Float>)] Required price arrays: high, low
|
|
1722
|
+
# @param left_bars [Integer] Number of bars required to be lower/higher before the pivot (default: 2.0)
|
|
1723
|
+
# @param right_bars [Integer] Number of bars required to be lower/higher after the pivot (default: 2.0)
|
|
1724
|
+
# @return [Hash] Hash containing the following arrays:
|
|
1725
|
+
# @option result [Array<Integer>] :swing_high Output values
|
|
1726
|
+
# @option result [Array<Integer>] :swing_low Output values
|
|
1727
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1728
|
+
|
|
1729
|
+
# @!method frama(price_hl, time_period: 16.0)
|
|
1730
|
+
# Fractal Adaptive Moving Average
|
|
1731
|
+
#
|
|
1732
|
+
# @param price_hl [Array(Array<Float>, Array<Float>)] Required price arrays: high, low
|
|
1733
|
+
# @param time_period [Integer] Number of bars, even; the window is split into two halves of optInTimePeriod/2 bars (default: 16.0)
|
|
1734
|
+
# @return [Array<Float>]
|
|
1735
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1736
|
+
|
|
1737
|
+
# @!method ha(price_ohlc)
|
|
1738
|
+
# Heikin-Ashi Candles
|
|
1739
|
+
#
|
|
1740
|
+
# @param price_ohlc [Array(Array<Float>, Array<Float>, Array<Float>, Array<Float>)] Required price arrays: open, high, low, close
|
|
1741
|
+
# @return [Hash] Hash containing the following arrays:
|
|
1742
|
+
# @option result [Array<Float>] :ha_open Output values
|
|
1743
|
+
# @option result [Array<Float>] :ha_high Output values
|
|
1744
|
+
# @option result [Array<Float>] :ha_low Output values
|
|
1745
|
+
# @option result [Array<Float>] :ha_close Output values
|
|
1746
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1747
|
+
|
|
1748
|
+
# @!method hma(real, time_period: 20.0)
|
|
1749
|
+
# Hull Moving Average
|
|
1750
|
+
#
|
|
1751
|
+
# @param real [Array<Float>] Input values
|
|
1752
|
+
# @param time_period [Integer] Time period (default: 20.0)
|
|
1753
|
+
# @return [Array<Float>]
|
|
1754
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1755
|
+
|
|
1756
|
+
# @!method ht_dcperiod(real)
|
|
1757
|
+
# Hilbert Transform - Dominant Cycle Period
|
|
1758
|
+
#
|
|
1759
|
+
# @param real [Array<Float>] Input values
|
|
1760
|
+
# @return [Array<Float>]
|
|
1761
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1762
|
+
|
|
1763
|
+
# @!method ht_dcphase(real)
|
|
1764
|
+
# Hilbert Transform - Dominant Cycle Phase
|
|
1765
|
+
#
|
|
1766
|
+
# @param real [Array<Float>] Input values
|
|
1767
|
+
# @return [Array<Float>]
|
|
1768
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1769
|
+
|
|
1770
|
+
# @!method ht_phasor(real)
|
|
1771
|
+
# Hilbert Transform - Phasor Components
|
|
1772
|
+
#
|
|
1773
|
+
# @param real [Array<Float>] Input values
|
|
1774
|
+
# @return [Hash] Hash containing the following arrays:
|
|
1775
|
+
# @option result [Array<Float>] :in_phase Output values
|
|
1776
|
+
# @option result [Array<Float>] :quadrature Output values
|
|
1777
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1778
|
+
|
|
1779
|
+
# @!method ht_sine(real)
|
|
1780
|
+
# Hilbert Transform - SineWave
|
|
1781
|
+
#
|
|
1782
|
+
# @param real [Array<Float>] Input values
|
|
1783
|
+
# @return [Hash] Hash containing the following arrays:
|
|
1784
|
+
# @option result [Array<Float>] :sine Output values
|
|
1785
|
+
# @option result [Array<Float>] :lead_sine Output values
|
|
1786
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1787
|
+
|
|
1788
|
+
# @!method ht_trendline(real)
|
|
1789
|
+
# Hilbert Transform - Instantaneous Trendline
|
|
1790
|
+
#
|
|
1791
|
+
# @param real [Array<Float>] Input values
|
|
1792
|
+
# @return [Array<Float>]
|
|
1793
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1794
|
+
|
|
1795
|
+
# @!method ht_trendmode(real)
|
|
1796
|
+
# Hilbert Transform - Trend vs Cycle Mode
|
|
1797
|
+
#
|
|
1798
|
+
# @param real [Array<Float>] Input values
|
|
1799
|
+
# @return [Array<Integer>]
|
|
1800
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1801
|
+
|
|
1802
|
+
# @!method ibs(price_hlc)
|
|
1803
|
+
# Internal Bar Strength
|
|
1804
|
+
#
|
|
1805
|
+
# @param price_hlc [Array(Array<Float>, Array<Float>, Array<Float>)] Required price arrays: high, low, close
|
|
1806
|
+
# @return [Array<Float>]
|
|
1807
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1808
|
+
|
|
1809
|
+
# @!method ichimoku(price_hl, tenkan_period: 9.0, kijun_period: 26.0, senkou_b_period: 52.0)
|
|
1810
|
+
# Ichimoku Kinko Hyo
|
|
1811
|
+
#
|
|
1812
|
+
# @param price_hl [Array(Array<Float>, Array<Float>)] Required price arrays: high, low
|
|
1813
|
+
# @param tenkan_period [Integer] Period of the conversion line (default: 9.0)
|
|
1814
|
+
# @param kijun_period [Integer] Period of the base line, and the forward shift of the two spans (default: 26.0)
|
|
1815
|
+
# @param senkou_b_period [Integer] Period of the second leading span (default: 52.0)
|
|
1816
|
+
# @return [Hash] Hash containing the following arrays:
|
|
1817
|
+
# @option result [Array<Float>] :tenkan_sen Output values
|
|
1818
|
+
# @option result [Array<Float>] :kijun_sen Output values
|
|
1819
|
+
# @option result [Array<Float>] :senkou_span_a Output values
|
|
1820
|
+
# @option result [Array<Float>] :senkou_span_b Output values
|
|
1821
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1822
|
+
|
|
1823
|
+
# @!method imi(price_oc, time_period: 14.0)
|
|
1824
|
+
# Intraday Momentum Index
|
|
1825
|
+
#
|
|
1826
|
+
# @param price_oc [Array(Array<Float>, Array<Float>)] Required price arrays: open, close
|
|
1827
|
+
# @param time_period [Integer] Time period (default: 14.0)
|
|
1828
|
+
# @return [Array<Float>]
|
|
1829
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1830
|
+
|
|
1831
|
+
# @!method kama(real, time_period: 30.0)
|
|
1832
|
+
# Kaufman Adaptive Moving Average
|
|
1833
|
+
#
|
|
1834
|
+
# @param real [Array<Float>] Input values
|
|
1835
|
+
# @param time_period [Integer] Time period (default: 30.0)
|
|
1836
|
+
# @return [Array<Float>]
|
|
1837
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1838
|
+
|
|
1839
|
+
# @!method kc(price_hlc, time_period: 20.0, atr_period: 10.0, nb_dev: 2.0)
|
|
1840
|
+
# Keltner Channels
|
|
1841
|
+
#
|
|
1842
|
+
# @param price_hlc [Array(Array<Float>, Array<Float>, Array<Float>)] Required price arrays: high, low, close
|
|
1843
|
+
# @param time_period [Integer] Time period for the typical price moving average (default: 20.0)
|
|
1844
|
+
# @param atr_period [Integer] Time period for the Average True Range (default: 10.0)
|
|
1845
|
+
# @param nb_dev [Float] Multiplier applied to the Average True Range (default: 2.0)
|
|
1846
|
+
# @return [Hash] Hash containing the following arrays:
|
|
1847
|
+
# @option result [Array<Float>] :upper_band Output values
|
|
1848
|
+
# @option result [Array<Float>] :middle_band Output values
|
|
1849
|
+
# @option result [Array<Float>] :lower_band Output values
|
|
1850
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1851
|
+
|
|
1852
|
+
# @!method kdj(price_hlc, fast_k_period: 9.0, slow_k_period: 3.0, slow_k_ma_type: 13.0, slow_d_period: 3.0, slow_d_ma_type: 13.0)
|
|
1853
|
+
# KDJ Stochastic
|
|
1854
|
+
#
|
|
1855
|
+
# @param price_hlc [Array(Array<Float>, Array<Float>, Array<Float>)] Required price arrays: high, low, close
|
|
1856
|
+
# @param fast_k_period [Integer] Time period for building the Fast-K line (default: 9.0)
|
|
1857
|
+
# @param slow_k_period [Integer] Smoothing for making the Slow-K line. Usually set to 3 (default: 3.0)
|
|
1858
|
+
# @param slow_k_ma_type [Integer] Type of Moving Average for Slow-K (default: 13.0)
|
|
1859
|
+
# @param slow_d_period [Integer] Smoothing for making the Slow-D line (default: 3.0)
|
|
1860
|
+
# @param slow_d_ma_type [Integer] Type of Moving Average for Slow-D (default: 13.0)
|
|
1861
|
+
# @return [Hash] Hash containing the following arrays:
|
|
1862
|
+
# @option result [Array<Float>] :k Output values
|
|
1863
|
+
# @option result [Array<Float>] :d Output values
|
|
1864
|
+
# @option result [Array<Float>] :j Output values
|
|
1865
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1866
|
+
|
|
1867
|
+
# @!method kst(real, roc1_period: 10.0, roc2_period: 15.0, roc3_period: 20.0, roc4_period: 30.0, sma1_period: 10.0, sma2_period: 10.0, sma3_period: 10.0, sma4_period: 15.0, signal_period: 9.0)
|
|
1868
|
+
# Know Sure Thing (Pring)
|
|
1869
|
+
#
|
|
1870
|
+
# @param real [Array<Float>] Input values
|
|
1871
|
+
# @param roc1_period [Integer] Rate-of-change period of leg 1 (default: 10.0)
|
|
1872
|
+
# @param roc2_period [Integer] Rate-of-change period of leg 2 (default: 15.0)
|
|
1873
|
+
# @param roc3_period [Integer] Rate-of-change period of leg 3 (default: 20.0)
|
|
1874
|
+
# @param roc4_period [Integer] Rate-of-change period of leg 4 (default: 30.0)
|
|
1875
|
+
# @param sma1_period [Integer] Smoothing period of leg 1 (default: 10.0)
|
|
1876
|
+
# @param sma2_period [Integer] Smoothing period of leg 2 (default: 10.0)
|
|
1877
|
+
# @param sma3_period [Integer] Smoothing period of leg 3 (default: 10.0)
|
|
1878
|
+
# @param sma4_period [Integer] Smoothing period of leg 4 (default: 15.0)
|
|
1879
|
+
# @param signal_period [Integer] Smoothing period of the signal line (default: 9.0)
|
|
1880
|
+
# @return [Hash] Hash containing the following arrays:
|
|
1881
|
+
# @option result [Array<Float>] :kst Output values
|
|
1882
|
+
# @option result [Array<Float>] :kst_signal Output values
|
|
1883
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1884
|
+
|
|
1885
|
+
# @!method kstext(real, roc1_period: 10.0, roc2_period: 15.0, roc3_period: 20.0, roc4_period: 30.0, ma1_period: 10.0, ma2_period: 10.0, ma3_period: 10.0, ma4_period: 15.0, signal_period: 9.0, rocma_type: 0.0, signal_ma_type: 0.0)
|
|
1886
|
+
# Know Sure Thing with controllable MA type
|
|
1887
|
+
#
|
|
1888
|
+
# @param real [Array<Float>] Input values
|
|
1889
|
+
# @param roc1_period [Integer] Rate-of-change period of leg 1 (default: 10.0)
|
|
1890
|
+
# @param roc2_period [Integer] Rate-of-change period of leg 2 (default: 15.0)
|
|
1891
|
+
# @param roc3_period [Integer] Rate-of-change period of leg 3 (default: 20.0)
|
|
1892
|
+
# @param roc4_period [Integer] Rate-of-change period of leg 4 (default: 30.0)
|
|
1893
|
+
# @param ma1_period [Integer] Smoothing period of leg 1 (default: 10.0)
|
|
1894
|
+
# @param ma2_period [Integer] Smoothing period of leg 2 (default: 10.0)
|
|
1895
|
+
# @param ma3_period [Integer] Smoothing period of leg 3 (default: 10.0)
|
|
1896
|
+
# @param ma4_period [Integer] Smoothing period of leg 4 (default: 15.0)
|
|
1897
|
+
# @param signal_period [Integer] Smoothing period of the signal line (default: 9.0)
|
|
1898
|
+
# @param rocma_type [Integer] Type of Moving Average smoothing the four legs (default: 0.0)
|
|
1899
|
+
# @param signal_ma_type [Integer] Type of Moving Average for signal line (default: 0.0)
|
|
1900
|
+
# @return [Hash] Hash containing the following arrays:
|
|
1901
|
+
# @option result [Array<Float>] :kst Output values
|
|
1902
|
+
# @option result [Array<Float>] :kst_signal Output values
|
|
1903
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1904
|
+
|
|
1905
|
+
# @!method kurtosis(real, time_period: 30.0)
|
|
1906
|
+
# Rolling Excess Kurtosis
|
|
1907
|
+
#
|
|
1908
|
+
# @param real [Array<Float>] Input values
|
|
1909
|
+
# @param time_period [Integer] Time period (default: 30.0)
|
|
1910
|
+
# @return [Array<Float>]
|
|
1911
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1912
|
+
|
|
1913
|
+
# @!method kvo(price_hlcv, fast_period: 34.0, slow_period: 55.0, signal_period: 13.0)
|
|
1914
|
+
# Klinger Volume Oscillator
|
|
1915
|
+
#
|
|
1916
|
+
# @param price_hlcv [Array(Array<Float>, Array<Float>, Array<Float>, Array<Float>)] Required price arrays: high, low, close, volume
|
|
1917
|
+
# @param fast_period [Integer] Period of the faster smoothing of the volume force (default: 34.0)
|
|
1918
|
+
# @param slow_period [Integer] Period of the slower smoothing of the volume force (default: 55.0)
|
|
1919
|
+
# @param signal_period [Integer] Smoothing for the trigger line (default: 13.0)
|
|
1920
|
+
# @return [Hash] Hash containing the following arrays:
|
|
1921
|
+
# @option result [Array<Float>] :kvo Output values
|
|
1922
|
+
# @option result [Array<Float>] :kvo_signal Output values
|
|
1923
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1924
|
+
|
|
1925
|
+
# @!method linearreg(real, time_period: 14.0)
|
|
1926
|
+
# Linear Regression
|
|
1927
|
+
#
|
|
1928
|
+
# @param real [Array<Float>] Input values
|
|
1929
|
+
# @param time_period [Integer] Time period (default: 14.0)
|
|
1930
|
+
# @return [Array<Float>]
|
|
1931
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1932
|
+
|
|
1933
|
+
# @!method linearreg_angle(real, time_period: 14.0)
|
|
1934
|
+
# Linear Regression Angle
|
|
1935
|
+
#
|
|
1936
|
+
# @param real [Array<Float>] Input values
|
|
1937
|
+
# @param time_period [Integer] Time period (default: 14.0)
|
|
1938
|
+
# @return [Array<Float>]
|
|
1939
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1940
|
+
|
|
1941
|
+
# @!method linearreg_intercept(real, time_period: 14.0)
|
|
1942
|
+
# Linear Regression Intercept
|
|
1943
|
+
#
|
|
1944
|
+
# @param real [Array<Float>] Input values
|
|
1945
|
+
# @param time_period [Integer] Time period (default: 14.0)
|
|
1946
|
+
# @return [Array<Float>]
|
|
1947
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1948
|
+
|
|
1949
|
+
# @!method linearreg_slope(real, time_period: 14.0)
|
|
1950
|
+
# Linear Regression Slope
|
|
1951
|
+
#
|
|
1952
|
+
# @param real [Array<Float>] Input values
|
|
1953
|
+
# @param time_period [Integer] Time period (default: 14.0)
|
|
1954
|
+
# @return [Array<Float>]
|
|
1955
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1956
|
+
|
|
1957
|
+
# @!method ln(real)
|
|
1958
|
+
# Vector Log Natural
|
|
1959
|
+
#
|
|
1960
|
+
# @param real [Array<Float>] Input values
|
|
1961
|
+
# @return [Array<Float>]
|
|
1962
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1963
|
+
|
|
1964
|
+
# @!method log10(real)
|
|
1965
|
+
# Vector Log10
|
|
1966
|
+
#
|
|
1967
|
+
# @param real [Array<Float>] Input values
|
|
1968
|
+
# @return [Array<Float>]
|
|
1969
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1970
|
+
|
|
1971
|
+
# @!method ma(real, time_period: 30.0, ma_type: 0.0)
|
|
1972
|
+
# Moving average
|
|
1973
|
+
#
|
|
1974
|
+
# @param real [Array<Float>] Input values
|
|
1975
|
+
# @param time_period [Integer] Time period (default: 30.0)
|
|
1976
|
+
# @param ma_type [Integer] Type of Moving Average (default: 0.0)
|
|
1977
|
+
# @return [Array<Float>]
|
|
1978
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1979
|
+
|
|
1980
|
+
# @!method macd(real, fast_period: 12.0, slow_period: 26.0, signal_period: 9.0)
|
|
1981
|
+
# Moving Average Convergence/Divergence
|
|
1982
|
+
#
|
|
1983
|
+
# @param real [Array<Float>] Input values
|
|
1984
|
+
# @param fast_period [Integer] Period of the fast MA (default: 12.0)
|
|
1985
|
+
# @param slow_period [Integer] Period of the slow MA (default: 26.0)
|
|
1986
|
+
# @param signal_period [Integer] Smoothing for the signal line (period length) (default: 9.0)
|
|
1987
|
+
# @return [Hash] Hash containing the following arrays:
|
|
1988
|
+
# @option result [Array<Float>] :macd Output values
|
|
1989
|
+
# @option result [Array<Float>] :macd_signal Output values
|
|
1990
|
+
# @option result [Array<Float>] :macd_hist Output values
|
|
1991
|
+
# @raise [TALibError] If there is an error in function execution
|
|
1992
|
+
|
|
1993
|
+
# @!method macdext(real, fast_period: 12.0, fast_ma_type: 0.0, slow_period: 26.0, slow_ma_type: 0.0, signal_period: 9.0, signal_ma_type: 0.0)
|
|
1994
|
+
# MACD with controllable MA type
|
|
1995
|
+
#
|
|
1996
|
+
# @param real [Array<Float>] Input values
|
|
1997
|
+
# @param fast_period [Integer] Period of the fast MA (default: 12.0)
|
|
1998
|
+
# @param fast_ma_type [Integer] Type of Moving Average for fast MA (default: 0.0)
|
|
1999
|
+
# @param slow_period [Integer] Period of the slow MA (default: 26.0)
|
|
2000
|
+
# @param slow_ma_type [Integer] Type of Moving Average for slow MA (default: 0.0)
|
|
2001
|
+
# @param signal_period [Integer] Smoothing for the signal line (period length) (default: 9.0)
|
|
2002
|
+
# @param signal_ma_type [Integer] Type of Moving Average for signal line (default: 0.0)
|
|
2003
|
+
# @return [Hash] Hash containing the following arrays:
|
|
2004
|
+
# @option result [Array<Float>] :macd Output values
|
|
2005
|
+
# @option result [Array<Float>] :macd_signal Output values
|
|
2006
|
+
# @option result [Array<Float>] :macd_hist Output values
|
|
2007
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2008
|
+
|
|
2009
|
+
# @!method macdfix(real, signal_period: 9.0)
|
|
2010
|
+
# Moving Average Convergence/Divergence Fix 12/26
|
|
2011
|
+
#
|
|
2012
|
+
# @param real [Array<Float>] Input values
|
|
2013
|
+
# @param signal_period [Integer] Smoothing for the signal line (period length) (default: 9.0)
|
|
2014
|
+
# @return [Hash] Hash containing the following arrays:
|
|
2015
|
+
# @option result [Array<Float>] :macd Output values
|
|
2016
|
+
# @option result [Array<Float>] :macd_signal Output values
|
|
2017
|
+
# @option result [Array<Float>] :macd_hist Output values
|
|
2018
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2019
|
+
|
|
2020
|
+
# @!method mama(real, fast_limit: 0.5, slow_limit: 0.05)
|
|
2021
|
+
# MESA Adaptive Moving Average
|
|
2022
|
+
#
|
|
2023
|
+
# @param real [Array<Float>] Input values
|
|
2024
|
+
# @param fast_limit [Float] Upper limit use in the adaptive algorithm (default: 0.5)
|
|
2025
|
+
# @param slow_limit [Float] Lower limit use in the adaptive algorithm (default: 0.05)
|
|
2026
|
+
# @return [Hash] Hash containing the following arrays:
|
|
2027
|
+
# @option result [Array<Float>] :mama Output values
|
|
2028
|
+
# @option result [Array<Float>] :fama Output values
|
|
2029
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2030
|
+
|
|
2031
|
+
# @!method marketfi(price_hlv)
|
|
2032
|
+
# Market Facilitation Index
|
|
2033
|
+
#
|
|
2034
|
+
# @param price_hlv [Array(Array<Float>, Array<Float>, Array<Float>)] Required price arrays: high, low, volume
|
|
2035
|
+
# @return [Array<Float>]
|
|
2036
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2037
|
+
|
|
2038
|
+
# @!method massi(price_hl, fast_period: 9.0, slow_period: 25.0)
|
|
2039
|
+
# Mass Index
|
|
2040
|
+
#
|
|
2041
|
+
# @param price_hl [Array(Array<Float>, Array<Float>)] Required price arrays: high, low
|
|
2042
|
+
# @param fast_period [Integer] Period of both exponential averages of the high-low range (default: 9.0)
|
|
2043
|
+
# @param slow_period [Integer] Number of bars the ratio is summed over (default: 25.0)
|
|
2044
|
+
# @return [Array<Float>]
|
|
2045
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2046
|
+
|
|
2047
|
+
# @!method mavp(real, periods, min_period: 2.0, max_period: 30.0, ma_type: 0.0)
|
|
2048
|
+
# Moving average with variable period
|
|
2049
|
+
#
|
|
2050
|
+
# @param real [Array<Float>] Input values
|
|
2051
|
+
# @param periods [Array<Float>] Input values
|
|
2052
|
+
# @param min_period [Integer] Value less than minimum will be changed to Minimum period (default: 2.0)
|
|
2053
|
+
# @param max_period [Integer] Value higher than maximum will be changed to Maximum period (default: 30.0)
|
|
2054
|
+
# @param ma_type [Integer] Type of Moving Average (default: 0.0)
|
|
2055
|
+
# @return [Array<Float>]
|
|
2056
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2057
|
+
|
|
2058
|
+
# @!method max(real, time_period: 30.0)
|
|
2059
|
+
# Highest value over a specified period
|
|
2060
|
+
#
|
|
2061
|
+
# @param real [Array<Float>] Input values
|
|
2062
|
+
# @param time_period [Integer] Time period (default: 30.0)
|
|
2063
|
+
# @return [Array<Float>]
|
|
2064
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2065
|
+
|
|
2066
|
+
# @!method maxindex(real, time_period: 30.0)
|
|
2067
|
+
# Index of highest value over a specified period
|
|
2068
|
+
#
|
|
2069
|
+
# @param real [Array<Float>] Input values
|
|
2070
|
+
# @param time_period [Integer] Time period (default: 30.0)
|
|
2071
|
+
# @return [Array<Integer>]
|
|
2072
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2073
|
+
|
|
2074
|
+
# @!method mcgd(real, time_period: 14.0)
|
|
2075
|
+
# McGinley Dynamic
|
|
2076
|
+
#
|
|
2077
|
+
# @param real [Array<Float>] Input values
|
|
2078
|
+
# @param time_period [Integer] Time period (default: 14.0)
|
|
2079
|
+
# @return [Array<Float>]
|
|
2080
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2081
|
+
|
|
2082
|
+
# @!method median(real, time_period: 30.0)
|
|
2083
|
+
# Rolling Median
|
|
2084
|
+
#
|
|
2085
|
+
# @param real [Array<Float>] Input values
|
|
2086
|
+
# @param time_period [Integer] Number of bars in the window (default: 30.0)
|
|
2087
|
+
# @return [Array<Float>]
|
|
2088
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2089
|
+
|
|
2090
|
+
# @!method medprice(price_hl)
|
|
2091
|
+
# Median Price
|
|
2092
|
+
#
|
|
2093
|
+
# @param price_hl [Array(Array<Float>, Array<Float>)] Required price arrays: high, low
|
|
2094
|
+
# @return [Array<Float>]
|
|
2095
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2096
|
+
|
|
2097
|
+
# @!method mfi(price_hlcv, time_period: 14.0)
|
|
2098
|
+
# Money Flow Index
|
|
2099
|
+
#
|
|
2100
|
+
# @param price_hlcv [Array(Array<Float>, Array<Float>, Array<Float>, Array<Float>)] Required price arrays: high, low, close, volume
|
|
2101
|
+
# @param time_period [Integer] Time period (default: 14.0)
|
|
2102
|
+
# @return [Array<Float>]
|
|
2103
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2104
|
+
|
|
2105
|
+
# @!method midpoint(real, time_period: 14.0)
|
|
2106
|
+
# MidPoint over period
|
|
2107
|
+
#
|
|
2108
|
+
# @param real [Array<Float>] Input values
|
|
2109
|
+
# @param time_period [Integer] Time period (default: 14.0)
|
|
2110
|
+
# @return [Array<Float>]
|
|
2111
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2112
|
+
|
|
2113
|
+
# @!method midprice(price_hl, time_period: 14.0)
|
|
2114
|
+
# Midpoint Price over period
|
|
2115
|
+
#
|
|
2116
|
+
# @param price_hl [Array(Array<Float>, Array<Float>)] Required price arrays: high, low
|
|
2117
|
+
# @param time_period [Integer] Time period (default: 14.0)
|
|
2118
|
+
# @return [Array<Float>]
|
|
2119
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2120
|
+
|
|
2121
|
+
# @!method min(real, time_period: 30.0)
|
|
2122
|
+
# Lowest value over a specified period
|
|
2123
|
+
#
|
|
2124
|
+
# @param real [Array<Float>] Input values
|
|
2125
|
+
# @param time_period [Integer] Time period (default: 30.0)
|
|
2126
|
+
# @return [Array<Float>]
|
|
2127
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2128
|
+
|
|
2129
|
+
# @!method minindex(real, time_period: 30.0)
|
|
2130
|
+
# Index of lowest value over a specified period
|
|
2131
|
+
#
|
|
2132
|
+
# @param real [Array<Float>] Input values
|
|
2133
|
+
# @param time_period [Integer] Time period (default: 30.0)
|
|
2134
|
+
# @return [Array<Integer>]
|
|
2135
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2136
|
+
|
|
2137
|
+
# @!method minmax(real, time_period: 30.0)
|
|
2138
|
+
# Lowest and highest values over a specified period
|
|
2139
|
+
#
|
|
2140
|
+
# @param real [Array<Float>] Input values
|
|
2141
|
+
# @param time_period [Integer] Time period (default: 30.0)
|
|
2142
|
+
# @return [Hash] Hash containing the following arrays:
|
|
2143
|
+
# @option result [Array<Float>] :min Output values
|
|
2144
|
+
# @option result [Array<Float>] :max Output values
|
|
2145
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2146
|
+
|
|
2147
|
+
# @!method minmaxindex(real, time_period: 30.0)
|
|
2148
|
+
# Indexes of lowest and highest values over a specified period
|
|
2149
|
+
#
|
|
2150
|
+
# @param real [Array<Float>] Input values
|
|
2151
|
+
# @param time_period [Integer] Time period (default: 30.0)
|
|
2152
|
+
# @return [Hash] Hash containing the following arrays:
|
|
2153
|
+
# @option result [Array<Integer>] :min_idx Output values
|
|
2154
|
+
# @option result [Array<Integer>] :max_idx Output values
|
|
2155
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2156
|
+
|
|
2157
|
+
# @!method minus_di(price_hlc, time_period: 14.0)
|
|
2158
|
+
# Minus Directional Indicator
|
|
2159
|
+
#
|
|
2160
|
+
# @param price_hlc [Array(Array<Float>, Array<Float>, Array<Float>)] Required price arrays: high, low, close
|
|
2161
|
+
# @param time_period [Integer] Time period (default: 14.0)
|
|
2162
|
+
# @return [Array<Float>]
|
|
2163
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2164
|
+
|
|
2165
|
+
# @!method minus_dm(price_hl, time_period: 14.0)
|
|
2166
|
+
# Minus Directional Movement
|
|
2167
|
+
#
|
|
2168
|
+
# @param price_hl [Array(Array<Float>, Array<Float>)] Required price arrays: high, low
|
|
2169
|
+
# @param time_period [Integer] Time period (default: 14.0)
|
|
2170
|
+
# @return [Array<Float>]
|
|
2171
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2172
|
+
|
|
2173
|
+
# @!method mom(real, time_period: 10.0)
|
|
2174
|
+
# Momentum
|
|
2175
|
+
#
|
|
2176
|
+
# @param real [Array<Float>] Input values
|
|
2177
|
+
# @param time_period [Integer] Time period (default: 10.0)
|
|
2178
|
+
# @return [Array<Float>]
|
|
2179
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2180
|
+
|
|
2181
|
+
# @!method mult(real0, real1)
|
|
2182
|
+
# Vector Arithmetic Mult
|
|
2183
|
+
#
|
|
2184
|
+
# @param real0 [Array<Float>] Input values
|
|
2185
|
+
# @param real1 [Array<Float>] Input values
|
|
2186
|
+
# @return [Array<Float>]
|
|
2187
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2188
|
+
|
|
2189
|
+
# @!method natr(price_hlc, time_period: 14.0)
|
|
2190
|
+
# Normalized Average True Range
|
|
2191
|
+
#
|
|
2192
|
+
# @param price_hlc [Array(Array<Float>, Array<Float>, Array<Float>)] Required price arrays: high, low, close
|
|
2193
|
+
# @param time_period [Integer] Time period (default: 14.0)
|
|
2194
|
+
# @return [Array<Float>]
|
|
2195
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2196
|
+
|
|
2197
|
+
# @!method nvi(price_cv)
|
|
2198
|
+
# Negative Volume Index
|
|
2199
|
+
#
|
|
2200
|
+
# @param price_cv [Array(Array<Float>, Array<Float>)] Required price arrays: close, volume
|
|
2201
|
+
# @return [Array<Float>]
|
|
2202
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2203
|
+
|
|
2204
|
+
# @!method obv(real, price_v)
|
|
2205
|
+
# On Balance Volume
|
|
2206
|
+
#
|
|
2207
|
+
# @param real [Array<Float>] Input values
|
|
2208
|
+
# @param price_v [Array(Array<Float>)] Required price arrays: volume
|
|
2209
|
+
# @return [Array<Float>]
|
|
2210
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2211
|
+
|
|
2212
|
+
# @!method percentb(real, time_period: 20.0, nb_dev_up: 2.0, nb_dev_dn: 2.0, ma_type: 0.0)
|
|
2213
|
+
# Bollinger Bands %B
|
|
2214
|
+
#
|
|
2215
|
+
# @param real [Array<Float>] Input values
|
|
2216
|
+
# @param time_period [Integer] Time period (default: 20.0)
|
|
2217
|
+
# @param nb_dev_up [Float] Deviation multiplier for upper band (default: 2.0)
|
|
2218
|
+
# @param nb_dev_dn [Float] Deviation multiplier for lower band (default: 2.0)
|
|
2219
|
+
# @param ma_type [Integer] Type of Moving Average (default: 0.0)
|
|
2220
|
+
# @return [Array<Float>]
|
|
2221
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2222
|
+
|
|
2223
|
+
# @!method percentile(real, time_period: 100.0, percentile: 50.0)
|
|
2224
|
+
# Percentile (nearest rank)
|
|
2225
|
+
#
|
|
2226
|
+
# @param real [Array<Float>] Input values
|
|
2227
|
+
# @param time_period [Integer] Number of bars in the window (default: 100.0)
|
|
2228
|
+
# @param percentile [Float] Percentile to report (default: 50.0)
|
|
2229
|
+
# @return [Array<Float>]
|
|
2230
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2231
|
+
|
|
2232
|
+
# @!method percentrank(real, time_period: 100.0)
|
|
2233
|
+
# Percent Rank
|
|
2234
|
+
#
|
|
2235
|
+
# @param real [Array<Float>] Input values
|
|
2236
|
+
# @param time_period [Integer] Time period (default: 100.0)
|
|
2237
|
+
# @return [Array<Float>]
|
|
2238
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2239
|
+
|
|
2240
|
+
# @!method plus_di(price_hlc, time_period: 14.0)
|
|
2241
|
+
# Plus Directional Indicator
|
|
2242
|
+
#
|
|
2243
|
+
# @param price_hlc [Array(Array<Float>, Array<Float>, Array<Float>)] Required price arrays: high, low, close
|
|
2244
|
+
# @param time_period [Integer] Time period (default: 14.0)
|
|
2245
|
+
# @return [Array<Float>]
|
|
2246
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2247
|
+
|
|
2248
|
+
# @!method plus_dm(price_hl, time_period: 14.0)
|
|
2249
|
+
# Plus Directional Movement
|
|
2250
|
+
#
|
|
2251
|
+
# @param price_hl [Array(Array<Float>, Array<Float>)] Required price arrays: high, low
|
|
2252
|
+
# @param time_period [Integer] Time period (default: 14.0)
|
|
2253
|
+
# @return [Array<Float>]
|
|
2254
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2255
|
+
|
|
2256
|
+
# @!method ppo(real, fast_period: 12.0, slow_period: 26.0, ma_type: 1.0)
|
|
2257
|
+
# Percentage Price Oscillator
|
|
2258
|
+
#
|
|
2259
|
+
# @param real [Array<Float>] Input values
|
|
2260
|
+
# @param fast_period [Integer] Period of the fast MA (default: 12.0)
|
|
2261
|
+
# @param slow_period [Integer] Period of the slow MA (default: 26.0)
|
|
2262
|
+
# @param ma_type [Integer] Type of Moving Average (default: 1.0)
|
|
2263
|
+
# @return [Array<Float>]
|
|
2264
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2265
|
+
|
|
2266
|
+
# @!method pso(price_hlc, fast_k_period: 8.0, ema_period: 5.0)
|
|
2267
|
+
# Premier Stochastic Oscillator
|
|
2268
|
+
#
|
|
2269
|
+
# @param price_hlc [Array(Array<Float>, Array<Float>, Array<Float>)] Required price arrays: high, low, close
|
|
2270
|
+
# @param fast_k_period [Integer] Time period for building the Fast-K line (default: 8.0)
|
|
2271
|
+
# @param ema_period [Integer] Period of each of the two smoothing passes (default: 5.0)
|
|
2272
|
+
# @return [Array<Float>]
|
|
2273
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2274
|
+
|
|
2275
|
+
# @!method pvi(price_cv)
|
|
2276
|
+
# Positive Volume Index
|
|
2277
|
+
#
|
|
2278
|
+
# @param price_cv [Array(Array<Float>, Array<Float>)] Required price arrays: close, volume
|
|
2279
|
+
# @return [Array<Float>]
|
|
2280
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2281
|
+
|
|
2282
|
+
# @!method pvo(price_v, fast_period: 12.0, slow_period: 26.0, ma_type: 1.0)
|
|
2283
|
+
# Percentage Volume Oscillator
|
|
2284
|
+
#
|
|
2285
|
+
# @param price_v [Array(Array<Float>)] Required price arrays: volume
|
|
2286
|
+
# @param fast_period [Integer] Period of the fast MA (default: 12.0)
|
|
2287
|
+
# @param slow_period [Integer] Period of the slow MA (default: 26.0)
|
|
2288
|
+
# @param ma_type [Integer] Type of Moving Average (default: 1.0)
|
|
2289
|
+
# @return [Array<Float>]
|
|
2290
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2291
|
+
|
|
2292
|
+
# @!method pvt(price_cv)
|
|
2293
|
+
# Price Volume Trend
|
|
2294
|
+
#
|
|
2295
|
+
# @param price_cv [Array(Array<Float>, Array<Float>)] Required price arrays: close, volume
|
|
2296
|
+
# @return [Array<Float>]
|
|
2297
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2298
|
+
|
|
2299
|
+
# @!method qstick(price_oc, time_period: 10.0)
|
|
2300
|
+
# Qstick
|
|
2301
|
+
#
|
|
2302
|
+
# @param price_oc [Array(Array<Float>, Array<Float>)] Required price arrays: open, close
|
|
2303
|
+
# @param time_period [Integer] Time period (default: 10.0)
|
|
2304
|
+
# @return [Array<Float>]
|
|
2305
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2306
|
+
|
|
2307
|
+
# @!method rma(real, time_period: 30.0)
|
|
2308
|
+
# Wilder's Smoothed Moving Average
|
|
2309
|
+
#
|
|
2310
|
+
# @param real [Array<Float>] Input values
|
|
2311
|
+
# @param time_period [Integer] Time period (default: 30.0)
|
|
2312
|
+
# @return [Array<Float>]
|
|
2313
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2314
|
+
|
|
2315
|
+
# @!method roc(real, time_period: 10.0)
|
|
2316
|
+
# Rate of change : ((price/prevPrice)-1)*100
|
|
2317
|
+
#
|
|
2318
|
+
# @param real [Array<Float>] Input values
|
|
2319
|
+
# @param time_period [Integer] Time period (default: 10.0)
|
|
2320
|
+
# @return [Array<Float>]
|
|
2321
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2322
|
+
|
|
2323
|
+
# @!method rocp(real, time_period: 10.0)
|
|
2324
|
+
# Rate of change Percentage: (price-prevPrice)/prevPrice
|
|
2325
|
+
#
|
|
2326
|
+
# @param real [Array<Float>] Input values
|
|
2327
|
+
# @param time_period [Integer] Time period (default: 10.0)
|
|
2328
|
+
# @return [Array<Float>]
|
|
2329
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2330
|
+
|
|
2331
|
+
# @!method rocr(real, time_period: 10.0)
|
|
2332
|
+
# Rate of change ratio: (price/prevPrice)
|
|
2333
|
+
#
|
|
2334
|
+
# @param real [Array<Float>] Input values
|
|
2335
|
+
# @param time_period [Integer] Time period (default: 10.0)
|
|
2336
|
+
# @return [Array<Float>]
|
|
2337
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2338
|
+
|
|
2339
|
+
# @!method rocr100(real, time_period: 10.0)
|
|
2340
|
+
# Rate of change ratio 100 scale: (price/prevPrice)*100
|
|
2341
|
+
#
|
|
2342
|
+
# @param real [Array<Float>] Input values
|
|
2343
|
+
# @param time_period [Integer] Time period (default: 10.0)
|
|
2344
|
+
# @return [Array<Float>]
|
|
2345
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2346
|
+
|
|
2347
|
+
# @!method rogerssatchell(price_ohlc, time_period: 10.0, annualization: 252.0)
|
|
2348
|
+
# Rogers-Satchell Volatility
|
|
2349
|
+
#
|
|
2350
|
+
# @param price_ohlc [Array(Array<Float>, Array<Float>, Array<Float>, Array<Float>)] Required price arrays: open, high, low, close
|
|
2351
|
+
# @param time_period [Integer] Number of bars in the window (default: 10.0)
|
|
2352
|
+
# @param annualization [Float] Periods per year; 1 leaves the per-bar figure (default: 252.0)
|
|
2353
|
+
# @return [Array<Float>]
|
|
2354
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2355
|
+
|
|
2356
|
+
# @!method rsi(real, time_period: 14.0)
|
|
2357
|
+
# Relative Strength Index
|
|
2358
|
+
#
|
|
2359
|
+
# @param real [Array<Float>] Input values
|
|
2360
|
+
# @param time_period [Integer] Time period (default: 14.0)
|
|
2361
|
+
# @return [Array<Float>]
|
|
2362
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2363
|
+
|
|
2364
|
+
# @!method rvi(real, time_period: 14.0, std_dev_period: 10.0)
|
|
2365
|
+
# Relative Volatility Index
|
|
2366
|
+
#
|
|
2367
|
+
# @param real [Array<Float>] Input values
|
|
2368
|
+
# @param time_period [Integer] Time period of the Wilder smoothing applied to both legs (default: 14.0)
|
|
2369
|
+
# @param std_dev_period [Integer] Time period of the standard deviation (default: 10.0)
|
|
2370
|
+
# @return [Array<Float>]
|
|
2371
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2372
|
+
|
|
2373
|
+
# @!method rvir(price_hl, time_period: 14.0, std_dev_period: 10.0)
|
|
2374
|
+
# Relative Volatility Index, refined high/low form
|
|
2375
|
+
#
|
|
2376
|
+
# @param price_hl [Array(Array<Float>, Array<Float>)] Required price arrays: high, low
|
|
2377
|
+
# @param time_period [Integer] Time period of the Wilder smoothing applied to both indices (default: 14.0)
|
|
2378
|
+
# @param std_dev_period [Integer] Time period of the standard deviation (default: 10.0)
|
|
2379
|
+
# @return [Array<Float>]
|
|
2380
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2381
|
+
|
|
2382
|
+
# @!method rvol(price_v, time_period: 20.0)
|
|
2383
|
+
# Relative Volume
|
|
2384
|
+
#
|
|
2385
|
+
# @param price_v [Array(Array<Float>)] Required price arrays: volume
|
|
2386
|
+
# @param time_period [Integer] Time period (default: 20.0)
|
|
2387
|
+
# @return [Array<Float>]
|
|
2388
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2389
|
+
|
|
2390
|
+
# @!method sar(price_hl, acceleration: 0.02, maximum: 0.2)
|
|
2391
|
+
# Parabolic SAR
|
|
2392
|
+
#
|
|
2393
|
+
# @param price_hl [Array(Array<Float>, Array<Float>)] Required price arrays: high, low
|
|
2394
|
+
# @param acceleration [Float] Acceleration Factor used up to the Maximum value (default: 0.02)
|
|
2395
|
+
# @param maximum [Float] Acceleration Factor Maximum value (default: 0.2)
|
|
2396
|
+
# @return [Array<Float>]
|
|
2397
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2398
|
+
|
|
2399
|
+
# @!method sarext(price_hl, start_value: 0.0, offset_on_reverse: 0.0, acceleration_init_long: 0.02, acceleration_long: 0.02, acceleration_max_long: 0.2, acceleration_init_short: 0.02, acceleration_short: 0.02, acceleration_max_short: 0.2)
|
|
2400
|
+
# Parabolic SAR - Extended
|
|
2401
|
+
#
|
|
2402
|
+
# @param price_hl [Array(Array<Float>, Array<Float>)] Required price arrays: high, low
|
|
2403
|
+
# @param start_value [Float] Start value and direction. 0 for Auto, >0 for Long, <0 for Short (default: 0.0)
|
|
2404
|
+
# @param offset_on_reverse [Float] Percent offset added/removed to initial stop on short/long reversal (default: 0.0)
|
|
2405
|
+
# @param acceleration_init_long [Float] Acceleration Factor initial value for the Long direction (default: 0.02)
|
|
2406
|
+
# @param acceleration_long [Float] Acceleration Factor for the Long direction (default: 0.02)
|
|
2407
|
+
# @param acceleration_max_long [Float] Acceleration Factor maximum value for the Long direction (default: 0.2)
|
|
2408
|
+
# @param acceleration_init_short [Float] Acceleration Factor initial value for the Short direction (default: 0.02)
|
|
2409
|
+
# @param acceleration_short [Float] Acceleration Factor for the Short direction (default: 0.02)
|
|
2410
|
+
# @param acceleration_max_short [Float] Acceleration Factor maximum value for the Short direction (default: 0.2)
|
|
2411
|
+
# @return [Array<Float>]
|
|
2412
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2413
|
+
|
|
2414
|
+
# @!method si(price_ohlc, limit_move: 3.0)
|
|
2415
|
+
# Wilder Swing Index
|
|
2416
|
+
#
|
|
2417
|
+
# @param price_ohlc [Array(Array<Float>, Array<Float>, Array<Float>, Array<Float>)] Required price arrays: open, high, low, close
|
|
2418
|
+
# @param limit_move [Float] Largest one-bar price move the index is scaled against, in price units (default: 3.0)
|
|
2419
|
+
# @return [Array<Float>]
|
|
2420
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2421
|
+
|
|
2422
|
+
# @!method sin(real)
|
|
2423
|
+
# Vector Trigonometric Sin
|
|
2424
|
+
#
|
|
2425
|
+
# @param real [Array<Float>] Input values
|
|
2426
|
+
# @return [Array<Float>]
|
|
2427
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2428
|
+
|
|
2429
|
+
# @!method sinh(real)
|
|
2430
|
+
# Vector Trigonometric Sinh
|
|
2431
|
+
#
|
|
2432
|
+
# @param real [Array<Float>] Input values
|
|
2433
|
+
# @return [Array<Float>]
|
|
2434
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2435
|
+
|
|
2436
|
+
# @!method sma(real, time_period: 30.0)
|
|
2437
|
+
# Simple Moving Average
|
|
2438
|
+
#
|
|
2439
|
+
# @param real [Array<Float>] Input values
|
|
2440
|
+
# @param time_period [Integer] Time period (default: 30.0)
|
|
2441
|
+
# @return [Array<Float>]
|
|
2442
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2443
|
+
|
|
2444
|
+
# @!method smi(price_hlc, time_period: 13.0, fast_period: 2.0, slow_period: 25.0, signal_period: 9.0)
|
|
2445
|
+
# Stochastic Momentum Index
|
|
2446
|
+
#
|
|
2447
|
+
# @param price_hlc [Array(Array<Float>, Array<Float>, Array<Float>)] Required price arrays: high, low, close
|
|
2448
|
+
# @param time_period [Integer] Period of the high/low range (default: 13.0)
|
|
2449
|
+
# @param fast_period [Integer] Period of the second smoothing, applied to the first (default: 2.0)
|
|
2450
|
+
# @param slow_period [Integer] Period of the first smoothing, applied to the raw momentum (default: 25.0)
|
|
2451
|
+
# @param signal_period [Integer] Smoothing for the signal line (period length) (default: 9.0)
|
|
2452
|
+
# @return [Hash] Hash containing the following arrays:
|
|
2453
|
+
# @option result [Array<Float>] :smi Output values
|
|
2454
|
+
# @option result [Array<Float>] :smi_signal Output values
|
|
2455
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2456
|
+
|
|
2457
|
+
# @!method sqrt(real)
|
|
2458
|
+
# Vector Square Root
|
|
2459
|
+
#
|
|
2460
|
+
# @param real [Array<Float>] Input values
|
|
2461
|
+
# @return [Array<Float>]
|
|
2462
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2463
|
+
|
|
2464
|
+
# @!method sqzmom(price_hlc, bb_period: 20.0, nb_dev: 2.0, kc_period: 20.0, factor_wide: 2.0, factor_normal: 1.5, factor_narrow: 1.0)
|
|
2465
|
+
# Squeeze Momentum and Level
|
|
2466
|
+
#
|
|
2467
|
+
# @param price_hlc [Array(Array<Float>, Array<Float>, Array<Float>)] Required price arrays: high, low, close
|
|
2468
|
+
# @param bb_period [Integer] Period of the Bollinger Bands (default: 20.0)
|
|
2469
|
+
# @param nb_dev [Float] Deviation multiplier for both Bollinger Bands (default: 2.0)
|
|
2470
|
+
# @param kc_period [Integer] Period of the Keltner Channel, and of the momentum regression (default: 20.0)
|
|
2471
|
+
# @param factor_wide [Float] Keltner width for the widest compression test (default: 2.0)
|
|
2472
|
+
# @param factor_normal [Float] Keltner width for the classic squeeze test (default: 1.5)
|
|
2473
|
+
# @param factor_narrow [Float] Keltner width for the tightest compression test (default: 1.0)
|
|
2474
|
+
# @return [Hash] Hash containing the following arrays:
|
|
2475
|
+
# @option result [Array<Float>] :momentum Output values
|
|
2476
|
+
# @option result [Array<Integer>] :squeeze Output values
|
|
2477
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2478
|
+
|
|
2479
|
+
# @!method stc(real, fast_period: 23.0, slow_period: 50.0, cycle_period: 10.0)
|
|
2480
|
+
# Schaff Trend Cycle
|
|
2481
|
+
#
|
|
2482
|
+
# @param real [Array<Float>] Input values
|
|
2483
|
+
# @param fast_period [Integer] Period of the fast EMA (default: 23.0)
|
|
2484
|
+
# @param slow_period [Integer] Period of the slow EMA (default: 50.0)
|
|
2485
|
+
# @param cycle_period [Integer] Window of both stochastic stages (default: 10.0)
|
|
2486
|
+
# @return [Array<Float>]
|
|
2487
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2488
|
+
|
|
2489
|
+
# @!method stddev(real, time_period: 5.0, nb_dev: 1.0)
|
|
2490
|
+
# Standard Deviation
|
|
2491
|
+
#
|
|
2492
|
+
# @param real [Array<Float>] Input values
|
|
2493
|
+
# @param time_period [Integer] Time period (default: 5.0)
|
|
2494
|
+
# @param nb_dev [Float] Nb of deviations (default: 1.0)
|
|
2495
|
+
# @return [Array<Float>]
|
|
2496
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2497
|
+
|
|
2498
|
+
# @!method stoch(price_hlc, fast_k_period: 5.0, slow_k_period: 3.0, slow_k_ma_type: 0.0, slow_d_period: 3.0, slow_d_ma_type: 0.0)
|
|
2499
|
+
# Stochastic
|
|
2500
|
+
#
|
|
2501
|
+
# @param price_hlc [Array(Array<Float>, Array<Float>, Array<Float>)] Required price arrays: high, low, close
|
|
2502
|
+
# @param fast_k_period [Integer] Time period for building the Fast-K line (default: 5.0)
|
|
2503
|
+
# @param slow_k_period [Integer] Smoothing for making the Slow-K line. Usually set to 3 (default: 3.0)
|
|
2504
|
+
# @param slow_k_ma_type [Integer] Type of Moving Average for Slow-K (default: 0.0)
|
|
2505
|
+
# @param slow_d_period [Integer] Smoothing for making the Slow-D line (default: 3.0)
|
|
2506
|
+
# @param slow_d_ma_type [Integer] Type of Moving Average for Slow-D (default: 0.0)
|
|
2507
|
+
# @return [Hash] Hash containing the following arrays:
|
|
2508
|
+
# @option result [Array<Float>] :slow_k Output values
|
|
2509
|
+
# @option result [Array<Float>] :slow_d Output values
|
|
2510
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2511
|
+
|
|
2512
|
+
# @!method stochf(price_hlc, fast_k_period: 5.0, fast_d_period: 3.0, fast_d_ma_type: 0.0)
|
|
2513
|
+
# Stochastic Fast
|
|
2514
|
+
#
|
|
2515
|
+
# @param price_hlc [Array(Array<Float>, Array<Float>, Array<Float>)] Required price arrays: high, low, close
|
|
2516
|
+
# @param fast_k_period [Integer] Time period for building the Fast-K line (default: 5.0)
|
|
2517
|
+
# @param fast_d_period [Integer] Smoothing for making the Fast-D line. Usually set to 3 (default: 3.0)
|
|
2518
|
+
# @param fast_d_ma_type [Integer] Type of Moving Average for Fast-D (default: 0.0)
|
|
2519
|
+
# @return [Hash] Hash containing the following arrays:
|
|
2520
|
+
# @option result [Array<Float>] :fast_k Output values
|
|
2521
|
+
# @option result [Array<Float>] :fast_d Output values
|
|
2522
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2523
|
+
|
|
2524
|
+
# @!method stochrsi(real, time_period: 14.0, fast_k_period: 5.0, fast_d_period: 3.0, fast_d_ma_type: 0.0)
|
|
2525
|
+
# Stochastic Relative Strength Index
|
|
2526
|
+
#
|
|
2527
|
+
# @param real [Array<Float>] Input values
|
|
2528
|
+
# @param time_period [Integer] Time period (default: 14.0)
|
|
2529
|
+
# @param fast_k_period [Integer] Time period for building the Fast-K line (default: 5.0)
|
|
2530
|
+
# @param fast_d_period [Integer] Smoothing for making the Fast-D line. Usually set to 3 (default: 3.0)
|
|
2531
|
+
# @param fast_d_ma_type [Integer] Type of Moving Average for Fast-D (default: 0.0)
|
|
2532
|
+
# @return [Hash] Hash containing the following arrays:
|
|
2533
|
+
# @option result [Array<Float>] :fast_k Output values
|
|
2534
|
+
# @option result [Array<Float>] :fast_d Output values
|
|
2535
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2536
|
+
|
|
2537
|
+
# @!method sub(real0, real1)
|
|
2538
|
+
# Vector Arithmetic Subtraction
|
|
2539
|
+
#
|
|
2540
|
+
# @param real0 [Array<Float>] Input values
|
|
2541
|
+
# @param real1 [Array<Float>] Input values
|
|
2542
|
+
# @return [Array<Float>]
|
|
2543
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2544
|
+
|
|
2545
|
+
# @!method sum(real, time_period: 30.0)
|
|
2546
|
+
# Summation
|
|
2547
|
+
#
|
|
2548
|
+
# @param real [Array<Float>] Input values
|
|
2549
|
+
# @param time_period [Integer] Time period (default: 30.0)
|
|
2550
|
+
# @return [Array<Float>]
|
|
2551
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2552
|
+
|
|
2553
|
+
# @!method supertrend(price_hlc, time_period: 10.0, multiplier: 3.0)
|
|
2554
|
+
# SuperTrend
|
|
2555
|
+
#
|
|
2556
|
+
# @param price_hlc [Array(Array<Float>, Array<Float>, Array<Float>)] Required price arrays: high, low, close
|
|
2557
|
+
# @param time_period [Integer] Time period for the Average True Range (default: 10.0)
|
|
2558
|
+
# @param multiplier [Float] ATR multiplier for band width (default: 3.0)
|
|
2559
|
+
# @return [Hash] Hash containing the following arrays:
|
|
2560
|
+
# @option result [Array<Float>] :supertrend Output values
|
|
2561
|
+
# @option result [Array<Integer>] :trend Output values
|
|
2562
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2563
|
+
|
|
2564
|
+
# @!method swak_2php(real, time_period: 20.0)
|
|
2565
|
+
# Swiss Army Knife - Two-Pole High-Pass Filter
|
|
2566
|
+
#
|
|
2567
|
+
# @param real [Array<Float>] Input values
|
|
2568
|
+
# @param time_period [Integer] Cutoff period (default: 20.0)
|
|
2569
|
+
# @return [Array<Float>]
|
|
2570
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2571
|
+
|
|
2572
|
+
# @!method swak_bp(real, time_period: 20.0, delta: 0.1)
|
|
2573
|
+
# Swiss Army Knife - Band-Pass Filter
|
|
2574
|
+
#
|
|
2575
|
+
# @param real [Array<Float>] Input values
|
|
2576
|
+
# @param time_period [Integer] Center period (default: 20.0)
|
|
2577
|
+
# @param delta [Float] Half-bandwidth as a fraction of the center period (default: 0.1)
|
|
2578
|
+
# @return [Array<Float>]
|
|
2579
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2580
|
+
|
|
2581
|
+
# @!method swak_butter(real, time_period: 20.0)
|
|
2582
|
+
# Swiss Army Knife - Butterworth Filter
|
|
2583
|
+
#
|
|
2584
|
+
# @param real [Array<Float>] Input values
|
|
2585
|
+
# @param time_period [Integer] Cutoff period (default: 20.0)
|
|
2586
|
+
# @return [Array<Float>]
|
|
2587
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2588
|
+
|
|
2589
|
+
# @!method swak_gauss(real, time_period: 20.0)
|
|
2590
|
+
# Swiss Army Knife - Gaussian Filter
|
|
2591
|
+
#
|
|
2592
|
+
# @param real [Array<Float>] Input values
|
|
2593
|
+
# @param time_period [Integer] Cutoff period (default: 20.0)
|
|
2594
|
+
# @return [Array<Float>]
|
|
2595
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2596
|
+
|
|
2597
|
+
# @!method swak_hp(real, time_period: 20.0)
|
|
2598
|
+
# Swiss Army Knife - High-Pass Filter
|
|
2599
|
+
#
|
|
2600
|
+
# @param real [Array<Float>] Input values
|
|
2601
|
+
# @param time_period [Integer] Cutoff period (default: 20.0)
|
|
2602
|
+
# @return [Array<Float>]
|
|
2603
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2604
|
+
|
|
2605
|
+
# @!method t3(real, time_period: 5.0, v_factor: 0.7)
|
|
2606
|
+
# Triple Exponential Moving Average (T3)
|
|
2607
|
+
#
|
|
2608
|
+
# @param real [Array<Float>] Input values
|
|
2609
|
+
# @param time_period [Integer] Time period (default: 5.0)
|
|
2610
|
+
# @param v_factor [Float] Volume Factor (default: 0.7)
|
|
2611
|
+
# @return [Array<Float>]
|
|
2612
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2613
|
+
|
|
2614
|
+
# @!method tan(real)
|
|
2615
|
+
# Vector Trigonometric Tan
|
|
2616
|
+
#
|
|
2617
|
+
# @param real [Array<Float>] Input values
|
|
2618
|
+
# @return [Array<Float>]
|
|
2619
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2620
|
+
|
|
2621
|
+
# @!method tanh(real)
|
|
2622
|
+
# Vector Trigonometric Tanh
|
|
2623
|
+
#
|
|
2624
|
+
# @param real [Array<Float>] Input values
|
|
2625
|
+
# @return [Array<Float>]
|
|
2626
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2627
|
+
|
|
2628
|
+
# @!method tema(real, time_period: 30.0)
|
|
2629
|
+
# Triple Exponential Moving Average
|
|
2630
|
+
#
|
|
2631
|
+
# @param real [Array<Float>] Input values
|
|
2632
|
+
# @param time_period [Integer] Time period (default: 30.0)
|
|
2633
|
+
# @return [Array<Float>]
|
|
2634
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2635
|
+
|
|
2636
|
+
# @!method trange(price_hlc)
|
|
2637
|
+
# True Range
|
|
2638
|
+
#
|
|
2639
|
+
# @param price_hlc [Array(Array<Float>, Array<Float>, Array<Float>)] Required price arrays: high, low, close
|
|
2640
|
+
# @return [Array<Float>]
|
|
2641
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2642
|
+
|
|
2643
|
+
# @!method trima(real, time_period: 30.0)
|
|
2644
|
+
# Triangular Moving Average
|
|
2645
|
+
#
|
|
2646
|
+
# @param real [Array<Float>] Input values
|
|
2647
|
+
# @param time_period [Integer] Time period (default: 30.0)
|
|
2648
|
+
# @return [Array<Float>]
|
|
2649
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2650
|
+
|
|
2651
|
+
# @!method trix(real, time_period: 30.0)
|
|
2652
|
+
# 1-day Rate-Of-Change (ROC) of a Triple Smooth EMA
|
|
2653
|
+
#
|
|
2654
|
+
# @param real [Array<Float>] Input values
|
|
2655
|
+
# @param time_period [Integer] Time period (default: 30.0)
|
|
2656
|
+
# @return [Array<Float>]
|
|
2657
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2658
|
+
|
|
2659
|
+
# @!method tsf(real, time_period: 14.0)
|
|
2660
|
+
# Time Series Forecast
|
|
2661
|
+
#
|
|
2662
|
+
# @param real [Array<Float>] Input values
|
|
2663
|
+
# @param time_period [Integer] Time period (default: 14.0)
|
|
2664
|
+
# @return [Array<Float>]
|
|
2665
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2666
|
+
|
|
2667
|
+
# @!method tsi(real, first_period: 25.0, second_period: 13.0)
|
|
2668
|
+
# True Strength Index
|
|
2669
|
+
#
|
|
2670
|
+
# @param real [Array<Float>] Input values
|
|
2671
|
+
# @param first_period [Integer] Period of the first smoothing, applied to the raw momentum (default: 25.0)
|
|
2672
|
+
# @param second_period [Integer] Period of the second smoothing, applied to the first (default: 13.0)
|
|
2673
|
+
# @return [Array<Float>]
|
|
2674
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2675
|
+
|
|
2676
|
+
# @!method typprice(price_hlc)
|
|
2677
|
+
# Typical Price
|
|
2678
|
+
#
|
|
2679
|
+
# @param price_hlc [Array(Array<Float>, Array<Float>, Array<Float>)] Required price arrays: high, low, close
|
|
2680
|
+
# @return [Array<Float>]
|
|
2681
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2682
|
+
|
|
2683
|
+
# @!method ultosc(price_hlc, time_period1: 7.0, time_period2: 14.0, time_period3: 28.0)
|
|
2684
|
+
# Ultimate Oscillator
|
|
2685
|
+
#
|
|
2686
|
+
# @param price_hlc [Array(Array<Float>, Array<Float>, Array<Float>)] Required price arrays: high, low, close
|
|
2687
|
+
# @param time_period1 [Integer] Number of bars for 1st period. (default: 7.0)
|
|
2688
|
+
# @param time_period2 [Integer] Number of bars fro 2nd period (default: 14.0)
|
|
2689
|
+
# @param time_period3 [Integer] Number of bars for 3rd period (default: 28.0)
|
|
2690
|
+
# @return [Array<Float>]
|
|
2691
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2692
|
+
|
|
2693
|
+
# @!method var(real, time_period: 5.0, nb_dev: 1.0)
|
|
2694
|
+
# Variance
|
|
2695
|
+
#
|
|
2696
|
+
# @param real [Array<Float>] Input values
|
|
2697
|
+
# @param time_period [Integer] Time period (default: 5.0)
|
|
2698
|
+
# @param nb_dev [Float] Nb of deviations (default: 1.0)
|
|
2699
|
+
# @return [Array<Float>]
|
|
2700
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2701
|
+
|
|
2702
|
+
# @!method vhf(real, time_period: 28.0)
|
|
2703
|
+
# Vertical Horizontal Filter
|
|
2704
|
+
#
|
|
2705
|
+
# @param real [Array<Float>] Input values
|
|
2706
|
+
# @param time_period [Integer] Time period (default: 28.0)
|
|
2707
|
+
# @return [Array<Float>]
|
|
2708
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2709
|
+
|
|
2710
|
+
# @!method vidya(real, time_period: 12.0, cmo_period: 9.0)
|
|
2711
|
+
# Variable Index Dynamic Average
|
|
2712
|
+
#
|
|
2713
|
+
# @param real [Array<Float>] Input values
|
|
2714
|
+
# @param time_period [Integer] EMA-equivalent smoothing period, alpha = 2/(n+1) (default: 12.0)
|
|
2715
|
+
# @param cmo_period [Integer] Period of the unsmoothed CMO that scales alpha (default: 9.0)
|
|
2716
|
+
# @return [Array<Float>]
|
|
2717
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2718
|
+
|
|
2719
|
+
# @!method vortex(price_hlc, time_period: 14.0)
|
|
2720
|
+
# Vortex Indicator
|
|
2721
|
+
#
|
|
2722
|
+
# @param price_hlc [Array(Array<Float>, Array<Float>, Array<Float>)] Required price arrays: high, low, close
|
|
2723
|
+
# @param time_period [Integer] Number of bars in the rolling sums (default: 14.0)
|
|
2724
|
+
# @return [Hash] Hash containing the following arrays:
|
|
2725
|
+
# @option result [Array<Float>] :plus_vi Output values
|
|
2726
|
+
# @option result [Array<Float>] :minus_vi Output values
|
|
2727
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2728
|
+
|
|
2729
|
+
# @!method vwap(price_hlcv)
|
|
2730
|
+
# Volume Weighted Average Price
|
|
2731
|
+
#
|
|
2732
|
+
# @param price_hlcv [Array(Array<Float>, Array<Float>, Array<Float>, Array<Float>)] Required price arrays: high, low, close, volume
|
|
2733
|
+
# @return [Array<Float>]
|
|
2734
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2735
|
+
|
|
2736
|
+
# @!method vwma(real, price_v, time_period: 30.0)
|
|
2737
|
+
# Volume Weighted Moving Average
|
|
2738
|
+
#
|
|
2739
|
+
# @param real [Array<Float>] Input values
|
|
2740
|
+
# @param price_v [Array(Array<Float>)] Required price arrays: volume
|
|
2741
|
+
# @param time_period [Integer] Time period (default: 30.0)
|
|
2742
|
+
# @return [Array<Float>]
|
|
2743
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2744
|
+
|
|
2745
|
+
# @!method wad(price_hlc)
|
|
2746
|
+
# Williams' Accumulation/Distribution
|
|
2747
|
+
#
|
|
2748
|
+
# @param price_hlc [Array(Array<Float>, Array<Float>, Array<Float>)] Required price arrays: high, low, close
|
|
2749
|
+
# @return [Array<Float>]
|
|
2750
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2751
|
+
|
|
2752
|
+
# @!method wavetrend(price_hlc, channel_period: 10.0, average_period: 21.0, signal_period: 4.0)
|
|
2753
|
+
# WaveTrend Oscillator
|
|
2754
|
+
#
|
|
2755
|
+
# @param price_hlc [Array(Array<Float>, Array<Float>, Array<Float>)] Required price arrays: high, low, close
|
|
2756
|
+
# @param channel_period [Integer] Period of the price channel, used by both the average and the deviation (default: 10.0)
|
|
2757
|
+
# @param average_period [Integer] Smoothing for the oscillator line (default: 21.0)
|
|
2758
|
+
# @param signal_period [Integer] Simple average of the oscillator line, making the signal line (default: 4.0)
|
|
2759
|
+
# @return [Hash] Hash containing the following arrays:
|
|
2760
|
+
# @option result [Array<Float>] :wt1 Output values
|
|
2761
|
+
# @option result [Array<Float>] :wt2 Output values
|
|
2762
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2763
|
+
|
|
2764
|
+
# @!method wclprice(price_hlc)
|
|
2765
|
+
# Weighted Close Price
|
|
2766
|
+
#
|
|
2767
|
+
# @param price_hlc [Array(Array<Float>, Array<Float>, Array<Float>)] Required price arrays: high, low, close
|
|
2768
|
+
# @return [Array<Float>]
|
|
2769
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2770
|
+
|
|
2771
|
+
# @!method willr(price_hlc, time_period: 14.0)
|
|
2772
|
+
# Williams' %R
|
|
2773
|
+
#
|
|
2774
|
+
# @param price_hlc [Array(Array<Float>, Array<Float>, Array<Float>)] Required price arrays: high, low, close
|
|
2775
|
+
# @param time_period [Integer] Time period (default: 14.0)
|
|
2776
|
+
# @return [Array<Float>]
|
|
2777
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2778
|
+
|
|
2779
|
+
# @!method wma(real, time_period: 30.0)
|
|
2780
|
+
# Weighted Moving Average
|
|
2781
|
+
#
|
|
2782
|
+
# @param real [Array<Float>] Input values
|
|
2783
|
+
# @param time_period [Integer] Time period (default: 30.0)
|
|
2784
|
+
# @return [Array<Float>]
|
|
2785
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2786
|
+
|
|
2787
|
+
# @!method zigzag(price_hl, sensitivity: 5.0, min_trend_length: 1.0)
|
|
2788
|
+
# Zig Zag
|
|
2789
|
+
#
|
|
2790
|
+
# @param price_hl [Array(Array<Float>, Array<Float>)] Required price arrays: high, low
|
|
2791
|
+
# @param sensitivity [Float] Minimum move away from the current extreme that reverses the leg, in percent (default: 5.0)
|
|
2792
|
+
# @param min_trend_length [Integer] Minimum number of bars between two pivots (default: 1.0)
|
|
2793
|
+
# @return [Hash] Hash containing the following arrays:
|
|
2794
|
+
# @option result [Array<Float>] :zig_zag Output values
|
|
2795
|
+
# @option result [Array<Integer>] :trend Output values
|
|
2796
|
+
# @option result [Array<Integer>] :pivot_idx Output values
|
|
2797
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2798
|
+
|
|
2799
|
+
# @!method zlema(real, time_period: 30.0)
|
|
2800
|
+
# Zero-Lag Exponential Moving Average
|
|
2801
|
+
#
|
|
2802
|
+
# @param real [Array<Float>] Input values
|
|
2803
|
+
# @param time_period [Integer] Time period (default: 30.0)
|
|
2804
|
+
# @return [Array<Float>]
|
|
2805
|
+
# @raise [TALibError] If there is an error in function execution
|
|
2806
|
+
|
|
2807
|
+
### GENERATED DOCUMENTATION END ###
|
|
2808
|
+
end
|
|
661
2809
|
end
|