etfdiction/app/models/etf.rb
def price_above_sma?(period)
    records_close = get_latest_records(:close, 3)
    sma_for_period = current_sma(period)

    return records_close.all? {|close| close > sma_for_period}
  end
# Last three prices should be above given sma
Last three prices should be above given sma
Last three prices should be above given sma
def price_above_sma?(period)
    records_close = get_latest_records(:close, 3)
    sma_for_period = current_sma(period)
    return records_close.all? {|close| close > sma_for_period}
  end
def price_above_sma? ( period ) records_close = get_latest_records ( :close , 3 ) sma_for_period = current_sma ( period ) return records_close . all? { | close | close > sma_for_period } end
Last three prices should be above given sma
Last three prices should be above given sma
period