Trailing Activation must be wrong

b131 dev2

backtest engine : multicharts





if(MarketPosition > 0) then begin

...
    // Trailing Stop
    IntPriceLevel = SQ_Highest(WeightedClose, Period)[0] + (0.80 * SQ_BiggestRange(Period2)[2]);
    If IntPriceLevel > 0 and Close - EntryPrice >= Round2Fraction(TrailingActCef * SQ_ATR(20)[1]) and (IntLongTS = 0 or Round2Fraction(IntPriceLevel) > IntLongTS) and Round2Fraction(IntPriceLevel) < CurrentBid then begin
        IntLongTS = Round2Fraction(IntPriceLevel); // remember also trailing stop
    end;
    If IntLongTS > 0 and IntLongTS > IntLongSL then begin
        Sell("LongTrailingStop") next bar at IntLongTS stop;
        LongSLPlaced = true;
    end;    



We know here the trailing stop activation is up to Close - EntryPrice >= TrailingActCef * SQ_ATR(20)[1],

But the right way is, Highest price after entry - EntryPice > trailing activation trigger, example in long position

if(MarketPosition < 0) then begin
...
    If BarsSinceEntry = 0 then begin
...
HighAfterEntry = Close;
    end;

if Close > HighAfterEntry then
HighAfterEntry = Close;

// Trailing Stop
    ...
    If IntPriceLevel > 0 and HighAfterEntry - EntryPrice >= Round2Fraction(TrailingActCef * SQ_ATR(20)[1]) 

and ... then begin
       ...
    end;

Attachments
trailing activation.png
(14.88 KiB)
Strategy 43138.sqx
(54.06 KiB)
comparison print.png
(66.80 KiB)
  • Votes +3
  • Project StrategyQuant X
  • Type Bug
  • Status Refused
  • Priority Normal

History

e
#1

eastpeace

27.02.2021 06:11

Task created

k
#2

Karish

08.04.2021 20:17
Voted for this task.
HH
#3

Hans

13.04.2021 17:22
Voted for this task.
e
#4

eastpeace

28.04.2021 11:39
Voted for this task.
MF
#5

Mark Fric

12.05.2021 09:45

Status changed from New to Refused

you are right that this is one way how it could work - TS will be active once it has been activated.


Unfortunately, we don't have it like this - activation level is checked every time and modifying this would change results of all the existing strategies, so we cannot do it.

We'd have to make a second type of Trailing Stop that would behave like this.



In any case, I don't think one style or another causes that much difference in trading, we have bigger priorities with much bigger impact now.


Votes: +3

Drop files to upload

or

choose files

Max size: 5MB

Not allowed: exe, msi, application, reg, php, js, htaccess, htpasswd, gitignore

...
Wait please