Skip Navigation Links
Simulation / Backtesting Frequently Asked Questions

Running a Simulation / Backtesting

To start a simulation, you must first have data to run the simulation against.  If you have not yet configured historical data, please see the Data Provider FAQ and Watchlist FAQ for configuring a data provider and assigned it to symbols in the Watchlist.

Once historical data is retrieved, you must open or create a trading system.  If you have not yet obtained the trading to run the simulation against, please read the Trading System FAQ.

Now that the data is collected and the trading system is loaded, a system can be executed.  To execute a trading system, select the symbols that are to be a part of the simulation.  Do this be placing a check next to each individual symbol item in the Watchlist or by checking a folder to select all symbols within the folder.  Now click the Run Simulation () item to begin the simulation.

Once the simulation is completed, the simulation results are displayed.  For detailed text on this topic, please read the Analyzing simulation results topic.

Back to the top
Back to the Main FAQ  

Running the simulation through optimization

Optimization is used to test a system with certain variables changed across simulation runs. Running the system with variable parameters or optimization parameters allows the system developer to determine which values result in the most favorable system performance.

Any value in the system can be used as an optimization value.  Technical indicators are usually the first candidates since many accept a number of numeric inputs. Other items such as profit targets and stop loss values are also viable candidates.

To begin using optimizing your trading system in RightEdge, first, a trading system must be loaded.  Once a system is loaded, look at the the Project Properties and locate the System Parameters property as shown below.

 

RightEdge supports any number of parameters in this list.  Each value is treated as a type of double.  Click the Add button to add a new empty parameter.  Use the property grid on the right to name this parameter and assign a default value.

Referencing Parameters

Once optimization parameters have been added to the project, they may be referenced in code.  Using the above parameter, stochBuyValue, we will only perform a buy if the StochK indicator is below our optimization parameter.

 

C# 
if (stochKValue < SystemParameters["stochBuyValue"])
{
    // Perform buy here.
}

Visual Basic 
If (stochKValue < SystemParameters.Item("stochBuyValue")) Then
    ' Perform buy here.
End If

Running an Optimization

Once the optimization parameters are set, select Optimize System from the System menu.

 

Optimization Parameters

This is a list of the parameters set for this system.  The values can be set by double clicking the value.  Set the value by clicking anywhere outside of that value's space.

Low Value

Each system is run starting from the lowest value.  Specify this value for each parameter.

High Value

Optimization stops once the highest value is reached.  Specify this value for each parameter.

Step Size

This is the increment size for each optimization value.  For example, if the low value is 1 and the high value is 11 with a step size of 2, the system will be run a total of six times.

Number of Steps

This is a calculated value based on all previous entries.  This is the number of times the system will be run for this optimization run.

When the optimization run is complete, the optimization results screen is displayed.

 

Run #

Each run is sequentially numbered.  That number is displayed here.

Parameter Value

In the sample above, there is a parameter named "adxThreshold".  The parameter name is shown in the column and the value of that parameter for each run is displayed in the cell beneath.

Summary Items

The remaining items in the list are totals pulled from the system run.  These are the values for both long and short trades.

Double click any run shown to display the full System Results for the run.

Analyzing simulation results

The simulation results screens contain a great deal of information and also a great deal of flexibility when deciding how to utilize the information.  This topic will deal with interpreting the information as well as managing it for your needs with features such as exporting and printing.  This section is broken up into two main areas.  The first area describes the functionality presented within the system results and the second area goes into detail about the information that is presented.

  1. Manipulating System Results
  2. Interpreting System Results
    a. Summary
    b. System Parameters
    c. Position List
    d. Trade List
    e. Symbol Results
    f. Scan
    g. Charts

Manipulating System Results

When a simulation has completed, the system results are displayed in the document area of RightEdge.  The System Results document contains multiple tabs each assessing different aspects of the simulation.

Each tab contains features that are common.  These features can be accessed using a combination of items on the context menus and items in the main menu.  The statistics windows, which are those windows that contain textual information as opposed to graphical information, have ability to export to common formats as well as print.

