< All Topics

Overcoming Two Critical TradeStation Strategy Bugs

The Problem

There are two critical bugs in TradeStation that effect the results of our strategies.  They occur in certain situations when SetStopLoss or SetStopContract are used.

Bug #1 : If using SetStopContract or SetStopShare with backtest option “Fill entire order when trade price exceeds limit price”, then SetProfitTarget gives incorrect results.
https://community.tradestation.com/Discussions/Topic.aspx?Topic_ID=155584
https://community.tradestation.com/Discussions/Topic.aspx?Topic_ID=191991

Bug #2 : If using SetStopPosition (the default) and continuous contract symbols have negative prices (such as CL, RB, HO, S, etc), then SetStopLoss and SetProfitTarget give incorrect results.
https://community.tradestation.com/Discussions/Topic.aspx?Topic_ID=142849

Kevin reported Bug #1 in 2018. I reported Bug #2 in 2015. It is now Dec 2023 as I am writing this article and neither have been fixed regardless of multiple pleas from the user base. I have given up hope long ago that these will ever be corrected.

The Workaround Solutions
Kevin’s Close-On-Bar Solution

Kevin has a workaround solution that uses “soft” stop loss and profit targets that exits at the close of the bar:

if openpositionprofit < -stopl then Begin
   sell ("SLL Exit") next bar at market;
   buytocover ("SLS Exit") next bar at market;
end;

if openpositionprofit > proft then Begin
   sell ("PTL Exit") next bar at market;
   buytocover ("PTS Exit") next bar at market;
end;

Part of me likes this approach because it avoids the need for LIBB, which can cause strain on TradeStation when running many strategies. But there are situations when I don’t want to be exposed to the risk of waiting until the close of a bar to evaluate a stop, only to find that the loss far exceeded the original stop.

I am working on a solution that will replace both SetStopLoss and SetProfitTarget, but uses stop and limit orders and maintains entry-bar protection.  E-mail me for more information or check back here for updates.

Table of Contents