Steps to create an automatic trading system
If you already have an idea of the strategy you want to use, you can go directly to step 4.
Because we want to make automatic trading more accessible, we also give you the possibility to create trading systems with no programming required.
1 The initial idea
Determine the conditions to buy / sell
From an "initial idea", you will define the buying and selling conditions of your strategy. ProRealTime then allows you to test these buying and selling conditions before deciding to actually use them. You can then easily decide whether or not you want to continue with this idea and later improve it based on your experience.
Your replies to the following questions may give you an initial idea of the type of strategy you want to create:
- Do you have a trading method you saw in a book or on the internet that you would like to test?
- What are your favorite indicators among the numerous ones available to you?
- Do you want to take into account high and low prices in your buying and selling decisions?
- Should your system take into account one condition or multiple conditions?
- Do you want to use a trend-following strategy or a counter-trend strategy?
- Do you want to only take long positions or also take short positions to also benefit from downward trends?
- Do you want to base your market exits on conditions related to technical analysis or on money management techniques (target and protection stop orders determined based on the position entry price)?
In general, a strategy starts with a simple idea which can be progressively improved.
For example, strategies may be based on a combination:
- of trend-following indicators (moving average, etc.) or overbought/oversold oscillators (RSI, Stochastic, etc.)
- of retracements (Fibonacci, pivot points, etc.)
- of breakouts of local price highs or lows
- of divergences (or counter-trends) between price and an indicator
- of unusual volume
Use ideas from your manual trading experiences
If you already invest in financial markets the best inspiration may be what already works for you when you do "manual" trading.
Manual trading may be seen as permanent experimentation and automatic trading as the automatization of techniques you already successfully apply in manual trading.
Get ideas from outside sources
Many books talk about trading strategy and may suggest trading ideas or complete strategies which you can test.
2 Choice of instrument
Once your initial idea is determined, you then need to determine the financial instruments on which you want to test your strategy. This section may give you some ideas which could be taken into account when making your choice.
Liquidity: is the instrument you want to choose liquid enough that your trading system will be able to close a position at any time in good conditions?
Trading hours: do you want your strategy to be able to take positions at night and as a result use instruments which quote 24 hours per day during the week?
Opening gap: the more limited trading hours a market has (ex: from 9:00 to 17:35), the greater the risk of an open the following day with a significant gap between the previous closing price and the new opening price. To limit this risk, it is possible to invest in markets that quote 24 hours per day or markets with more limited closing times (ex: from 23:00 to 8:00). To avoid the risk of an opening gap, you could also plan to close any open position at least 15 minutes before the market closes.
Required margin: make sure you have enough required margin to cover the position(s) of your trading system(s) plus losses which may occur (see margin examples in the table below).
Minimum gain to make: certain trading systems may rely on taking frequent positions for a short time with the goal of making small gains. If using a system like this, it might be interesting to use an instrument for which the ratio of "Execution cost" (taking into account the spread and brokerage fees) to "Value of the instrument" is low. The table below includes some examples.
|Instrument||Minimum movement to be profitable*||Required margin|
|Standard contract||Mini contract||Standard contract||Mini contract|
|1 France 40 @4,400||~0.023 %||~0.028 %||150 €||15 €|
|1 Germany 30 @ 9,500||~0.01 %||~0.03 %||750 €||150 €|
|1 Wall Street @ 16,500||~0.011 %||~0.014 %||500 $||100 $|
|1 US 500 @ 1,900||~0.022 %||~0.03 %||1,500 $||300 $|
|1 EUR/USD @ 1.35||~0.006 %||~0.006 %||675 $||67.5 $|
|1 GBP/EUR @1.23||~0.008 %||~0.008 %||615 €||6.15 €|
|500 AXA @ 20 € (10,000 €)||0.1 %||-||500 €||-|
|4,500 AXA @ 20 € (90,000 €)||~0.01 %||-||9,000 €||-|
|500 Intel @ 25 $ (12,500 $)||0.08 %||-||625 $||-|
|500 Visa @ 220 $ (110,000 $)||~0.009 %||-||44,000 $||-|
|Precious metal CFDs|
|Gold (spot) @ 1,250||~0.04 %||~0.04 %||1,250 $||125 $|
|Silver (spot) @ 1,900||~0.16 %||~0.16 %||1,425 $||142.5 $|
Examples based on IG CFD prices with the minimum spread on June 1st 2014.
The spreads may vary and are not always equal to the minimum spread.
3 Money/Risk management
The terms "Money management" and "Risk management" usually refer to rules for:
- Managing capital
- Managing positions
- Managing risk
A well planned money management strategy should allow you to maximize your gains while limiting your risk. Depending on your money management technique, a given strategy may be winning or losing for a given set of historical data.
The questions below may give you some ideas about the type of money management you may want to use:
Leverage: What is the maximum leverage you do not want to go over?
Leverage is calculated as follows: 1 / [available cash / position value]
To limit leverage, you can either limit position size or increase portfolio value.
- Short selling: Do you only want to take buying positions or do you also want to take short selling positions?
- Keep positions overnight or close them: do you want to never be in position ("flat") before the close of the market each day to avoid the risk of an gap between the previous close and the next day's open (also called an opening gap)?
- Investment timeframe: do you want to use an investment timeframe of minutes, hours, days, or more long term?
- Time restrictions: Do you want to put time restrictions on your system, for example to not open new positions after a certain time of day close to the market close?
- Targets: Do you want to use a target with a fixed value that will close your positions once a certain amount of gain has been reached or would you rather close your positions based on technical analysis conditions?
- Protect your positions: do you want to add protection stops based on a maximum loss amount per position or based on a price level on the chart?
- Types of stops: if you use stops, do you want to use fixed stops or trailing stops with levels that are constantly re-evaluated? Learn more about the different types of stops
- Max position size: what is the maximum position size which you do not want to go over?
Note that the maximum position size will be asked each time you start a trading system and will override the conditions in the code.
Maximum number of orders: what is the maximum amount of orders you want your system to execute per day?
(Ex: one round-turn per day or be more active).
Note that the maximum number of orders can be set via the "Trading Options" menu.
4 Transform your idea into a trading system
We have worked to simplify this essential step
To create an automatic system without programming
- In the window that displays the desired instrument, insert and configure the indicators used by your strategy.
- Then, click the button in the top-right of the chart and click "ProBacktest & Automatic trading" and finally, click "New".
- To define your buying conditions (to enter long positions), click the "Buy" button.
- To indicate to the platform what element your buying condition depends on, click the panel containing the element in question (ex: if your condition depends on the MACD, click on the panel containing the MACD).
- The window will then offer you to choose your conditions via dropdown menus. Once your condition is chosen, click "Done" if you are finished or "Add Condition" and restart the option in step 4 to define multiple conditions.
- Optional: you can then repeat steps 3 to 5 to also define conditions to sell your long position, conditions to enter short positions, and conditions to exit short positions.
- Click the "Targets & Stops" button to define your Stops, Trailing Stops, & targets.
Now you just need to click the "Generate code" button.
The platform will create the code based on your conditions!
You can create systems by programming them yourself in ProBuilder language.
ProBuilder language (created by ProRealTime) is easy enough to allow users not used to programming to quickly create ProOrder systems.
We wrote programming manuals for you. Read them at your own pace and learn to create your own systems step by step with many examples:
- Programming Guide - Indicators & Basic Functions (ProBuilder)
- Programming Guide - Trading Systems (ProBacktest & ProOrder)
With its intelligent functions, the code editor will also function as a programming assistant:
- Integrated help: a menu lists all of the functions available with help texts and examples of use for each.
- Real-time error checking: the editor indicates programming errors in real-time as you type
- Automatic formatting: your code is automatically colored and formatted to simplify reading and understanding it
If you have a ProRealTime Trading or CFD account sponsored by ProRealTime, you can benefit from programming assistance by making a request through the dedicated form.
Write to us with your conditions to enter and exit positions and your money management rules while being as precise as possible and we will try to send you a code which corresponds to your requirements.
Please note that ProRealTime does not offer any investment advice. Our programming assistance consists of sending you examples of lines of code that will let you put into practice some or all of the conditions you indicate to us, without any intervention concerning the choice of these investment conditions.
5 Test your trading system
We offer two complementary methods to test your trading systems.
- ProBacktest: Backtest your systems using past data
- PaperTrading: test your system day after day in real market conditions
Simulate your strategies with ProBacktest
The ProBacktest module lets you simulate implementation of your strategy based on historical data in order to get an estimation of what its performance could have been.
As a result, the ProBacktest mode lets you confirm the performance of a system, based on the available information in the historical data, but also detect weaknesses to improve it.
Several years of historical intraday data
Backtesting your system on longer and more reliable data provides more relevant and useful results.
ProRealTime offers several years of intraday historical data. The reliability of this data is maintained by a team dedicated to full-time data maintenance and a direct connection to exchanges.
Launch a ProBacktest simulation with your trading system
Using ProBacktest is easy:
- Display the charting window of the instrument on which you want to backtest your system in the unit of time of your choice for the simulation (ex: 15 minutes).
- Use the "history" dropdown menu (at the top left of the chart) to load the amount of historical data you want to use (ex: 10 000 units).
- At the top of the chart, click on the button then on the tab "ProBacktest & Automatic Trading" and select the system you want to backtest.
- Click "Modify" to access the code editor window. From the "ProBacktest" tab, set the following parameters:
- Initial capital: enter the amount of initial capital for your simulation
- Brokerage parameters; set the brokerage fee which will apply to each transaction in the simulation (fixed amount, %, spread, etc.)
- Max position size: indicate the maximum position size the trading system is not allowed to go over for the simulation.
- Historical data used in the simulation: by default the system will be simulated on all of the data loaded in the chart. Use this option if you want to reduce the time period to simulate the system (ex: from January 1st, 2014 to June 30th, 2014).
- Then you just need to click the button "ProBacktest my system" to launch the simulation.
Analyze the results of the ProBacktest simulation
Once the trading system has been backtested, you can check:
- Its equity curve
- Its position history (in the form of charts)
- Its history of executed orders (in list form or chart form)
- A detailed statistic report
The detailed report will give you many useful statistics such as:
Analysis of gains
- Gain for the simulated period (in % and absolute)
- Gain/loss ratio
- % of winning positions
- Differentiated analysis for long and short positions
Analysis of positions
- Average time position held
- % of time in the market
- Average number of orders per day/month
- Highest loss on a position
- Max. drawdown (historical max loss)
- Average exposure / Minimum exposure
To learn more about ProBacktest, go to page 23 of the trading systems programming manual.
Warning: the statics calculated with ProBacktest relate to past data. Past performance is not indicative of future results.
Simulate a strategy in PaperTrading mode
PaperTrading is a trading simulator that lets you practice trading in real market conditions with a virtual portfolio.
As a result, you can also simulate execution of your trading system day after day in real market conditions with PaperTrading.
It will let you see the positions taken by your trading system in real time and also test your own reactions to automatic trading situations.
After launching your ProRealTime platform in PaperTrading mode, starting a system in PaperTrading mode is done in the same way as in real trading mode, as described in section 6 of this page.
6 Execute your trading system in real trading mode
How to do it?
- Open the chart of the instrument on which you want to execute the trading system
- In this chart, select the unit of time you want to use for the execution of the trading system
- From the top of the chart, click the button, then click "ProBacktest & Automatic Trading" and select the system you want to execute.
- Click the button "Prepare for automatic trading" to send the system to ProOrder.
- The ProOrder window opens. Your system will be in the "Not Running" section of the ProOrder window.
Quicker alternate method - when you are simulating the system with the ProBacktest module, you can drag the system from the charting window to the ProOrder AutoTrading window:
In the charting window, left-click on the "Equity curve" or the title "ProBacktest - Positions", hold the mouse button down and move the cursor to the ProOrder AutoTrading window. When you let go, the system will appear in the ProOrder window in the "Not Running" section.
Set ProOrder options
- From the top of the ProOrder window, click on the button to set options related to ProOrder.
- Position and order status after stop of systems: when a system is stopped, choose if you want ProOrder to close the positions and cancel the pending orders; or keep them to manage them manually.
- Stop due to number of orders: choose a limit to the number of orders a system can place. Beyond this limit, the system will be stopped.
- Stop due to expiration date: for security reasons, all systems have a common validity date, beyond which they will be stopped. To extend the validity date, click "Extend" in the ProOrder window. The "Limit of validity" parameter lets you define the number of days of each extension.
Once these options are set, click the X icon to close the options window and go back to ProOrder.
Start your system
- In the ProOrder window, click the button of your trading system.
- The window that opens asks you to confirm starting your automatic trading system. This window reminds you of important information:
- The instrument and timeframe on which the system will be executed
- The name of the system and its version (which correspond to the date and time it was sent to the ProOrder servers)
- The code of the trading system
- Preferences you set in the ProOrder options
- The conditions of execution of automatic trading systems
- Before starting the system, you have to define the parameter "Max position size". This is the maximum position size your strategy will be allowed to take, regardless of the conditions in the code.
- In one of your systems on the DAX30 Future, you have defined a "Max position size" of two contracts
- Your system already has a long position (buying) of 1 contract
- A new condition of your system is met and asks to buy 2 additional contract to theoretically increase the position size to 3 contracts.
- This condition will be ignored because you defined a "Max position size" of 2 contracts.
- Finally, click the button
Your system will then be displayed in the "Running" section of the ProOrder window and will blink to show it has been activated. Its "Status" will also change from "Not running" to "Running".
7 Monitor and continuously improve your systems
Monitor your systems
When a ProOrder system is being executed, you can check its activity and performance in the ProOrder window of the ProRealTime software.
For each trading system, you can display the equity curve showing the performance (gains and losses) of the system since its beginning.
A precise analysis of the fluctuations of the equity curve can give you useful information to improve your system. For example, how to avoid some of the realized losses or reinforce positions during periods when the system is making gains.
Order and position history
The Position history chart displays histograms showing the historical positions of your trading system. It is notably useful to see if your system is often in position and the average size of the positions.
Order history is displayed on the Price chart. The orders to enter positions are shown by arrows and exit orders are shown by crosses.
Both information are also available in the detailed report window in list format.
The trading detailed report gives you access to about thirty statistics concerning each trading system such as:
- Profit analysis: Average gain per type of position (long/short), percent of winning positions, gain/loss ratio, etc.
- Analysis of your orders and positions: Average executed orders per day, percent of time in the market, average time between two positions, etc.
- Risk analysis: max drawdown, max risk exposure, average risk exposure, etc.
Tip: the detailed report, order list and positions list may be easily exported to external applications such as spreadsheet applications (via drag and drop).
Continuously improve your systems
All the information above will be helpful to you to detect weaknesses in your systems, improve and adapt them to new market conditions.
Note: when you modify a trading system, the old version will remain in ProOrder (unless you remove it manually). To easily show you the difference between old and new versions, ProOrder displays a version number (which corresponds to the date & time you sent the trading system to ProOrder).
Once you are familiar with the basics of the ProOrder module, we recommend that you also read the programming manuals which we carefully wrote for you to be able to program yourself with more independence.
When you improve your system, the ProBacktest and ProOrder modules will be your best partners to confirm your changes via simulation.
- Programming Guide - Indicators & Basic Functions (ProBuilder)
- Programming Guide - Trading Systems (ProBacktest & ProOrder)
Import / Export your systems
Share your systems with friends
Would you like to share one of your systems with a friend?
Its very simple:
- From the "ProBacktest and Automatic Trading" window, select the system you want to share and then click "Export".
- In the next window, select "None, code will be fully editable", then click "Export".
- Your trading system will be exported as a ".itf" file.
- You now just need to e-mail this file to the person of your choice who will be able to easily import it to their ProRealTime platform!
Import a system created by someone else
Did you download a ".itf" file from an Internet site or forum? Did a friend send you a trading system he created?
Here's how to use it in our ProOrder AutoTrading module:
- From the "ProBacktest and Automatic Trading" window, click the "Import" button.
- From the window that opens, select the .itf file from your computer, then validate to import it to your platform.
- The system will now appear in the list of system, in the window "ProBacktest and Automatic Trading".
- Check that the system is adapted to your situation and adapt it if necessary for your own needs. Never use a trading system from a third party without first testing it and adapting it if necessary.
Note: to execute a trading system imported to ProOrder with a real portfolio, its code must be accessible (and modifiable). However, backtesting is possible in any case.