KST oscillator free

by gorin in category Oscilator at 26/07/2013

The know sure thing (KST) oscillator is a complex, smoothed price velocity indicator developed by Martin J. Pring.

rate of change (ROC) indicator is the foundation of KST indicator. KST indicator is useful to identify major stock market cycle junctures because its formula is weighed to be more greatly influenced by the longer and more dominant time spans, in order to better reflect the primary swings of stock market cycle.[3] The concept behind the oscillator is that price trends are determined by the interaction of many different time cycles and that important trend reversals take place when a number of price trends are simultaneously changing direction.

Entry rules KST Indicator
When KST crosses below its 9 day exponential average, short at the next day opening price.

Exit rules KST indicator
When KST crosses above its 9 day exponential average, close short position at the next day opening price.[4]


Works best with W1 and M1 Timeframes.

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 cAlgo.API;
using cAlgo.API.Indicators;

namespace cAlgo.Indicators
    public class KnowSureThing : Indicator
        private PriceROC _priceRoc1;
        private PriceROC _priceRoc2;
        private PriceROC _priceRoc3;
        private PriceROC _priceRoc4;

        private MovingAverage _movingAverage1;
        private MovingAverage _movingAverage2;
        private MovingAverage _movingAverage3;
        private MovingAverage _movingAverage4;

        private ExponentialMovingAverage ema;

        public DataSeries Source { get; set; }

        [Parameter(DefaultValue = 10)]
        public int X1 { get; set; }
        [Parameter(DefaultValue = 15)]
        public int X2 { get; set; }
        [Parameter(DefaultValue = 20)]
        public int X3 { get; set; }
        [Parameter(DefaultValue = 30)]
        public int X4 { get; set; }

        [Parameter(DefaultValue = 1)]
        public int W1 { get; set; }
        [Parameter(DefaultValue = 2)]
        public int W2 { get; set; }
        [Parameter(DefaultValue = 3)]
        public int W3 { get; set; }
        [Parameter(DefaultValue = 4)]
        public int W4 { get; set; }

        [Parameter(DefaultValue = MovingAverageType.Simple)]
        public MovingAverageType MAType { get; set; }

        [Parameter(DefaultValue = 10)]
        public int AVG1 { get; set; }
        [Parameter(DefaultValue = 10)]
        public int AVG2 { get; set; }
        [Parameter(DefaultValue = 10)]
        public int AVG3 { get; set; }
        [Parameter(DefaultValue = 15)]
        public int AVG4 { get; set; }

        public IndicatorDataSeries Result { get; set; }

        [Output("Ema", Color = Colors.Blue)]
        public IndicatorDataSeries Ema { get; set; }

        protected override void Initialize()
            _priceRoc1 = Indicators.PriceROC(Source, X1);
            _priceRoc2 = Indicators.PriceROC(Source, X2);
            _priceRoc3 = Indicators.PriceROC(Source, X3);
            _priceRoc4 = Indicators.PriceROC(Source, X4);

            _movingAverage1 = Indicators.MovingAverage(_priceRoc1.Result, AVG1, MAType);
            _movingAverage2 = Indicators.MovingAverage(_priceRoc2.Result, AVG2, MAType);
            _movingAverage3 = Indicators.MovingAverage(_priceRoc3.Result, AVG3, MAType);
            _movingAverage4 = Indicators.MovingAverage(_priceRoc4.Result, AVG4, MAType);

            ema = Indicators.ExponentialMovingAverage(Result, 9);


        public override void Calculate(int index)
            Result[index] = W1 * _movingAverage1.Result[index] + W2 * _movingAverage2.Result[index] + W3 * _movingAverage3.Result[index] + W4 * _movingAverage4.Result[index];

            Ema[index] = ema.Result[index];


andreavu - August 25, 2013 @ 03:41

where is the blue line?

gorin - August 28, 2013 @ 12:18

The blue line is just the 9 day EMA of the KST you can add it on the chart, but you can include it in the code as well.

Add the following to the code:


[Output("Ema", Color = Colors.Blue)]
public IndicatorDataSeries Ema { get; set; }

private ExponentialMovingAverage ema;


  protected override void Initialize()


 ema = Indicators.ExponentialMovingAverage(Result, 9);


public override void Calculate(int index)
            Result[index] = ...
            Ema[index] = ema.Result[index];


MrTrader - September 11, 2013 @ 17:17



You would make peoples life easier if you added the blue EMA to the code (some people dont know how to code)!!

andreavu - September 15, 2013 @ 18:51

I can not add the code please update the dll

cAlgo_Fanatic - September 16, 2013 @ 12:44

In order to install an indicator please follow the instructions found when you click the "How To Install" link found under the Headline Indicators in the Indicators List Page (Top Left - under the Gray Notification) 

Let us know if you require additional help downloading and installing indicators/robots

gorin - September 16, 2013 @ 14:06

There you go MrTrader.
I have to say, you were very polite in your request...

MrTrader - September 18, 2013 @ 02:40

Hello CAlgo_Fanatic/Gorin,

I have no troubles in downloading/installing indicators (I am an expert in downloading and Installing).

The problem is I have installed the indicator but cant see the blue ema on the Indicator (pictured above) ??

It would be easier if the E.M.A was coded into the indicator code by yourselves as I and other people have no qualifications for.

meet2mihir - October 20, 2019 @ 13:15

Hello Mr. Gorin!

Can you makke cbot based upon KST?

KST histogram= difference between BLUE and GREEN line.

If histogram is greater than X and less than Y = BUY

If histogram is less than A and greater than B = SELL