Nicolas

Kase Dev Stop v3

Category: Indicators By: Nicolas Created: June 29, 2018, 1:07 PM
June 29, 2018, 1:07 PM
Indicators
8 Comments
Kase Dev Stop v3

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
//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)

 

Download
Filename: PRC_KaseDevStop-v3.itf
Downloads: 288
Nicolas
Nicolas Legend
I created ProRealCode because I believe in the power of shared knowledge. I spend my time coding new tools and helping members solve complex problems. If you are stuck on a code or need a fresh perspective on a strategy, I am always willing to help. Welcome to the community!
Author’s Profile

Comments

Bard
7 years ago
#

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

Bard
7 years ago
#

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

ooples
8 years ago
#

I have questions about this code. Is pricc the same as price? Also what is the custom close definition? What does pricc[2] mean?

Nicolas
8 years ago
#

Definition of CustomClose: https://www.prorealcode.com/documentation/customclose/ [2] means the value of this variable 2 bars back

Bard
8 years ago
#

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

juanj
8 years ago
#

Hi Nicolas, yes I did also change that. Found an EMA of 5 in conjunction with an EMA of 9 to work best

juanj
8 years ago
#

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.

Nicolas
8 years ago
#

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?

ProRealCode ProRealCode
Loading...