Hello, I was wondering if for you it makes sense to test a strategy with “dynamic trailing stops”
With this I mean the following (Credit to ALE for the coding of the trailing stops) . Does it make sense? PRT is handling it?
//TRAILING STOP
TGL =a*ATR //DYNAMIC TRAILING
TGS=b*ATR //DYNAMIC TRAILING
if not onmarket then
MAXPRICE = 0
MINPRICE = close
PREZZOUSCITA = 0
ENDIF
if longonmarket then
MAXPRICE = MAX(MAXPRICE,close)
if MAXPRICE-tradeprice(1)>=TGL*pointsize then
PREZZOUSCITA = MAXPRICE-TGL*pointsize
ENDIF
ENDIF
if shortonmarket then
MINPRICE = MIN(MINPRICE,close)
if tradeprice(1)-MINPRICE>=TGS*pointsize then
PREZZOUSCITA = MINPRICE+TGS*pointsize
ENDIF
ENDIF
if onmarket and PREZZOUSCITA>0 then
EXITSHORT AT PREZZOUSCITA STOP
SELL AT PREZZOUSCITA STOP
ENDIF
set target pprofit PF
endif
hi,
I guess only in backtesting its working …but not on live trading
You guess wrong 🙂 It should also work perfectly in live trading, this trailing stop code use pending STOP orders which are put at price levels calculated each bar. Of course, like any other ProOrder program it is only read once per bar.
Spread and order distance from current price should also be considered when using this code.