When a grid is displayed, right click on the grid area.

 

This context menu will allow for exporting.  Supported formats are tab delimited, CSV (common separated) and HTML.  This menu also facilitates displaying system results charts that are not displayed by default.

Each of the grids can also be printed.  Select the desired tab and select Print... from the File menu.

The grids columns for the Trade List, Symbols Results and Scan tabs can also be manipulated and sorted.  To sort, click any of the column headings.  Click once to sort ascending and click the same column again to sort descending.  To move a grid column into another position, click the column heading and hold the left mouse button down.  Drag the column to the desired location and release the mouse button.

Interpreting System Results

Each tab represents the results of the simulation.  The textual versions of the result breakdowns are in the first four tabs titled Summary, Trade List, Symbol Results and Scan.  Click any of the areas to retrieve more information.

Summary

The summary tab contains a list of totals broken down horizontally into all trades (long & short combined), long only trades, short only trades and buy and hold.  The vertical breakdown groups information about this simulation into manageable categories.

Capital Summary

Starting CapitalThe amount of capital set in the simulation to begin with.
Ending CapitalThe total amount of capital that is in the account after all trades are placed.  This will include the starting capital.
Net Profit ($)The total amount of profit or loss represented as currency.
Net Profit (%)The total amount of profit or less represented as a percentage against the starting capital.
APRThe calculated annual percentage return of the profit or loss.
ExposureThe average exposure of capital to the market.

System Totals

Number of TradesThe total number of trades the simulation opened.
Maximum ProfitThe highest profit achieved for all trades in the group.
Maximum LossThe largest loss encountered over all trades in the group.
Average Profit ($)The average profit from a currency standpoint over all trades in the group.
Average Profit (%)The average profit from a percentage standpoint over all trades in the group.
Average Bars HeldThe average number of periods that a position was held over all trades in the group.
Maximum ExposureThe maximum value exposed to the market represented as currency.
Max Exposure (%)The maximum value exposed to the market represented as a percentage.
Max Exposure DateThe date when the maximum currency exposure occurred.
Max Exposure (%) DateThe date when the maximum percentage exposure occurred.
Max Drawdown ($)The maximum drawdown encountered during this simulation represented as currency.
Max Drawdown (%)The maximum drawdown encountered during this simulation represented as a percentage.
Max Drawdown DateThe date when the maximum currency drawdown occurred.
Max Drawdown (%) DateThe date when the maximum percentage drawdown occurred.

Winning Totals

Winning TradesThe number of trades where the profit is greater than 0.  Trades that break even are considered losing trades.
Winning %The percentage of trades where the profit is greater than 0.
Gross ProfitThe total amount of profit represented as currency.
Average Profit ($)The average amount of profit represented as currency.
Average Profit (%)The average amount of profit represented as a percentage.
Average Bars HeldThe average number of periods each winning position was open.
Consecutive WinnersThe number of winning trades in a row.

Losing Totals

Losing TradesThe number of trades where the profit was less than or equal to 0.  Trades that break even are considered losing trades.
Losing %The percentage of trades where the profit is than or equal to 0.
Gross LossThe total value lost represented as currency.
Average Loss ($)The average amount lost represented as currency.
Average Loss (%)The average amount lost represented as a percentage.
Average Bars HeldThe average number of periods each losing position was open.
Consecutive LosersThe number of losing trades in a row.

System Parameters

This tab contains information about this particular system run.

Run DateThe date and time the system was run.
Run LengthThe amount of time taken to complete the system execution.
System ParametersThis contains a list of all optimization parameters contained within the system and the value of those parameters for this run.

Position List

The position list contains each trade aggregated into its respective position.  Positions are nothing more than a grouping of trades.  This screen shows the trades grouped by position.

This position list is split into two pieces.  The top portion of the screen contains the list of positions established throughout the system.  When a position is clicked or selected, the trades that are associated with this position are shown in the trade list below.

Position List Columns

