Sha256: 27e028904a31320abe6f970c4647efd82c9e71b3a1230e7e347e24f81ed76db4

Contents?: true

Size: 1.59 KB

Versions: 1

Compression:

Stored size: 1.59 KB

Contents

require 'common_requires'

class TestDonchianChannel < MiniTest::Unit::TestCase

  def test_eurusd_50_donchian_channel_20_highs
    c = Util.ohlc(Samples::Ohlc.eurusd_50_opens, Samples::Ohlc.eurusd_50_highs, Samples::Ohlc.eurusd_50_lows, Samples::Ohlc.eurusd_50_closes)
    dc20_highs = Quant.donchian_channel(c, 20).inject([]) { |a, e| a << e[0] }
    assert Util.compare_2_arrays_of_floats dc20_highs , Samples::Ttr.eurusd_50_ttr_donchian_channel_20_highs
  end

  def test_eurusd_50_donchian_channel_20_lows
    c = Util.ohlc(Samples::Ohlc.eurusd_50_opens, Samples::Ohlc.eurusd_50_highs, Samples::Ohlc.eurusd_50_lows, Samples::Ohlc.eurusd_50_closes)
    dc20_lows = Quant.donchian_channel(c, 20).inject([]) { |a, e| a << e[1] }
    assert Util.compare_2_arrays_of_floats dc20_lows , Samples::Ttr.eurusd_50_ttr_donchian_channel_20_lows
  end

  def test_usdjpy_150_donchian_channel_55_highs
    c = Util.ohlc(Samples::Ohlc.usdjpy_150_opens, Samples::Ohlc.usdjpy_150_highs, Samples::Ohlc.usdjpy_150_lows, Samples::Ohlc.usdjpy_150_closes)
    dc55_highs = Quant.donchian_channel(c, 55).inject([]) { |a, e| a << e[0] }
    assert Util.compare_2_arrays_of_floats dc55_highs , Samples::Ttr.usdjpy_150_ttr_donchian_channel_55_highs
  end

  def test_usdjpy_150_donchian_channel_55_lows
    c = Util.ohlc(Samples::Ohlc.usdjpy_150_opens, Samples::Ohlc.usdjpy_150_highs, Samples::Ohlc.usdjpy_150_lows, Samples::Ohlc.usdjpy_150_closes)
    dc55_lows = Quant.donchian_channel(c, 55).inject([]) { |a, e| a << e[1] }
    assert Util.compare_2_arrays_of_floats dc55_lows , Samples::Ttr.usdjpy_150_ttr_donchian_channel_55_lows
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
quant-0.0.3 test/test_donchian_channel.rb