Simulate Intraday Trading

Simulate Intraday Trading

Add capability for Simulations to enable intraday trading of buy and sell rules.

I would like to simulate buy rules like:
Price < Close(1)
Price / Close(1) < 0.xx
If the High and the Low indicate that range during the day would have triggered a Limit order set up like that.

I would like to simulate sell rules like:
PctFromHi < -xx
GainPct > xx
If the High and the Low of the day indicate that the range during the day would have triggered a Limit order or stop loss order set up like that.

The buy or sell rules would be triggered if the Sim was run with daily or weekly rebalance. I don’t see much value with longer rebalance.
View the feature request here.

Well put, Denny. I’ve had a similar feature request pending for almost two years now, but I’ll vote for yours too.

I voted for this but my requirements a bit different to that described above.

I trade using stop orders set at specific price levels, for both entries and exits. I never buy or sell at the open, nor the close.

So my feature request would be more specifically called “Simulate intra-day stop orders”.

Note that intra-day data is not required. For a stop-entry order, you know it was triggered on a particular day if the High >= stop-entry order price. Similarly, you know a stop-exit order was triggered if Low <= stop-exit order price.

Hi,
I agree that these requirements are crucial. Put simply, we need the capability in P123 to simulate stop and limit orders on both entries and exits.

Don

I also posted a similar feature request last month (No 538)

[i]The ability to simulate the impact of limit orders on both buy and sell is highly desirable. The feature should enable simulation of the real world impacts of trading in this manner. In the following LimitPrice(bars) is used to represent the name of the desired new function:

  1. should be able to specify how many days the limit is in place for (or default it to the re-balance frequency if not specified to simulate a good till canceled order). This allows simulation of say setting a limit to run for the week between rebalances. e.g. LimitPrice(3) = close(0) will be evaluated as true if the Low during the next 3 trading days falls below close(0). LimitPrice() = close(0) would be true if the low during any day up to the next re-balance dropped below the previous close

  2. the transaction price for the sim is the price at which the limit is set e.g. LimitPrice(3) = Close(0)*0.97 sets the price at 97% of previous close for example. This overrides the ‘last close’ or ‘next open’ global option and any slippage for the sim if such a rule evaluates to true in the set of buy or sell rules. Would need to allow the sim to mix limits on buy with next open for sell for example - i.e. the nornal defaults are active unless the LimitPrice function is used.

  3. if the limit price is not not achieved in the period for which it is active the sim does not select the next best ranked stock from the list but instead leaves the allocated sum uninvested until the next rebalance. Simulates the inability in the real world to know in advance which possible trades will not drop to the desired limit price
    [/i]

Feature request

I can see a slight issue here. AFAIK most data sets don’t contain full intraday data. Having just the Low and High for the day may not be sufficient, if you don’t know what order they came in. For example, if you have a stop that is above the low of the day, but a limit order to sell that is below the high, which one gets executed?

This is certainly an issue in other backtesting platforms which use daily data without intra-day data. I think in Tradestation, the order that is closest to the previous bar’s close is triggered first.

I’ve also read somewhere else, (but I can’t remember on which platform, but I keep thinking it’s in a newer version of Tradestation), that if there is no intra-day data it assumes the following:

If close > open, the low was reached before the high
If close < open, the high was reached before the low

These are a number of ways of attempting to handle the situation where there is more than one order that is triggered in the same bar.

I think doing either is still better than not addressing the issue at all, and better than not implementing simulating stop orders. Assuming that every trader trades only at the market open on Mondays is foolish.