Emerald product-development portfolio
Add a New Condition to a TradeStation Strategy—Without Changing Its Code
Trade When True places a separately defined EasyLanguage condition between an existing strategy’s signals and the trades it is permitted to make.
A trader may have a strategy whose basic entry and exit logic is useful, but still want to add one more requirement before that strategy is allowed to trade.
If the source code is available, a skilled EasyLanguage developer could modify it. But the trader may not be a developer—or the strategy may be a protected or black-box product whose code cannot be viewed or changed.
Trade When True was developed to add that additional condition without rewriting the original strategy.
More than an outside trading boundary
Most Start and Stop Trading features place boundaries around an existing strategy: stop after a daily profit or loss, trade only during specified times, or exit before the market closes.
Trade When True is different. It can alter when the underlying strategy’s entries are permitted by requiring a separately specified condition to be true. The original strategy continues to generate its own signals, but those signals can produce entries only while the added condition permits trading.
The condition may be a single EasyLanguage True-or-False statement using prices, times, indicator values, trade counts, built-in functions, or custom functions. When the condition changes to false, the user may choose whether an existing position remains open for the original strategy to manage or is exited by Trade When True.
“Use the strategy’s original signals—but allow long entries only while RSI is above 50.”
What kinds of conditions can be added?
Time and trade count
Allow trading only from noon through 3:00 p.m., provided the strategy has made fewer than three entries that day.
Moving-average relationship
Allow trading only while a nine-bar simple moving average remains above an eighteen-bar exponential moving average.
Momentum and trend strength
Require Stochastic Fast K to exceed Fast D while ADX is above a specified level.
Custom market condition
Use a built-in or custom EasyLanguage function to express a specialized rule that cannot conveniently fit into a single statement.
A condition can be much more complex than these examples. If the required calculation cannot be expressed conveniently in one line, a custom EasyLanguage function can perform the calculation and return the required True-or-False value.
Four inputs control the documented strategy
- The condition: A valid EasyLanguage statement that returns True or False.
- Whether to exit when it becomes false: If enabled, an open position is exited with a market order at the following bar’s open.
- Whether to exit at the current bar’s close: An alternative intended particularly for accurate testing with price-based bars such as Range, Momentum, Renko, Kase, Kagi, Line Break, and Point & Figure.
- Online help: Opens the documented user manual.
Several conditions can work together
The standalone Trade When True strategy can be inserted repeatedly, but the documented version allows only the topmost copy to control the trades. The combined Start and Stop Trading product expands that capability: it can be inserted as many as ten times with distinct Trade When True conditions.
Those conditions are combined with AND logic. Trading is permitted only when every enabled condition is true. If even one becomes false, trading is no longer permitted. This makes it possible to separate a complicated rule into understandable components—for example, a permitted time, an indicator relationship, a volatility requirement, and a limit on the number of entries.
What remains unchanged
Trade When True does not supply the original buy-and-sell strategy and does not decide what constitutes a desirable trade. It works alongside built-in, custom, protected, and certain black-box strategies on the same chart. The underlying strategy still generates its theoretical signals; Trade When True determines whether the added permission condition is satisfied.
The trader remains responsible for the rule, its meaning, its behavior in historical testing, and whether it is appropriate for live use. A technically valid EasyLanguage expression is not necessarily a sound trading rule.
