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).
//PRC_KaseDevStop v3 | indicator
//Nicolas @ www.prorealcode.com
//Sharing ProRealTime knowledge
//translated from MT5 code version
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
average1 = average[inpFastPeriod](pricc)
average2 = average[inpSlowPeriod](pricc)
if average1>average2 then
if trend<>trend then
if trend=1 then
if trend>0 then
if trend<0 then
for n=1 to inpDesPeriod-1 do
dev = square(rrange-avg)
for n=1 to inpDesPeriod-1 do
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)
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.
I have questions about this code. Is pricc the same as price? Also what is the custom close definition? What does pricc mean?
Definition of CustomClose: https://www.prorealcode.com/documentation/customclose/
 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:
Sorry pls ignore last image, try this – it actually has the Dev Stop indicator!