Friday, April 26, 2013

Adaptive Indicators - 2 . Adaptive Stochastics

Last week we looked at an Adaptive CCI. Now let us look at extending our experiments in creating a adaptive stochastic. As you are aware the stochastic indicator calculates the difference between the current close and the lowest value in a range as a ratio of  the entire range. This ratio is converted to a percentage and then a small smoothing is applied.

%K = (Current Close - Lowest Low)/(Highest High - Lowest Low) * 100

The Lowest low and Highest High is calculated over a specified look back period. Here we will calculate these values on the Dominant cycle (DC) period. The  DC is again calculated using the Hilbert transform of John Ehler.  The DC period is a varying parameter depending on the market condition and the Stochastic calculation is automatically adjusted as per the varying DC period making it adaptive to the Market condition.

You can see in the chart below that the adaptive Stochastic is giving less whipsaws and is smoother. The afl is also provided for you to experiment. Do share your finding and thoughts.

The KStochastic afl


  1. oh man..............what a indicator...........really surprising......thnx a lot karthik sir

  2. Hi Kumar, DO share your feedback...Thanks...

  3. karthik sir It shows good... Thanks

  4.'s good...infact both the indicators KCCI and a Kstochastic are good one...

  5. Thanks Sandipan, Great to know that these indicators are useful. Makes all the effort worthwhile.

  6. How you didn't noticed my request regarding market profile ... I am puzzled to understand this ..

  7. Hi, I did not miss it. I am getting many error in your sample code. Did not get time debug that first... unable to understand some parts..what is C1 in the code?

  8. ok Sir! I will start again

    Kaka has shared his Market profile code here,

    Problem with above is it plots YVAH YPOC YVAL values only upto current bar
    which makes it very much useless in morning bars

    It would be great if we can plot those three lines up to end of current day,I mean in future bars. I have made little progress in that. You can download the revised code here,

    My work is still 50% success :(

    My added code is marked there with //Revision 1

    I just changed the counter to u instead of i, which made the trick

    But still it is not 100% ok.

    I am puzzled as what is going wrong...xoffset or something else??

    please see if you can crack this...


  9. This comment has been removed by the author.

  10. Hello Karthik,
    I have downloaded your source "KStochastic" but i don't understand afl files.
    Do you have the mq4 equivalent or an explanation of the algorithm?
    Many thanks in advance for your assistance.
    Best regards.
    My email: