BykovTrend_NRTR

Category: Indicators By: Nicolas Created: May 6, 2021, 8:49 AM
May 6, 2021, 8:49 AM
Indicators
15 Comments

Here is a new trailing stop indicator working with an ATR spread according to a trend detection made with the Williams Percent indicator.

Very similar to this other ASCTrend indicator in my opinion.

Converted to ProBuilder language from the source version for MT5.

//PRC_BykovTrend_NRTR | indicator
//06.05.2021
//Nicolas @ www.prorealcode.com
//Sharing ProRealTime knowledge
//converted from MQL5

// --- settings 
RISK=3
SSP=9
AtrRatio=0.375
// --- end of settings 

once K = 33-RISK
once ATRPeriod=15

if barindex>max(SSP,ATRPeriod) then 
//---
//trend=oldtrend
WPR = Williams[SSP](close)
ATR = AverageTrueRange[ATRPeriod](close)
if(WPR<-100+K) then 
 trend=-1
endif
if(WPR>-K) then 
trend=1
endif
irange=AtrRatio*ATR
//---
if(trend[1]<0 and trend>0) then 
BuyBuffer=low-irange
else
Buybuffer = 0 //nst
endif
if(trend[1]>0 and trend<0) then 
SellBuffer=high+irange
else
SellBuffer = 0 //nst
endif 

if(trend>0) then 
if(BuyBuffer) then 
UpBuffer1=BuyBuffer
DnBuffer1=DnBuffer1[1]
else
istop=low-irange
if(istop<UpBuffer1[1]) then 
istop=UpBuffer1[1]
endif
UpBuffer1=istop
endif
endif


if(trend<0) then 
if(SellBuffer) then 
DnBuffer1=SellBuffer
UpBuffer1=UpBuffer1[1]
else
istop=high+irange
if(istop>DnBuffer1[1]) then 
istop=DnBuffer1[1]
endif
DnBuffer1=istop
endif
endif
endif

//---

if (trend[1]>0 and trend>0) then 
r=50
g=205
b=50
dn=0
up=255
elsif (trend[1]<0 and trend<0) then
r=148
g=0
b=211
dn=255
up=0
endif

if buybuffer then
drawtext("✵",barindex,upbuffer1,dialog,bold,25) coloured(50,205,50)
elsif sellbuffer then 
drawtext("✵",barindex,dnbuffer1,dialog,bold,25) coloured(148,0,211)
endif

 

return upbuffer1 coloured(r,g,b,up) style(line,2),dnbuffer1 coloured(r,g,b,dn) style(line,2),trend

Download
Filename: PRC_BykovTrend_NRTR.itf
Downloads: 735
Nicolas Master
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

Logo Logo
Loading...