SymbolThe tradable symbol name.
TypeThe position type taken, long or short.
SharesThe maximum number of shares or contracts held throughout the lifetime of this position.
Open DateThe date the first trade was made for this position.
Close DateThe date the position was completely liquidated.
Avg BuyThe weighted average of opening trades in this position
Avg SellThe weighted average price that the shares or contracts were closed/covered at.
Bars HeldThe number of periods the position was open.
P/L BarThe average amount gained or lost on a per bar basis.
P/LThe total amount gained or lost throughout the life of the position.
DescriptionThe user assigned name of this position.

 

Trade List

The trade list contains the complete list of every trade generated by the simulation.

Trade List Columns

SymbolThe tradable symbol name.
TypeThe type of transaction, either buy, short, sell or cover.
Transaction DateThe date the trade was placed.
SharesNumber of shares or contracts that were filled in this transaction.
PriceThe fill price of the trade.
CommissionThe cost of commissions for this trade.
AmountThe amount of capital added or deducted from the account for this trade.
DescriptionThe user assigned name given to this trade.
CashThe amount of cash available in the account after this transaction was completed.

Symbol Results

The symbol results tab contains an aggregated list of the trades.  The trades are aggregated by symbol.  This provides a way to quickly determine which symbols are performing and which are not.

Symbol Results Columns

SymbolThe tradable symbol name.
ProfitThe amount gained or lost for this symbol.
Profit per BarThe amount gained or lost averaged over the number of bars held.
TradesTotal number of trades entered with this symbol.
WinnersThe number of trades with a profit greater than 0.
LosersThe number of trades with a profit less than or equal to 0.
Winning %The number of winning trades divided by the number of losing trades.
Avg Bars HeldThe average number of periods each position was open.

Scan

The scan tab is useful for determining the next action that the simulation would take.  For example, if the system trades daily bars, the scan would show the next day's actions to be taken such as opening a new position or closing an existing position.  Theoretically, a daily, weekly or monthly time frame trader can use the results from the scan and generate orders manually.

Scan Columns

DateThe date that the action should occur.
Order TypeThe type of order to be submitted to the broker.  This could be any number of the order types supported by RightEdge.
SymbolThe tradable symbol name.
Order PriceIf this is a limit order, the price of the limit order will be specified here.
WinnersThe number of trades with a profit greater than 0.
LosersThe number of trades with a profit less than or equal to 0.
Winning %The number of winning trades divided by the number of losing trades.

Charts

While the grid based system results are opened after every simulation, the chart tabs can have any number of charts pull up.  There are a number of potential chart tabs and the default chart tabs are configurable under the Options dialog.

RightEdge ships with five charts.
 

  • Profit Distribution
    The Profit Distribution chart breaks down the profit and loss values into scaled values.  A sample profit distribution chart is shown below.

 

Use the Display dropdown to toggle between representing the chart in profit and loss percentages and currency.
 

  • System Breakdown
    The system breakdown chart is a bit unique in that it is a hybrid of text and graphics.  It also has some interactivity features where you can select the aggregation level of weekly, monthly or yearly.  The results are calculated in real time and the chart and results areas are updated.  An example of the system breakdown chart is below.

 

  • Equity Curve
    The equity curve chart represents the cash and asset value at each point during simulation.  This is a visual way of assessing drawdown and exposure.  The Buy and Hold account value is represent as a line displayed over the cash and asset value stacked series.
     
  • MAE / MFE
    This chart is similar in look and feel to the profit distribution chart, however, this chart breaks out the MAE and MFE calculations on a percentage or currency basis.  The chart is broken into two pieces.  The MAE is displayed on the top half of the chart and the MFE is displayed on the bottom half.
     
  • Symbol Breakdown
    The symbol breakdown chart is a simple pie chart that displays all symbols that took trades during the simulation period.  This is chart allows a quick and easy way to visualize which symbols are taking trades and which symbols are not.  This can help identify and prune "dead" symbols.

Back to the top
Back to the Main FAQ  

Privacy Policy 2005 - 2017 © RightEdge Systems, LLC