Server-side backtests
The implementation of server-side backtesting improved speed, performance and reliability and also prepared the application for automatic trading systems introduced in version 10. The transition to automatic trading required modification of some existing instructions and addition of new instructions which are outlined in this page.
Notes on compatibility of code between version 9.2 and 10 : If you have instructions in your trading system codes that are not compatible with version 10, these instructions will be replaced with compatible instructions the first time you launch version 10. As a result, we suggest you check your trading system codes the first time you launch version 10. The list of instructions that have been removed or modified in version 10 is listed at the bottom of this changelog. Example:
- The instruction
will be replaced with PositionPerf(1). PositionPerf is the new command that replacesPreviousTrade(1)PreviousTradeand does the same thing. - The instructions
Buy 10will be replaced with Buy 1 Share. The instruction%Capital%Capitalwas removed in version 10.
Note on saving code in version 9.2 and 10: Changes you make to your code in version 10 will not be transferred to version 9.2. Changes you make to your code in version 9.2 after version 10 becomes available on your account will not be transferred to version 10
Programming interface changes
The programming window has been redesigned to allow you to backtest a trading system or prepare it for automatic trading in ProOrder. For security reasons and to ensure compatibility with automatic trading, Stops, targets and order management parameters (such as CumulateOrders and NoCashUpdate) must now be defined in the code. Order management parameters of any pre-existing trading strategies are transferred to version 10 the first time you launch it.
New assisted creation window :
It is still possible to easily define the conditions of your trading system and your stops in assisted creation mode. Once your conditions have been defined, click "Generate code".

New creation by programming window :
If you used assisted creation to generate your code, it will then be shown in the creation by programming window. Any stop and target levels you defined with assisted creation will be directly included in the code. The programming window has several enhancements including :
- Presence of line numbers for easier code editing
- Improved "Insert function" button which provides help text for each function with examples including the newly added functions
- New keyboard shortcuts such as Undo (Ctrl + Z) , Redo (Ctrl + Y), Copy (Ctrl + C), Paste (Ctrl + V) and Find / Replace (Ctrl + F).

