!!! ATR exit strategies in SQ is very vulnerable
3 replies
eastpeace
6 years ago #116825
Hello, Mark and all,
I find that the exit strategies based on ATR in SQ are wrong, except PT and the initial stop-loss.
The profit trailing should be based on the highest high or close after entry, if we have a long position.
Another important thing is which atr value. It’s not about the atr’s parameters, it’s about the recent or some bars ago.
I have 4 method, and I hope SQ4 would improve the exit strategies with ATR.
#Run_By_Bar
Input:
N(30,5,20,1);
Variables:
mp(0),
ATR_before_entry(0),
tmp(0);
MA1:=Ma(c,N); //average
//entry conditions
bEnterLong := Cross(c,MA1);
bEnterShort := Cross(MA1,c);
ATR1 = AvgTrueRange(20);
mp = MarketPosition;
if mp=1 and mp[1]<>1 Then Begin
ATR_before_entry = ATR1[1];
End
//sl1: highest bar – atr[BarsSinceEntry+1];
hhvbar = highest(high,BarsSinceEntry);
stopline1: hhvbar – 3 * ATR_before_entry,NoDraw,ColorYellow;
PartLine(mp=1 and BarsSinceEntry>=1,stopline1),ColorYellow;
//sl2: higest bar close – atr[BarsSinceEntry+1]
hhvbar1 = highest(c,BarsSinceEntry);
stopline2: hhvbar1 – 3 * ATR_before_entry,NoDraw,ColorGreen;
PartLine(mp=1 and BarsSinceEntry>=1,stopline2),ColorGreen;
//sl3: SQ profit trailing
stopline3: close – 3 * AvgTrueRange(20),NoDraw,ColorCyan;
PartLine(mp=1 and BarsSinceEntry>=1,stopline3),ColorCyan;
//sl3: The ATR Ratchet
Start_Ratchet_Cond = (hhvbar-EntryPrice)>ATR_before_entry;
Ratchet_starter = lowest(low,10);
ratchet_rate = 0.05;
stopline4: Ratchet_starter + ratchet_rate * BarsSinceEntry * AvgTrueRange(10),NoDraw,ColorRed;
PartLine(mp=1 and Start_Ratchet_Cond,stopline4),ColorRed;
If bEnterLong Then Buy;
//If bExitLong Then Sell;
If bEnterShort Then SellShort;
//If bExitShort Then BuyToCover;
mabi
6 years ago #143034
I sincerly hope that the result from this error is already in the result of the strategies performance given by SQ ?!
Mark Fric
6 years ago #143064
Hello, Mark and all,
I find that the exit strategies based on ATR in SQ are wrong, except PT and the initial stop-loss.
The profit trailing should be based on the highest high or close after entry, if we have a long position.
Another important thing is which atr value. It’s not about the atr’s parameters, it’s about the recent or some bars ago.
I have 4 method, and I hope SQ4 would improve the exit strategies with ATR.
what to you mean that they are wrong? It might be implemented differently than is your idea, but it doesn’t make them wrong.
Also question about ATR is philosophical – should we use ATR from entry or actual ATR ? Both have their points.
But you are right in one thing – it should be possible to add your own trailing exit strategies in SQ4, I’ll think about how to do it.
Mark
StrategyQuant architect
eastpeace
6 years ago #143196
Sorry, Mark. What I said is not very exact. But I think you could get my meaning.
There are many ways to implement atr’s exit strategy.
And I would like to see that SQ4 would support it.
Viewing 3 replies - 1 through 3 (of 3 total)