# Stochastic Roofing Fast Professional

## 1. Summary (Introduction)

The Stochastic Roofing Fast indicator is an oscillator based on the concepts of John Ehlers. It combines two advanced filtering techniques to create a version of the classic **Fast Stochastic Oscillator**.

This indicator calculates the Stochastic not on the raw price, but on a **pre-filtered data series** generated by Ehlers' **Roofing Filter**. The Roofing Filter removes both the long-term trend and the high-frequency noise from the price.

The result is a zero-mean Stochastic that provides clear, cyclical signals. This "Fast" version omits the initial smoothing (`Slowing`) step, resulting in a more responsive, but potentially noisier, %K line compared to the "Slow" version.

## 2. Mathematical Foundations and Calculation Logic

The indicator uses a multi-stage process, chaining a Roofing Filter and a Fast Stochastic Oscillator.

### Calculation Steps (Algorithm)

1. **Roofing Filter Calculation:** The source price is first passed through a two-stage Roofing Filter.
2. **%K Line Calculation (Fast %K):** A standard Stochastic %K value is calculated on the **output of the Roofing Filter**. This raw, unsmoothed value becomes the final **%K line**.
3. **%D Line Calculation:** The %K line is smoothed using a Simple Moving Average over the `%D Period` to create the **%D signal line**.

## 3. MQL5 Implementation Details

* **All-in-One Calculator (`Stochastic_Roofing_Calculator.mqh`):** The entire complex, multi-stage calculation (Roofing Filter + Stochastic) is encapsulated within a single, dedicated calculator class.
* **Heikin Ashi Integration:** An inherited `_HA` class allows the initial Roofing Filter calculation to be performed seamlessly on smoothed Heikin Ashi data.
* **Stability via Full Recalculation:** The calculation involves multiple chained, state-dependent filters. To ensure absolute stability, the indicator employs a **full recalculation** on every `OnCalculate` call.

## 4. Parameters

* **Roofing Filter Settings:**
  * `High-Pass Period`: The period for the trend-removal filter. Ehlers' default is **48**.
  * `SuperSmoother Period`: The period for the noise-smoothing filter. Ehlers' default is **10**.
* **Stochastic Settings:**
  * `%K Period`: The lookback period for the Stochastic calculation.
  * `%D Period`: The period for the signal line smoothing.
  * *(Note: The `Slowing` parameter is not used in the Fast Stochastic.)*
* **Source Settings:**
  * `Applied Price`: The source price for the initial Roofing Filter calculation.

## 5. Usage and Interpretation

This indicator is used as a more responsive version of the Stochastic Roofing concept.

* **Signals:** The usage is identical to the Slow version (overbought/oversold levels, crossovers, divergence).
* **Key Difference:** The **%K line is more jagged and reacts faster** to changes in the underlying Roofing Filter's value. This may provide earlier signals, but it can also be more prone to "whipsaws" or false signals compared to the smoother Slow version. Due to the powerful smoothing of the preceding Roofing Filter, the visual difference between the Fast and Slow versions is often minimal.
