How to fill at today’s close

Of course in real trading there is no way (normal) traders can exit on the closing price. You could exit very close to the close, of course, but if you aren’t using the DayTrader Professional, you cannot get automatic signals near the close. (Manually you can. See the Tip “How to access the active (red) bar being formed (9/15/2006)”). Nevertheless, many of our users want to backtest assuming that they were able to exit during the day and get a fill at the closing price, (even though they know this is unrealistic in real trading). Here is how you can do that using daily bars:

The key is to generate your exit order not on “market”, but on “marketclose”. Marketclose, however, exits on tomorrow’s market close, not today’s. Therefore, in order to use it you have to decide yesterday that you will be exiting today (since you are already being unrealistic, this should not be a problem either). So to decide yesterday that you will be exiting today, you will make appropriate use of the Lead indicator yesterday (the Lead indicator looks at tomorrow).

For example, suppose your exit condition is that a moving average crosses below the close. (Again, you would never know this until the close occurs, by which time it is too late to fill on the close, but we are being unrealistic for backtest purposes anyway, right?) So you change the exit condition to be that the 1 day lead of the moving average crosses below the 1 day lead of the close. The exit condition for today fires yesterday, and marketclose gets you out at today’s close.

You cannot use the Lead of the crossover, you have to use the crossover of the Leads. There is a technical reason for this – NeuroShell wants true/false indicators in trading strategies, and Lead is not true/false.

Was this article helpful?

Related Articles