rhondamuse.com

The Art of Developing a Unique Technical Indicator

Written on

Creating a Unique Technical Indicator from Scratch

Coding a Technical Indicator with Pine Script

The Stochastic Oscillator is widely recognized in Technical Analysis, providing a quick insight into whether a market is overbought or oversold. In this guide, we will develop a variation known as the Stochastic Smoothing Oscillator using the Pine Script on TradingView.

Recently, I published a new book following the success of my previous one. This new edition includes advanced trend-following indicators and strategies, complete with a dedicated GitHub page for continuously updated code. Additionally, it features optimized colors for printing costs. If this piques your interest, feel free to check the Amazon link below, or reach out to me via LinkedIn for a PDF version.

Trend Following Strategies in Python: Harnessing Indicators for Trend Following

Amazon.com: Trend Following Strategies in Python: Harnessing Indicators for Trend Following: 9798756939620: Kaabar…

www.amazon.com

The Stochastic Smoothing Oscillator

The Stochastic Oscillator is a well-known tool in technical analysis, with a variant called the Stochastic Smoothing Oscillator that applies additional smoothing. First, let’s briefly review the original Stochastic Oscillator.

The normalization method confines values between 0 and 1 (or 0 and 100 if multiplied). It involves subtracting the minimum value within a specified lookback period from the current value and dividing it by the difference between the maximum and minimum values of that period.

The Stochastic Oscillator identifies overbought and oversold regions by applying the normalization formula, illustrated below:

An overbought area indicates that the market is very bullish and likely to consolidate, while an oversold area suggests extreme bearishness, predicting a potential bounce. Thus, the Stochastic Oscillator acts as a contrarian indicator, signaling reactions to significant market movements. Now, let’s move to TradingView and code the Stochastic Smoothing Oscillator ourselves.

Why create it ourselves if it already exists among their indicators?

The answer lies in building our foundational skills in a reputable charting platform. By mastering the fundamentals of Pine Script, we can eventually develop our own indicators and strategies.

Medium is a treasure trove of fascinating articles. I read extensively before deciding to contribute here. Consider joining Medium through my referral link!

Developing the Stochastic Smoothing Oscillator on TradingView

Our goal is to create and display the Stochastic Smoothing Oscillator using EURGBP data on the TradingView platform. Remember, you need an account to view charts, but the good news is that it's free! Click the Chart button on the home screen and select any asset for the indicator calculation. Next, find the Pine Editor at the bottom of the screen and prepare for coding.

Begin by specifying the Pine Script version. For our purposes, we'll use version 4.

//@version=4

Next, define the indicator's name using the following syntax:

study("Stochastic Smoothing Oscillator")

After the introductory setup, we can define the oscillator's parameters. The Stochastic Smoothing Oscillator uses exponential moving averages applied to high, low, and closing prices, with the stochastic normalization function implemented. We need to establish two lookback periods: 2 and 13. The 2-period lookback corresponds to the exponential moving average applied to the HLC data, while the 13-period looks back refers to the normalization window.

lookback = 13, ema_lookback = 2

Next, we will transform and smooth the HLC data. The ema() function calculates the exponential moving average based on the closing price and our defined lookback periods.

SSO_low = ema(low, ema_lookback) SSO_high = ema(high, ema_lookback) SSO_close = ema(close, ema_lookback)

Now, we apply the SSO formula, which mirrors the Stochastic Oscillator's formula. The built-in functions highest() and lowest() will help us identify the highest and lowest values for a specified lookback period.

SSO = (SSO_close - lowest(SSO_low, lookback)) / (highest(SSO_high, lookback) - lowest(SSO_low, lookback)) * 100

Finally, we will plot the indicator alongside the chart using the plot() function, which takes a source and a color property, as illustrated below.

plot(SSO, color=color.red) hline(10, color=color.gray, linestyle=hline.style_dashed) hline(90, color=color.gray, linestyle=hline.style_dashed)

Here’s the complete code:

//@version=4 study("Stochastic Smoothing Oscillator") lookback = 13 ema_lookback = 2 SSO_low = ema(low, ema_lookback) SSO_high = ema(high, ema_lookback) SSO_close = ema(close, ema_lookback) SSO = (SSO_close - lowest(SSO_low, lookback)) / (highest(SSO_high, lookback) - lowest(SSO_low, lookback)) * 100 plot(SSO, color=color.red) hline(10, color=color.gray, linestyle=hline.style_dashed) hline(90, color=color.gray, linestyle=hline.style_dashed)

The SSO operates similarly to the Stochastic Oscillator, with a bullish bias when the SSO is at lower levels and a bearish bias when it reaches higher levels.

If you're interested in exploring more technical indicators and strategies, my book may be of interest:

The Book of Trading Strategies

Amazon.com: The Book of Trading Strategies: 9798532885707: Kaabar, Sofien: Books

www.amazon.com

A Final Note

I've recently launched an NFT collection aimed at supporting various humanitarian and medical initiatives. The Society of Light consists of limited-edition collectibles, with a portion of each sale going directly to the designated charity associated with the avatar. Here are some compelling reasons to consider purchasing these NFTs:

  • High-potential gain: By channeling the remaining sales proceeds into marketing for The Society of Light, I aim to enhance their value in the secondary market. Remember, trading in the secondary market also means a portion of royalties will be donated to the same charity.
  • Art collection and portfolio diversification: Owning avatars that represent positive deeds can be deeply fulfilling. Investing doesn't have to be purely self-serving; why not invest to generate profit, assist others, and collect art?
  • Flexibility in charity donations: This provides a versatile way to direct funds to your chosen causes.
  • A complimentary PDF copy of my book: Every NFT buyer will receive a free copy of my latest book linked in this article.
Support Ron’s cause for the elderly.

Share the page:

Twitter Facebook Reddit LinkIn

-----------------------

Recent Post:

Understanding Cubital Tunnel Syndrome: Symptoms and Solutions

Explore the symptoms and treatments for Cubital Tunnel Syndrome, including personal insights and expert advice.

The Power of Small Changes: Big Impact on Our Lives

Explore how minor adjustments can lead to significant life changes and the ripple effects they create.

Embrace the Unexpected: Transforming Interactions for Impact

Discover how embracing unpredictability can enhance connections and leave lasting impressions.

Revolutionary Insights into Ancient DNA and Modern Diseases

Discover how ancient DNA findings unveil links to modern diseases like multiple sclerosis and Alzheimer's, shedding light on our genetic history.

# Mastering the Art of Conversation: A Two-Step Guide

Discover a simple two-step method for engaging conversations that make others feel comfortable and valued.

Navigating Relationships: The Crucial Role of Timing in Dating

Explore how timing influences relationships and personal growth, highlighting the importance of mutual compatibility.

Mastering Memory: The Ultimate Guide to Retaining Knowledge

Discover effective techniques to enhance your memory retention and study skills, ensuring you remember what you learn for years.

The Scientific Debate: Understanding Biological Sex Beyond the Binary

An exploration of the biological concept of sex, addressing misconceptions about the sex spectrum and the implications for intersex individuals.