Impulse signals are Buy and Sell signals that occur at the beginning and end of trades. They often occur for a single bar, such as the bar where an indicator crosses a critical level, or when one of the trading rules is satisfied. Impulse signals are the default type of signal for most traditional trading system development platforms.
State signals have a value for every bar. The signal tells the trader what the position should be for the next period. In a system that trades a single stock and alternates between long and flat positions, there are two states: I will refer to them as beLong and beFlat. State signals can be used with traditional platforms and are always used with machine learning.
The following table illustrates.
The system trades a single stock long/flat, entering and exiting at the close of trading using MOC (market on close) orders. The system uses the data available just before the close of trading to compute its next signal and issue that signal in time for trading at the close. The system is flat through day 1 and day 2. Just at the close on day 2, it issues a signal to enter a long position. That long position is held until the close on day 6, when the system issues a signal to exit the long position.
Using impulse signals, there is a Buy at the close on day 2 and a Sell on the close of day 6. No other signals are given by the system. There is no management of the trade at any time other than those two signals.
Using state signals, there has been a sequence of beFlat signals for the days preceding day 1, and for day 1. Just before the close of day 2, the system issues a beLong signal, telling the trader to enter a long position at the close of day 2 in order to be long for all of day 3. beLong signals are given for days 3, 4, and 5. Since that is the same signal as the preceding day, the trader will hold that long position for days 4, 5, and 6. Just before the close of day 6, the system issues a beFlat signal, telling the trader to exit the long position MOC of day 6, and begin a series of flat days with day 7.
Here is another diagram that illustrates the relationship.
Whether the system is using impulse or state signals, it is analyzing the data every day. When impulse signals are used, there is typically no reporting and no management other than days when new signals are issued. When state signals are used, there is reporting every day and an opportunity for trade management every day. Changing from impulse signals to state signals changes the way we view trades. From some number of bars between the buy and sell impulses where there is no action or opportunity for trade management, to a series of single-day marker to market trades.
To reiterate. Using impulse signals, each trade is one data point — however many days that trade lasts. Using state signals and marking-to-market daily, each day is one data point.
All trading system development platforms have the capability of creating and using state signals, and of converting between state signals and impulse signals. There may be a built-in function, such AmiBroker’s flip function. If there is not, a simple loop in the programming language of your platform will do the job.
I recommend using state signals for the following reasons:
- State signals provide finer control over trade management. The health of the system is reevaluated every day at the same time it is marked-to-market. This is also the frequency that position size is readjusted using dynamic position sizing to recompute safe-f for the next day.
- During backtesting, optimization, and validation, only those trades that are completely within the evaluation period can be used. That is, only those that are both opened and closed within that time period. Trades that are open at the beginning of the period and those that are open at the end of the period may be artifacts of the testing and are not reliable — they must be excluded, reducing the amount of data upon which validation will be based. When using state signals, at most one bar is lost from either end of the data period.
- As you move from traditional trading system development to machine learning, each bar requires a target. When state signals are used, the signal is that target.
The equity calculations for a series of trades delimited by impulse signals and for the equivalent series of marked-to-market days signaled by state signals are identical.