Class: Quant::Indicators::Pivots::Camarilla

Inherits:
Pivot show all
Defined in:
lib/quant/indicators/pivots/camarilla.rb

Overview

Camarilla pivot point calculations are rather straightforward. We need to input the previous day’s open, high, low and close. The formulas for each resistance and support level are:

R4 = Closing + ((High -Low) x 1.5000) R3 = Closing + ((High -Low) x 1.2500) R2 = Closing + ((High -Low) x 1.1666) R1 = Closing + ((High -Low x 1.0833) PP = (High + Low + Closing) / 3 S1 = Closing – ((High -Low) x 1.0833) S2 = Closing – ((High -Low) x 1.1666) S3 = Closing – ((High -Low) x 1.2500) S4 = Closing – ((High-Low) x 1.5000)

R5 = R4 + 1.168 * (R4 – R3) R6 = (High/Low) * Close S5 = S4 – 1.168 * (S3 – S4) S6 = Close – (R6 – Close)

The calculation for further resistance and support levels varies from this norm. These levels can come into play during strong trend moves, so it’s important to understand how to identify them. For example, R5, R6, S5 and S6 are calculated as follows:

source: tradingstrategyguides.com/camarilla-pivot-trading-strategy/

Constant Summary

Constants inherited from Indicator

Indicator::PRIORITIES

Constants included from Mixins::UniversalFilters

Mixins::UniversalFilters::K

Instance Attribute Summary

Attributes inherited from Indicator

#p0, #p1, #p2, #p3, #series, #source, #t0, #t1, #t2, #t3

Instance Method Summary collapse

Methods inherited from Pivot

#averaging_period, #band?, #compute, #compute_extents, #compute_value, #period, #period_midpoints, #points_class, #smoothed_average_midpoint

Methods inherited from Indicator

#<<, #[], #adaptive_half_period, #adaptive_period, #compute, dependent_indicator_classes, depends_on, #dominant_cycle, #dominant_cycle_indicator_class, #dominant_cycle_kind, #each, #half_period, #indicator_name, #initialize, #input, #inspect, #max_period, #micro_period, #min_period, #p, #period_points, #pivot_kind, #points_class, #priority, register, #size, #t, #ticks, #values, #warmed_up?

Methods included from Mixins::FisherTransform

#fisher_transform, #inverse_fisher_transform, #relative_fisher_transform

Methods included from Mixins::Stochastic

#stochastic

Methods included from Mixins::SuperSmoother

#three_pole_super_smooth, #two_pole_super_smooth

Methods included from Mixins::HilbertTransform

#hilbert_transform

Methods included from Mixins::ExponentialMovingAverage

#exponential_moving_average

Methods included from Mixins::SimpleMovingAverage

#simple_moving_average

Methods included from Mixins::WeightedMovingAverage

#extended_weighted_moving_average, #weighted_moving_average

Methods included from Mixins::UniversalFilters

#universal_band_pass, #universal_ema, #universal_filter, #universal_one_pole_high_pass, #universal_one_pole_low_pass, #universal_two_pole_high_pass, #universal_two_pole_low_pass

Methods included from Mixins::ButterworthFilters

#three_pole_butterworth, #two_pole_butterworth

Methods included from Mixins::HighPassFilters

#high_pass_filter, #hpf2, #two_pole_high_pass_filter

Methods included from Mixins::Functions

#angle, #bars_to_alpha, #deg2rad, #period_to_alpha, #rad2deg

Constructor Details

This class inherits a constructor from Quant::Indicators::Indicator

Instance Method Details

#compute_bandsObject



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/quant/indicators/pivots/camarilla.rb', line 38

def compute_bands
  p0.h1 = t0.close_price + p0.range * 1.083
  p0.l1 = t0.close_price - p0.range * 1.083

  p0.h2 = t0.close_price + p0.range * 1.167
  p0.l2 = t0.close_price - p0.range * 1.167

  p0.h3 = t0.close_price + p0.range * 1.250
  p0.l3 = t0.close_price - p0.range * 1.250

  p0.h4 = t0.close_price + p0.range * 1.500
  p0.l4 = t0.close_price - p0.range * 1.500

  p0.h5 = p0.h4 + 1.68 * (p0.h4 - p0.h3)
  p0.l5 = p0.l4 - 1.68 * (p0.l3 - p0.l4)

  p0.h6 = (t0.high_price / t0.low_price) * t0.close_price
  p0.l6 = t0.close_price - (p0.h6 - t0.close_price)
end

#compute_midpointObject



34
35
36
# File 'lib/quant/indicators/pivots/camarilla.rb', line 34

def compute_midpoint
  p0.midpoint = t0.hlc3
end