ClickAlgo DiNapoli Stochastic

by Paul_Hayes in category Oscilator at 24/03/2016

This version of the DiNapoli Stochastic has a smoother indicator and extra logic to match the curve of the lines to identify possible price reversal with linear curve fitting. We also included many useful features like, email, sound alerts, high and low thresholds. The indicator can be used with a trading robot as it provides public properties for Buy and Sell signals.   


This oscillator smoothing method leads to filtering out "noise" in the price movement. It be used in the strategies that are oriented to a standard stochastic. The stronger smoothing can lead to loss of array of signals, so it is recommended to apply any trend indicator for more efficient use of the indicator and its signals filtering.

Read more about this type of indicator by Joe Dinapoli "Trading With DiNapoli Levels".


  1. Buy and Sell Threshold - this is the high and low for triggering a signal event
  2. Email Alert - sends you an email 
  3. Sound Alert - the sound file path is configurable
  4. Arrows drawn on chart - this plots an arrow each time a crossover occurs, you can turn this on or off
  5. FastK, SlowK and SlowD - configurable parameters
  6. Linear Curve Check
  7. Cross-over distance Check
  8. Data Analysis Mode
  9. Public properties for robots - IsBullish and IsBearish signals


There are two checks for identifying price reversals, you can modify the settings and the arrows which signal Buy or Sell are only shown where the optimal reversals occur.

Cross-Over Check

This involves a very simple, but useful check on the distance between the signal and result lines using the cross-over distance setting, when there is indecision in the price the two lines are very close together, when there is a strong change direction the distance is higher.


Linear Regression Curve Check

This is very useful when you want to match a specific type of curve which mostly show price reversals, it uses the Math.Net Numerics library described below for curve fitting. You can curve fit either the signal or the result line. The settings are Curve Offset and Curve Slope.

For analysis you can use a setting called Data Analysis Mode which will show you historical curve values in the log file to help you match the values which hold the strongest weight. The video below will explain the features in more detail.


Math.NET Numerics

This assembly aims to expose algorithms and methods for numerical computations in software engineering, the areas it covers are  special functions, linear algebra, probability models, random numbers, interpolation, integration, regression, optimization problems and much more. We use this library to help us fit the curve on the stochastic result and signal lines.

 Math.NET Numerics -


Curve Fitting: Linear Regression

Regression is all about fitting a low order parametric model or curve to data, so we can use it to make predictions on points not covered by the data. Both the data and the model are known, but we'd like to find the parameters that make the model good enough to the data according to some metric.

You can see from the diagram below where the white arrows are drawn that the fake cross-over signals are filtered out and where the red and green arrows are drawn you will get signals to buy or sell.

Curve fitting can involve either interpolation, where an exact fit to the data is required, or smoothing, in which a "smooth" function is constructed that approximately fits the data.



Data Analysis Mode

We have added a feature which will allow you to visually see the Linear Curve fitted values for the stochastic cross-over points so that you can compare this to the candle price action to help you increase the probability of a successful entry point.

Visit Us

Phone: 0044 20 3289 6573

* All international calls are local rates (low cost)

How to install
Notification Publishing copyrighted material is strictly prohibited. If you believe there is copyrighted material in this section you may use the Copyright Infringement Notification form to submit a claim.
Formula / Source Code
Language: C#
Trading Platform: cAlgocTrader
using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
using cAlgo.Indicators;
using System.Windows.Forms;
using System.Threading;

namespace cAlgo
    [Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.FullAccess)]
    public class ClickAlgoSoftware : Indicator
        private static Mutex dialogMutex = new Mutex();
        private static bool dialogIsShownOnce = false;

        protected override void Initialize()

        public override void Calculate(int index)
            // Calculate value at specified index
            // Result[index] = ...

        public static void ShowDialogBox()

            if (dialogIsShownOnce)

            var ret = MessageBox.Show("It is not possible to download the software from the cTDN website.\nWould you like to visit us at where you can download it?", "Downloading...", MessageBoxButtons.YesNo, MessageBoxIcon.Information);

            if (ret == DialogResult.Yes)

            dialogIsShownOnce = true;



Paul_Hayes - March 24, 2016 @ 10:44

Please note we cannot upload the indicator use to references to the Math.Net library, please visit the blog to download.