Sha256: 08b133e89df480ee5e4cf6e449fb570ed972294945e7b19be2f5d6c9259488d8

Contents?: true

Size: 513 Bytes

Versions: 21

Compression:

Stored size: 513 Bytes

Contents

# lib/sqa/indicator/head_and_shoulders_pattern.rb

class SQA::Indicator; class << self


  def head_and_shoulders_pattern?(
        prices  # Array of prices
      )

    return false if prices.length < 5

    data            = prices.last(5)

    left_shoulder   = data[0]
    head            = data[1]
    right_shoulder  = data[2]
    neckline        = data[3]
    right_peak      = data[4]

    head        > left_shoulder   &&
    head        > right_shoulder  &&
    right_peak  < neckline
  end

end; end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
sqa-0.0.24 lib/sqa/indicator/head_and_shoulders_pattern.rb
sqa-0.0.22 lib/sqa/indicator/head_and_shoulders_pattern.rb
sqa-0.0.21 lib/sqa/indicator/head_and_shoulders_pattern.rb
sqa-0.0.20 lib/sqa/indicator/head_and_shoulders_pattern.rb
sqa-0.0.19 lib/sqa/indicator/head_and_shoulders_pattern.rb
sqa-0.0.18 lib/sqa/indicator/head_and_shoulders_pattern.rb
sqa-0.0.17 lib/sqa/indicator/head_and_shoulders_pattern.rb
sqa-0.0.15 lib/sqa/indicator/head_and_shoulders_pattern.rb
sqa-0.0.14 lib/sqa/indicator/head_and_shoulders_pattern.rb
sqa-0.0.13 lib/sqa/indicator/head_and_shoulders_pattern.rb
sqa-0.0.12 lib/sqa/indicator/head_and_shoulders_pattern.rb
sqa-0.0.11 lib/sqa/indicator/head_and_shoulders_pattern.rb
sqa-0.0.10 lib/sqa/indicator/head_and_shoulders_pattern.rb
sqa-0.0.9 lib/sqa/indicator/head_and_shoulders_pattern.rb
sqa-0.0.8 lib/sqa/indicator/head_and_shoulders_pattern.rb
sqa-0.0.7 lib/sqa/indicator/head_and_shoulders_pattern.rb
sqa-0.0.6 lib/sqa/indicator/head_and_shoulders_pattern.rb
sqa-0.0.5 lib/sqa/indicator/head_and_shoulders_pattern.rb
sqa-0.0.4 lib/sqa/indicator/head_and_shoulders_pattern.rb
sqa-0.0.3 lib/sqa/indicator/head_and_shoulders_pattern.rb