Module: MyTradeWizard::TechnicalIndicator

Included in:
TradingSystem
Defined in:
lib/mytradewizard/technical_indicator.rb

Instance Method Summary collapse

Instance Method Details

#SMA(bars) ⇒ Object



4
5
6
7
8
9
10
11
12
# File 'lib/mytradewizard/technical_indicator.rb', line 4

def SMA(bars)
  x = 0
  n = 0
  bars.each do |bar|
    x += bar.close
    n += 1
  end
  return x / n
end