Adaptrade Software. Innovative software for active traders.

Market System Analyzer (MSA)

MSA is a money management and portfolio analysis tool for traders. MSA makes advanced methods, such as position sizing optimization and Monte Carlo analysis, accessible to any trader. With MSA, your position sizing will be based on data-driven, back-tested results, tailored to your risk-based requirements. MSA can help you improve your trading.

Adaptrade Builder

Adaptrade Builder is an advanced trading strategy generator. It uses artificial intelligence to design and code original trading strategies based on your performance specifications. Builder can quickly discover, code, and test thousands of unique and complete trading strategies for popular trading platforms, saving you time and money.

MSA and Builder. The tools you need to be a better trader.

Recent Articles from Adaptrade Software

Weekly Strategies Using End-of-Week Exits

In the most recent release of Adaptrade Builder (version 3.1), I added an end-of-week order type. I also added an option to the "Exit after" time exit order so that it can be restricted to a specific day of the week, such as Friday. This effectively means the Exit-after order can also be used to exit at the end of the week. I added this functionality partly in response to user requests. Many traders want to end the week flat to avoid holding positions over the weekend when news events can affect their positions. It can be frustrating to be locked into a trade until Monday morning, knowing that it's vulnerable to events that may happen while the market is closed.

To illustrate how these new order types work, this article will demonstrate how to develop a trading strategy that exits at the end of the week using Adaptrade Builder. Trading strategies will be developed for both daily bars and 30-minute bars of the E-mini S&P 500 stock index futures. I'll discuss the settings, how the order types work, and provide the project files for both build projects.

Implementing an End-of-Week Exit

While it might seem that it would be a simple matter to add an end-of-week order type to a strategy, there are several complications. For one thing, the actual end of the week is the closing price on the last day of the week. That means you need an order type that can exit on the close. Of the scripting languages that Builder supports (EasyLanguage, NinjaScript 7, NinjaScript 8, MQL4, and AFL), only EasyLanguage provides a "market on close" order type, and only EasyLanguage and NinjaScript (both 7 and 8) have optional settings for exiting at the end of the session, which work for both daily and intraday bar types. However, the setting in NinjaScript ("IsExitOnSessionCloseStrategy" in NinjaScript 8; "ExitOnClose" in NinjaScript 7) applies to all days; it cannot be restricted to a specific day of the week.

Another complication is that we don't know if the current day is the last day of the week until the next day, at which point the prior day can be checked to see if it was in fact the last day of that week. For most markets, of course, the trading week ends on Friday, and almost all trading weeks end on Friday other than those for which Friday is a holiday. While this is seldom a problem (i.e., it's only a problem for markets that don't trade on Friday, for markets where the trading week doesn't end on Friday, or for trades taking place during a week where Friday is a trading holiday), it's something to keep in mind.

Only EasyLanguage code allows for a true end-of-session order type that can be restricted to Friday ("SetExitOnClose" command). This is enabled simply by checking for the day of the week and sending the SetExitOnClose command if the day of the week is Friday. This works for both daily bars and intraday data. The code for this is as follows: