Cosine Kernel Regressions [QuantraSystems]

Cosine Kernel Regressions


The Cosine Kernel Regressions indicator (CKR) uses mathematical concepts to offer a unique approach to market analysis. This indicator employs Kernel Regressions using bespoke tunable Cosine functions in order to smoothly interpret a variety of market data, providing traders with incredibly clean insights into market trends.

The CKR is particularly useful for traders looking to understand underlying trends without the 'noise' typical in raw price movements. It can serve as a standalone trend analysis tool or be combined with other indicators for more robust trading strategies.


Fast Trend Signal Line - This is the foreground oscillator, it is colored upon the earliest confirmation of a change in trend direction.

Slow Trend Signal Line - This oscillator is calculated in a similar manner. However, it utilizes a lower frequency within the cosine tuning function, allowing it to capture longer and broader trends in one signal. This allows for tactical trading; the user can trade smaller moves without losing sight of the broader trend.

Case Study

In this case study, the CKR was used alongside the Triple Confirmation Kernel Regression Oscillator (KRO)

  • Initially, the KRO indicated an oversold condition, which could be interpreted as a signal to enter a long position in anticipation of a price rebound. However, the CKR’s fast trend signal line had not yet confirmed a positive trend direction - suggesting that entering a trade too early and without confirmation could be a mistake.

  • Waiting for a confirmed positive trend from the CKR proved beneficial for this trade. A few candles after the oversold signal, the CKR's fast trend signal line shifted upwards, indicating a strong upward momentum. This was the optimal entry point suggested by the CKR, occurring after the confirmation of the trend change, which significantly reduced the likelihood of entering during a false recovery or continuation of the downtrend.

  • This is one of the many uses of the CKR - by timing entries using the fast signal line, traders could avoid unnecessary losses by preventing premature entries.


The methodology behind CKR is a multi-layered approach and utilizes many ‘base’ indicators.
  • Relative Strength Index
  • Stochastic Oscillator
  • Bollinger Band Percent
  • Chande Momentum Oscillator
  • Commodity Channel Index
  • Fisher Transform
  • Volume Zone Oscillator

The calculated output from each indicator is standardized and scaled before being averaged. This prevents any single indicator from overpowering the resulting signal.

//  ╔════════════════════════════════╗  //
//  ║    Scaling/Range Adjustment    ║  //
//  ╚════════════════════════════════╝  //
RSI_ReScale   (_res      ) => (      _res - 50   ) * 2.8
STOCH_ReScale (_stoch    ) => (    _stoch - 50   ) * 2
BBPCT_ReScale (_bbpct    ) => (    _bbpct - 0.5  ) * 120        
CMO_ReScale   (_chandeMO ) => ( _chandeMO * 1.15 )
CCI_ReScale   (_cci      ) => (      _cci / 2    )
FISH_ReScale  (_fish1    ) => (    _fish1 * 30   )
VZO_ReScale   (_VP, _TV  ) => (_VP / _TV) * 110

These outputs are then fed into a customized cosine kernel regression function, which smooths the data, and combines all inputs into a single coherent output.
//              ╔════════════════════════════════╗              //
//              ║    COSINE KERNEL REGRESSIONS   ║              //
//              ╚════════════════════════════════╝              //
// Define a function to compute the cosine of an input scaled by a frequency tuner
cosine(x, z) =>
    // Where x = source input
    //       y = function output
    //       z = frequency tuner
    var y = 0.
    y := math.cos(z * x)
// Define a kernel that utilizes the cosine function
kernel(x, z) =>
    var y = 0.
    y := cosine(x, z)
    math.abs(x) <= math.pi/(2 * z) ? math.abs(y) : 0.    //    cos(zx) = 0
//  The above restricts the wave to positive values      //     when x = π / 2z

The tuning of the regression is adjustable, allowing users to fine-tune the sensitivity and responsiveness of the indicator to match specific trading strategies or market conditions. This robust methodology ensures that CKR provides a reliable and adaptable tool for market analysis.
Catatan Rilis:
Added combined alerts
Catatan Rilis:
Added multi-timeframe functionality.

No statements or claims aim to be financial advice,
neither are any signals from us or our indicators.

Want to learn Trading, Investing or system building?
Join the Community! 👇

Skrip open-source

Dalam semangat TradingView, penulis dari skrip ini telah mempublikasikannya ke sumber-terbuka, maka trader dapat mengerti dan memverifikasinya. Semangat untuk penulis! Anda dapat menggunakannya secara gratis, namun penggunaan kembali kode ini dalam publikasi diatur oleh Tata Tertib. Anda dapat memfavoritkannya untuk digunakan pada chart

Pernyataan Penyangkalan

Informasi dan publikasi tidak dimaksudkan untuk menjadi, dan bukan merupakan saran keuangan, investasi, perdagangan, atau rekomendasi lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Persyaratan Penggunaan.

Inggin menggunakan skrip ini pada chart?