New instructions
New constants
- TickSize: TickSize of the instrument (smallest unit of variation of price).
Example: 0.5 for Dax future. - PointSize or PipSize : Size of one point or size of one pip.
Example: 1 For Dax Future. - PipValue or PointValue : Value of one point in the currency of the instrument.
Example: 25 for Dax future.
New status variables
- PositionPrice : Average entry price of the currently open position excluding brokerage fees.
- StrategyProfit[n]: Gain or loss since the beginning of the trading system as of the close n bars ago.
Modified status variables
- TradeIndex(n) : Index of the bar where the nth last order was placed. This replaces the previous instruction
ENTRYINDEX[n] - TradePrice(n) : Price of execution of the nth last order (entry or exit). This replaces the previous instruction
ENTRYQUOTE[n] - PositionPerf(n) : Gain or loss in % of the nth last position not including brokerage fees. This replaces the previous instruction
PreviousTrade(n)
New parameters that can be defined at the beginning of the code
- DefParam: Allows you to define parameters. See the following instructions for examples. Defparam instructions must be placed in the first lines of the code.
- CumulateOrders: Makes it possible to add to a position size once it has been opened. This instruction is true by default.
Example: Defparam CumulateOrders=False
If you use the instructions to set a stop loss, trailing stop or profit target with cumulate orders activated, the level is calculated based on your positions average entry price and is recalculated each time the position's quantity is modified. - PreloadBars: This parameter lets you set the maximum amount of bars that are preloaded prior to the start of a trading system for the pre-calculation of indicators used in the system. By default this parameter is equal to 200.
Example: Defparam PreloadBars=500 - NoCashUpdate: This parameter is deactivated by default and may be used only for backtesting. If activated, it means the initial capital of the trading system is not updated with gains and losses.
Example: Defparam NoCashUpdate=True - FlatBefore=HHMMSS and FlatAfter=HHMMSS: make a trading system flat and block all entry orders before / after a certain time.
- MinOrder=n and MaxOrder=p: block all orders whose quantity is below n or above p.
New trading system commands
- QUIT: Stop the trading system, close all positions of the system and cancel all pending orders of the system.
- SET TARGET PROFIT x: Set a profit target to close the position x units from the position entry price.
- SET TARGET pPROFIT x: Set a profit target to close the position x points from the position entry price.
- SET TARGET %PROFIT x: Set a profit target to close the position when profit reaches x%.
Example: SET TARGET %PROFIT 2 // sets a profit target of 2%. - SET TARGET $PROFIT x: Place a profit target order of x € or $ (currency of the instrument).
- SET STOP LOSS x: Set a stop to close the position x units from the position entry price.
- SET STOP pLOSS x: Set a stop to close the position x points from the position entry price.
- SET STOP %LOSS x: Set a stop loss to close the position when loss reaches x%.
- SET STOP $LOSS x: Set a stop loss to close the position when the loss reaches x € or $ (currency of the instrument).
- SET STOP TRAILING y: Set a trailing stop of y points.
- SET STOP pTRAILING y: Set a trailing stop of y points.
- SET STOP %TRAILING y: Set a trailing stop of y%.
- SET STOP $TRAILING y: Set a trailing stop of y € or $ (currency of the instrument).
- SET STOP LOSS x TRAILING y : A stop loss is placed at x units from position entry price and it becomes a trailing stop of y units if the trailing stop level becomes closer to current price than the stop loss level.
- SET STOP LOSS x $TRAILING y : A stop loss is placed at x units from position entry price and it becomes a trailing stop of y $ or € (currency of the instrument) if the trailing stop level becomes closer to the current price than the stop loss level.
- SET STOP LOSS x %TRAILING y : A stop loss is placed at x units from position entry price and it becomes a trailing stop of y% if the trailing stop level becomes closer to the current price than the stop loss level.
- SET STOP $LOSS x TRAILING y : A stop loss of x $ or € (currency of the instrument) is placed and it becomes a trailing stop of y units if the trailing stop level becomes closer to current price than the stop loss level.
- SET STOP $LOSS x $TRAILING y : A stop loss of x $ or € (currency of the instrument) is placed and it becomes a trailing stop of y $ or € (currency of the instrument) if the trailing stop level is closer to the current price than the stop loss level.
- SET STOP $LOSS x %TRAILING y : A stop loss of x $ or € (currency of the instrument) is placed and it becomes a trailing stop of y% if the trailing stop level becomes closer to the current price than the stop loss level.
- SET STOP %LOSS x TRAILING y : A stop loss of x% is placed and it becomes a trailing stop of y units if the trailing stop level becomes closer to current price than the stop loss level.
- SET STOP %LOSS x $TRAILING y : A stop loss of x% is placed and it becomes a trailing stop of y $ or € (currency of the instrument) if the trailing stop level is closer to the current price than the stop loss level.
- SET STOP %LOSS x %TRAILING y : A stop loss of x% is placed and it becomes a trailing stop of y% if the trailing stop level becomes closer to the current price than the stop loss level.
- ROUNDEDUP or ROUNDEDDOWN : Round a quantity of securities to be bought or sold up or down when the quantity is defined in cash (stocks only).
Example: BUY 1000 CASH ROUNDEDUP AT MARKET
Notes:
- Brokerage fees are not taken into account for any calculation of stop or profit target levels.
- Only one "Set Stop" and one "Set Target" command can be active at a time for a given code. If there are successive "Set Stop" or "Set Target" commands in the same code, the last command replaces the previous command. It is possible to combine fixed and trailing stops with a single "Set Stop" command as described in the previous section. For more detailed information about this, consult the updated trading systems manual.
- It is possible to use "Set Stop" commands within conditional "If" commands to set different types of stops in different conditions.
Syntax change for absolute price stops and limits
- The instruction
SET STOP <price>was removed. It is possible to use one of the following instructions in its place : SELL AT <price> STOP, EXITSHORT AT <price> STOP. - The instruction
SET LIMIT <price>was removed. It is possible to use one of the following instructions in its place : SELL AT <price> LIMIT, EXITSHORT AT <price> LIMIT.
The orders mentioned in this section orders work in the same way as BUY/SELLSHORT <quantity> SHARES AT <price> LIMIT/STOP. They are valid for one bar by default, but it is possible to change the validity (consult the manual for more information).
Removed instructions
Instructions to buy or sell a percentage of capital or liquidity : Automatic trading systems executed with ProOrder do not have a set amount of initial capital or liquidity attributed to each one. They instead control maximum exposure can be by limiting position size. As a result, the following instructions have been removed:
BUY x %CAPITALBUY x %LIQUIDITY
These instructions should be replaced in with instructions to buy or sell specific amounts.
Example: BUY 1 CONTRACT or SELL 1 CONTRACT or SELLSHORT 1 CONTRACT or EXITSHORT 1 CONTRACT
For stocks, it is possible to define amounts to buy or sell in cash amount, brokerage fees excluded.
Example: BUY 1000 CASH ROUNDEDDOWN AT MARKET
Instructions to buy or sell at prices unknown at the time the order is placed : Market orders may only be executed if a condition is verified at the close of a bar. The price obtained in this case will be the best available price at the next bar's open. It is not possible to buy at the current bar's close, or at today's or a future day's close. As a result, the following instructions have been removed:
ThisBarOnCloseTodayOnCloseTomorrowClose
The instruction "Buy 1 Share at market" will buy by default at the open of the next bar after the condition is met. It is also possible to use the instruction "NextBarOpen". The instruction "Buy 1 Share at market TomorrowOpen" can be used to place a buy at market price order at the open of the next trading day.
Variable containing a price unknown at the time an order is placed : The variable "OpenOfNextBar" contained the opening price of the bar following the current one. This variable was removed because it is impossible to know this price in an automatic trading situation. This instruction should not be confused with "NextBarOpen" which is an instruction that can be used to place an order at the opening price of the next bar and is still available as shown in the last section.
For a complete view of all instructions, check the updated trading systems manual.