Contains two ATR trailing stop lines, fast and slow.
The slow ATR SL line is the same as the one in a normal ATR trailing stop loss indicator.
The fast one is created to generate buy/sell signals (plot arrows on the chart).
The system works well in high volatility market.
(translated from tradingview code, following a request in the Spanish forum).
//PRC_ATR Trailng Stop v2.1 | indicator
//10.04.2018
//Nicolas @ www.prorealcode.com
//Sharing ProRealTime knowledge
//converted from Tradingview code
// --- settings
// Fast Trail //
AP1 = 5 //"fast ATR period",integer) // ATR Period
AF1 = 0.5 //"fast ATR multiplier",float) // ATR Factor
// Slow Trail //
AP2 = 10 //"slow ATR perod",integer) // ATR Period
AF2 = 2 // "slow ATR multiplier",float) // ATR Factor
// --- end of settings
SC = customclose
SL1 = AF1*AverageTrueRange[AP1] // Stop Loss
once trail1=sc-sl1
if sc>trail1[1] and sc[1]>trail1[1] then
trail1 = max(trail1[1],sc-sl1)
else
if sc<trail1[1] and sc[1]<trail1[1] then
trail1=min(trail1[1],sc+sl1)
else
if sc>trail1[1] then
trail1=sc-sl1
else
trail1=sc+sl1
endif
endif
endif
SL2 = AF2*AverageTrueRange[AP2] // Stop Loss
if sc>trail2[1] and sc[1]>trail2[1] then
trail2 = max(trail2[1],sc-sl2)
else
if sc<trail2[1] and sc[1]<trail2[1] then
trail2=min(trail2[1],sc+sl2)
else
if sc>trail2[1] then
trail2=sc-sl2
else
trail2=sc+sl2
endif
endif
endif
ts1 = trail1
ts2 = trail2
if sc>trail2 then
rtrail=0
gtrail=255
else
rtrail=255
gtrail=0
endif
drawcandle(trail1,trail2,trail1,trail2) coloured(rtrail,gtrail,0,50)bordercolor(0,0,0,0)
Hst = Trail1-Trail2
Sig = average[9,1](Hst)
// Bar color for trade signal //
Green = Hst>0 and Hst>Sig
Red = Hst<0 and Hst<Sig
sBuy = green and not green[1]
sSell = red and not red[1]
if sBuy then
drawarrowup(barindex,ts2)coloured(rtrail,gtrail,0)
endif
if sSell then
drawarrowdown(barindex,ts2)coloured(rtrail,gtrail,0)
endif
return ts1 style(point,1) as "Fast Trail", ts2 coloured(rtrail,gtrail,0) style(line,2) as "Slow Trail"
You must be logged in to post a comment.
Bonjour j’avais vu que vous proposiez d’écrire des codes pour ceux qui s’y connaisse pas Maison je me rappel plus a quel e-mail vous envoyer svp c’est pour un screemer pour les devises time frame 1H merci d’avance
Another question.. is it even needed to learn how to code, even if you seem to have found a good strategy with the wizard? Just because the wizard is simple, doesn't mean it's bad.. It's usually the simple strategies that last good in the long run, just like trading manually, doing over complex shit will not do any good
yes it is still an indicator obviously :) But now you can get the signals (ones with arrows) with the "wizard", mate. Learn to code and no need of wizard things anymore ;) Start with the first course: https://www.prorealcode.com/courses/training-program-introduction-programming-prorealtime/ the advanced one should come this month.
change the RETURN instruction line with this one: return ts1 style(point,1) as "Fast Trail", ts2 coloured(rtrail,gtrail,0) style(line,2) as "Slow Trail", ssell,sbuy Then you'll be able to use these last variables in any trading strategies, by looking for their values, 1 means a new signal, 0 means no signal.
Les devises unité