Traling stop does not work

Traling stop does not work,as shown in the figure

{
if(MarketPosition > 0) then begin
If BarsSinceEntry = 0 then begin
LongSL = 0;
end;
LongSLPlaced = false;
// StopLoss
LongSL = Round2Fraction(EntryPrice - (3.0 * SQ_ATR(20)[1]));
LongSL = SQ_CorrectMinMaxSLPT(LongSL, MinimumSLPT, MaximumSLPT, true);


Sell("LongSL") next bar at LongSL stop;
LongSLPlaced = true;

         
// Trailing Stop
PriceLevel = 1.0 * SQ_ATR(15)[1];        //Choose a very tight Trailing Stop
If PriceLevel > 0 then begin
If CurrentBid - EntryPrice >= 0 and (LongSL = 0 or LongSL < CurrentBid - PriceLevel) then begin
LongSL = CurrentBid - PriceLevel;
Sell("LongTrailingStop") next bar at LongSL stop;
LongSLPlaced = true;
end;
end;   

if LongSLPlaced = false and LongSL > 0 then begin
// no SL activated this bar, use default one - handling if there is no SL, only Trailing stop or Move2BE
Sell("LongSLD") next bar at LongSL stop;
end;

end;
}

Attachments
Strategy 4574trailing stop .sqx
(54.76 KiB)
trailing stop 2.png
(135.48 KiB)
trailing stop 1.png
(179.23 KiB)
Build 118 trailing stop .cfx
(21.25 KiB)
  • Votes +4
  • Project StrategyQuant X
  • Type Bug
  • Status Fixed
  • Priority Normal

History

cj
#1

cjl

02.02.2019 08:25

Task created

cj
#2

cjl

02.02.2019 08:33
Voted for this task.
RL
#3

rickliao

02.02.2019 08:43
Voted for this task.
e
#4

eastpeace

02.02.2019 09:42
Voted for this task.
m
#5

mabi

02.02.2019 14:11
Voted for this task.
cj
#6

cjl

08.02.2019 13:18

Attachment RetestBE.cfx added

Attachment Strategy 5756BE trade525.sqx added

Attachment 525.jpg added

Attachment 1162.jpg added

Attachment 1833.jpg added

The Tradestation Engine Problem in Move SL 2 BE It's up there, too.

Like Traling stop, there is a chance that stops will not be executed


Number of transactions 525、1162、1833
it is questionable that


0.1 * SQ_ATR(45)[1] Conditions are very easy to trigger


    // Move SL to BE
    PriceLevel = 0.1 * SQ_ATR(45)[1];  //
    If PriceLevel > 0 then begin
        If (Entryprice <= CurrentBid - PriceLevel) and (LongSL = 0 or LongSL < Entryprice + 0) then begin
            LongSL = Entryprice + 0;
            Sell("LongSL2BE") next bar at LongSL stop;
            LongSLPlaced = true;
        end;
    end;
MF
#7

Mark Fric

11.02.2019 15:45

Status changed from New to Fixed

I found the problem, it will be fixed in the new build

Votes: +4

Drop files to upload

or

choose files

Max size: 5MB

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

...
Wait please