Support

Equilla Formula Language

Order Processing

Phases of order processing

Order processing is split into multiple phases in Equilla.

Phase 1 – Processing of orders based on the open price

First tradesignal processes Next Bar at Market orders, generated on the previous bar. Orders that can not be filled on the open price will be cancelled.

In the next step tradesignal is checking Next Bar Stop and Next Bar Limit orders. Orders of these types that can not be filled by the opening price remain active until the bar is closed. (See phase 3)

Phase 2

On historic bars this phase is processed only once however for real-time bars it is processed for every tick. This phase breaks down into three sub phases:

Phase 2.1 - Processing of stop and limit orders

For historic bars it checks the high, low and close prices. The sequencing depends on the distance of the high and low from the open price. tradesignal assumes the price which is closer to the open price has occurred earlier. If one of these prices matches a stop or limit price in the correct direction the corresponding order is filled.

For real-time bars the last price generated by each tick is used to check limit and stop fills.

Phase 2.2 – Evaluating Scripts and generation of new orders

tradesignal evaluates all relevant scripts which may update existing orders generated on this bar or generate new ones. An order that has been generated on this bar and already been filled can not be updated anymore.

Please note: An order generated on the previous bar can not be modified during script evaluation on this bar.

Phase 2.3 - Post script processing

Equilla tries to fill all This Bar Orders generated in the previous phase in the following order:

1. This Bar At Market
2. This Bar At Price

Phase 3 – Close processing

When the bar closes tradesignal checks if any This Bar On Close order can be filled and all unfilled Next Bar Stop and Next Bar Limit orders, generated on the previous bar, will be cancelled.

Priorities

Equilla is applying the following rules when evaluating orders:

1. Market orders will be evaluated before price orders.
2. Price orders will be evaluated before limit and stop orders.
3. Entry orders will be processed before exit orders.
4. Buy/cover orders will be processed before sell short/sell orders, exit position orders will be processed last.
5. The sequencing of limit and stop orders depend on the actual price attached to the orders. tradesignal checks which condition is met first and processes the corresponding order first.

Period of validity

Depending on the specified mode the period of validity of orders differs.

This Bar at Market This Bar at Market orders are valid only for the current evaluation. If it can not be filled immediately it will be cancelled.
This Bar at Price This Bar at Price orders are valid only for the current evaluation. If it can not be filled immediately it will be cancelled.
This Bar at Close This kind of order is valid only for the current evaluation and only if the bar is closed. If the order can not be filled by the close price it will be cancelled.
Next Bar at Market This order is valid only at the open of the next bar. If the order can not be filled by the next bars opening price it will be cancelled.
Next Bar at Price Stop/Next Bar at Limit These orders are only valid on the next bar. They will remain active until they get filled or the corresponding bar is closed.

Price selection

Historic Bars

Phase 1

All orders will be filled at the open price.

Phase 2.1

When processing historic bars tradesignal only uses the open, high, low and close prices of these bars. In order to simulate a realistic price flow, tradesignal examines the prices to determine the direction of the bar. If the difference between the open and low price is less than or equal to the difference between the high and open price, tradesignal assumes the low price was reached first.

In addition to the bar assumption algorithm, tradesignal supports the Intrabar Tick Simulation property in the Money Management section of the properties. When an order gets filled based on one of the standard prices (open, high, low or close), tradesignal processes an additional artificial price. The artifical price is calculated by adjusting the fill price by the specified percentage of the bars high/low range. For buy orders the fill price is decreased for short orders it is increased.

Phase 2.3

This Bar at Market orders are executed at the bars close price.
This Bar at Price order are executed at the specified price.

Phase 3

All orders are filled at the bars close price.

Realtime Bars

After all historic bars have been processed, tradesignal switches into realtime mode. In realtime mode tradesignal ensures that orders are checked against every new price. Which prices are processed depends on the Realtime Price Source property in the Money Management section.

SourceDescription
Last tradesignal processes all last prices delivered by the data provider.
Bid/Ask If an order router is connected and the module supports this feature, the best bid/ask prices are provided by the broker, otherwise the best bid/ask prices of the data provider are used.

Analysing results

tradesignal provides a number of possibilities to analyse the performance of your strategies and executed orders.

The chart automatically displays an arrow for every filled order. Indicators like “Strategy Equity” are visualizing the profit of your strategies.

The Performance Report shows a number of statistic values as well as a complete list of executed orders.

The Position Manager is showing the real-time status of your strategies and positions. Additionally a list of currently relevant orders (Working Orders), filled orders (Filled Orders) and cancelled orders (Cancelled Orders) is available.

See also:

Buy; Sell; Short; Cover; ExitPosition;