Class: Quant::Indicators::Pivots::Camarilla
- 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 = Close + (High – Low) * 1.1/2 R3 = Close + (High – Low) * 1.1/4 R2 = Close + (High – Low) * 1.1/6 R1 = Close + (High – Low) * 1.1/12 S1 = Close – (High – Low) * 1.1/12 S2 = Close – (High – Low) * 1.1/6 S3 = Close – (High – Low) * 1.1/4 S4 = Close – (High – Low) * 1.1/2
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:
R5 = R4 + 1.168 * (R4 – R3) R6 = (High/Low) * Close
S5 = S4 – 1.168 * (S3 – S4) S6 = Close – (R6 – Close)
Constant Summary
Constants inherited from Indicator
Constants included from Mixins::UniversalFilters
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
Methods inherited from Indicator
#<<, #[], #compute, #dc_period, 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
Methods included from Mixins::FisherTransform
#fisher_transform, #inverse_fisher_transform, #relative_fisher_transform
Methods included from Mixins::Stochastic
Methods included from Mixins::SuperSmoother
#three_pole_super_smooth, #two_pole_super_smooth
Methods included from Mixins::HilbertTransform
Methods included from Mixins::ExponentialMovingAverage
Methods included from Mixins::SimpleMovingAverage
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_bands ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/quant/indicators/pivots/camarilla.rb', line 36 def compute_bands mp_plus_range = p0.midpoint + p0.range mp_minus_range = p0.midpoint - p0.range p0.h4 = mp_plus_range * (1.1 / 2.0) p0.h3 = mp_plus_range * (1.1 / 4.0) p0.h2 = mp_plus_range * (1.1 / 6.0) p0.h1 = mp_plus_range * (1.1 / 12.0) p0.l1 = mp_minus_range * (1.1 / 12.0) p0.l2 = mp_minus_range * (1.1 / 6.0) p0.l3 = mp_minus_range * (1.1 / 4.0) p0.l4 = mp_minus_range * (1.1 / 2.0) p0.h5 = p0.h4 + 1.168 * (p0.h4 - p0.h3) p0.h6 = p0.midpoint * (p0.high_price / p0.low_price) p0.l5 = p0.l4 - 1.168 * (p0.l3 - p0.l4) p0.l6 = p0.midpoint - (p0.h6 - p0.midpoint) end |
#compute_midpoint ⇒ Object
32 33 34 |
# File 'lib/quant/indicators/pivots/camarilla.rb', line 32 def compute_midpoint p0.midpoint = t0.close_price end |