Module: TechnicalAnalysis::BarCalculation

Included in:
IB::Bar
Defined in:
lib/calculation_helpers.rb

Instance Method Summary collapse

Instance Method Details

#true_range(previous_close) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/calculation_helpers.rb', line 6

def true_range previous_close
  [
    (high - low),
    (high - previous_close).abs,
    (low - previous_close).abs
  ].max
end

#typical_priceObject



14
15
16
# File 'lib/calculation_helpers.rb', line 14

def typical_price
  ( high + low + close ) / 3.0
end