As requested in the forum, here is a new version of the Cynthia Kase Dev Stop indicator.
Originally developed bu Cynthia Kase (in her book “Trading With the Odds”). This version is calculating the DevStops exactly as described in the book.
Engineering a Better Stop: The Kase DevStops
What all of this boils down to is that we need to take variance and skew into consideration when we are establishing a system for setting stops. Three steps that we can take in order to both better define and to minimize the threshold of uncertainty in setting stops are:
- Consideration of the variance or the standard deviation of range.
- Consideration of the skew, or more simply, the amount at which range can spike in the opposite direction of the trend.
- Reformation of our data to be more consistent (this step is examined in detail in Chapter 81, while minimizing the degree of uncertainty as much as possible).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
//PRC_KaseDevStop v3 | indicator //29.06.2018 //Nicolas @ www.prorealcode.com //Sharing ProRealTime knowledge //translated from MT5 code version //--- settings inpDesPeriod = 20 // Dev-stop period inpSlowPeriod = 21 // Dev-stop slow period inpFastPeriod = 10 // Dev-stop fast period inpStdDev1 = 0.0 // Deviation 1 inpStdDev2 = 1.0 // Deviation 2 inpStdDev3 = 2.2 // Deviation 3 inpStdDev4 = 3.6 // Deviation 4 //--- end of settings pricc=customclose once price=close*100 average1 = average[inpFastPeriod](pricc) average2 = average[inpSlowPeriod](pricc) if average1>average2 then trend=1 r=0 g=191 b=255 else trend=-1 r=255 g=128 b=0 endif if trend<>trend[1] then if trend=1 then price=high else price=low endif endif if trend>0 then price=max(price,high) endif if trend<0 then price=min(price,low) endif mmax=max(max(high,high[1]),pricc[2]) mmin=min(min(low,low[1]),pricc[2]) rrange=mmax-mmin avg=rrange for n=1 to inpDesPeriod-1 do avg=(avg+rrange[n]) next avg=avg/n dev = square(rrange-avg) for n=1 to inpDesPeriod-1 do dev=dev+(rrange[n]-avg)*(rrange[n]-avg) next dev=sqrt(dev/n) val = price+(-1)*trend*(avg+(inpStdDev1*dev)) val1 = price+(-1)*trend*(avg+(inpStdDev2*dev)) val2 = price+(-1)*trend*(avg+(inpStdDev3*dev)) val3 = price+(-1)*trend*(avg+(inpStdDev4*dev)) return val coloured(r,g,b) style(dottedline,1) ,val1 coloured(r,g,b) style(dottedline,1) ,val2 coloured(r,g,b) style(dottedline,1),val3 coloured(r,g,b) style(line,3) |
Share this
No information on this site is investment advice or a solicitation to buy or sell any financial instrument. Past performance is not indicative of future results. Trading may expose you to risk of loss greater than your deposits and is only suitable for experienced investors who have sufficient financial means to bear such risk.
ProRealTime ITF files and other attachments :PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials
I have experimented with the Kase Dev Stop system by building a basic strategy from it and then using the optimization engine to find the deviation value that best captures the point of no return. In the standard model as provided above the biggest deviation factor is 3.6 (basically supposed to filter >99% of rebounds), yet even in the example above I counted at least 8 instances where price rebounded back after closing outside KDev3. In my testing, I have found deviation factors of >4 and < 5 to be much more reliable. Also switching the stops based on a breach of this larger deviation yields the best trend validation.
Thanks for the studies. What about the switch of the trend triggered by the slow and fast periods of moving average? Did you changed it?
Hi Nicolas, yes I did also change that. Found an EMA of 5 in conjunction with an EMA of 9 to work best
Hi Nicolas and Juanj I hope this is alright but I’ve moved the discussion here:
https://www.prorealcode.com/topic/kase-dev-stop-dev-stops-4-5-6-0-using-sar-to-flip-devs/ where I’ve added a SAR version of the Dev Stops with Devs 4.5 and 6.0.
I’ve done this mainly because I have a lot of issues posting right here in this part of the PRC site.. like when adding links and PRT code. Not sure why? I’m using a new Macbook 3.1ghz with Touchbar using the latest Safari.
Best
Bard
I have questions about this code. Is pricc the same as price? Also what is the custom close definition? What does pricc[2] mean?
Definition of CustomClose: https://www.prorealcode.com/documentation/customclose/
[2] means the value of this variable 2 bars back
Just wondered Nicolas, say you had set DEFPARAM CumulateOrders = True, is there anyway for this Dev Stop to be coded so that it takes out each individual Long position as the price crosses under eg Dev Stop 3.6?
Otherwise it just dumps all the trades at once giving back a lot of profits! Pls see image here:
https://www.dropbox.com/s/sobjtbrjfh4zfyj/Dev-Stop-4.5-All%20Cumulative-Orders-exited-at-the-same-time.png?dl=0
Sorry pls ignore last image, try this – it actually has the Dev Stop indicator!
https://www.dropbox.com/s/hr81jy41vz9302s/Dev-Stop-4.5-All%20Cumulative-Orders-exited-at-the-same-time.png?dl=0