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:
//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)
You must be logged in to post a comment.
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
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 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.
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