Class: TechnicalAnalysis::Adx::AdxValue

Inherits:
Object
  • Object
show all
Defined in:
lib/technical_analysis/indicators/adx.rb

Overview

The value class to be returned by calculations

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(date_time: nil, adx: nil, di_pos: nil, di_neg: nil) ⇒ AdxValue

Returns a new instance of AdxValue.



153
154
155
156
157
158
# File 'lib/technical_analysis/indicators/adx.rb', line 153

def initialize(date_time: nil, adx: nil, di_pos: nil, di_neg: nil)
  @date_time = date_time
  @adx = adx
  @di_pos = di_pos
  @di_neg = di_neg
end

Instance Attribute Details

#adxFloat

Returns the adx calculation value.

Returns:

  • (Float)

    the adx calculation value



145
146
147
# File 'lib/technical_analysis/indicators/adx.rb', line 145

def adx
  @adx
end

#date_timeString

Returns the date_time of the obversation as it was provided.

Returns:

  • (String)

    the date_time of the obversation as it was provided



142
143
144
# File 'lib/technical_analysis/indicators/adx.rb', line 142

def date_time
  @date_time
end

#di_negFloat

Returns the negative directional indicator calculation value.

Returns:

  • (Float)

    the negative directional indicator calculation value



151
152
153
# File 'lib/technical_analysis/indicators/adx.rb', line 151

def di_neg
  @di_neg
end

#di_posFloat

Returns the positive directional indicator calculation value.

Returns:

  • (Float)

    the positive directional indicator calculation value



148
149
150
# File 'lib/technical_analysis/indicators/adx.rb', line 148

def di_pos
  @di_pos
end

Instance Method Details

#to_hashHash

Returns the attributes as a hash.

Returns:

  • (Hash)

    the attributes as a hash



161
162
163
# File 'lib/technical_analysis/indicators/adx.rb', line 161

def to_hash
  { date_time: @date_time, adx: @adx, di_pos: @di_pos, di_neg: @di_neg }
end