Trading Simulator Backtesting Essentials
  • Guides
  • trading-simulator-backtesting-essentials

Trading Simulator Backtesting Essentials

We will explore three main components in trading that are interconnected: trading instruments/markets, account types and order types. Understanding the relationship between these elements is crucial



Trading markets/instruments

Some examples of financial markets and their roles include the stock market, the bond market, forex, commodities, and the real estate market, among several others. Financial markets can also be broken down into capital markets, money markets, primary vs. secondary markets, and listed vs. OTC markets. Check out the trading instruments guide for more details on fx markets.

  1. Derivatives fx markets
  • Fx derivatives as forwards, swaps, options and CFDs

Account types

There are many types of trading accounts that serve different purposes, such as managed accounts where someone else manages your funds. On the other hand, there are cash and margin accounts, retail and professional accounts, as well as standard and mini accounts. Trading accounts and their types can vary greatly between different brokers, making categorization challenging. Most often, they function as a distinctive layer around the deposited funds.

  1. Margin accounts
  2. Non-marginable
  • Margin accounts offer leveraged trading, and leverage can be utilized in different ways, such as hedging and netting
  • Non-margined accounts. Operating without using any borrowed money.

Some of the account types offered by retail brokerages:

  1. Demo Account: Practice account with virtual money for learning and testing.
  2. Standard Trading Account: A standard account for regular trading.
  3. Mini Account: A smaller version of a standard account with lower trade sizes.
  4. Micro Account: An even smaller account for low-risk trading.
  5. Cent Account: An account where balances are denominated in cents.
  6. Forex ECN Account: Provides direct access to interbank forex markets.
  7. STP Account: Sends orders directly to liquidity providers.
  8. PAMM Forex Account: Managed account where traders pool funds.
  9. Forex Managed Account (MAM): Managed account for multiple investors.
  10. Copy Trading Account: Allows copying strategies of successful traders.
  11. Forex Swap-Free Account: Interest-free account for religious compliance.
  12. Hedging Account: Allows traders to hold both long (buy) and short (sell) positions on the same currency pair simultaneously, offering protection against market volatility.

  13. Netting Account: Aggregates multiple positions in the same currency pair into one, simplifying position management but limiting hedging strategies.


Why hedging was removed in the latest backtesting app

Many brokers are now required to adhere to a "First-In-First-Out" (FIFO) rule, which means that if a trader has multiple positions in the same currency pair, the first position that was opened must be closed first. This rule effectively eliminates the possibility of hedging, but it is intended to protect traders by promoting transparency and preventing brokers from engaging in unethical practices.


Order Types

1. Market Order

  • Buy - Long position
  • Sell - Short position

A market order is a type of order to buy or sell a financial instrument, such as a stock, currency, or commodity, at the current market price. When you place a market order, you are essentially telling your broker or trading platform to execute the trade as soon as possible, at the best available price on the market.

For example, if you want to buy a certain currency pair and you place a market order, the platform will execute the trade at the current ask price (the price at which sellers are willing to sell the currency), which is the best available price at that moment.

Market orders are generally executed quickly, as there is no price limit or range specified in the order, and they are often used when speed of execution is more important than the exact price at which the trade is executed. However, it's important to note that the execution price of a market order may not always be exactly what you expect, especially in very volatile markets or with low liquidity.

2. Limit Order

A limit order is an order to buy or sell a financial instrument at a specific price or better. When you place a limit order, you are essentially setting a maximum price (for a sell order) or a minimum price (for a buy order) at which you are willing to enter or exit the market.

  • Buy Limit Order
  • Sell Limit Order
  • Buy Stop Limit Order
  • Sell Stop Limit Order
  1. Buy limit order: A buy limit order is a type of limit order that is placed below the current market price. This means that you want to buy the financial instrument at a lower price than the current market price. When the price of the instrument falls to your specified buy limit price, the order is triggered and the trade is executed.

  2. Sell limit order: A sell limit order is a type of limit order that is placed above the current market price. This means that you want to sell the financial instrument at a higher price than the current market price. When the price of the instrument rises to your specified sell limit price, the order is triggered and the trade is executed.

  3. Buy stop limit order: A buy stop limit order is a type of limit order that is placed above the current market price, but below a specified trigger price. This means that you want to buy the financial instrument at a higher price than the current market price, but only if the market continues to move in your desired direction. When the market price rises to your specified trigger price, the order becomes a limit order and is executed at or below your specified buy stop limit price.

  4. Sell stop limit order: A sell stop limit order is a type of limit order that is placed below the current market price, but above a specified trigger price. This means that you want to sell the financial instrument at a lower price than the current market price, but only if the market continues to move in your desired direction. When the market price falls to your specified trigger price, the order becomes a limit order and is executed at or above your specified sell stop limit price.

3. Conditional Orders

  1. Bracket Orders: Bracket orders are designed to help limit your loss and lock in a profit by "bracketing" an order with two opposite-side orders. A BUY order is bracketed by a high-side sell limit order and a low-side sell stop order. A SELL order is bracketed by a high-side buy stop order and a low side buy limit order. The order quantity for the high and low side bracket orders matches the original order quantity. You can create bracket orders in our app to automate your backtesting process how to use bracket orders

  2. One Triggers Another: OTA is a type of conditional order commonly used in trading. OTA orders consist of two parts: the primary order and the secondary order. The primary order is the initial action you want to take, like buying or selling a security. The secondary order is a contingent action that is executed only if the primary order is filled. Test OTA orders in our app for free, see how it can optimize your trading strategy development how to OTA orders

  3. One Cancels All: OCA is a type of conditional order used in trading to group multiple orders together with the stipulation that if one of them is executed, the others are automatically canceled. OCA orders are useful for implementing trading strategies that involve multiple scenarios, ensuring that only one of those scenarios can be executed.


Explaining Trading Simulator Parameters

backtesting-app-accounting
  1. Equity: Equity refers to the current value of your backtesting game account, including any profits or losses that you have incurred on open positions. It is calculated as follows:

    Equity = Balance + Floating Profit/Loss

    Where "Balance" is the amount of money you have into your backtesting game account, and "Floating Profit/Loss" is the unrealized profit or loss on your open positions.

  2. Max Drawdown: Max drawdown is the maximum percentage loss from a peak in the equity of a backtesting game account to a subsequent low point. It is calculated as follows:

    Max Drawdown = (Peak Equity - Trough Equity) / Peak Equity

    Where "Peak Equity" is the highest equity value reached in the backtesting game account, and "Trough Equity" is the lowest equity value reached after the peak.

  3. Margin (free): Margin (free) is the amount of money that is available in your backtesting game account to open new positions. It is calculated as follows:

    Margin (free) = Equity - Margin (locked)

    Where "Margin (locked)" is the amount of money that is currently being used to maintain open positions.

  4. Margin (locked): Margin (locked) is the amount of money that is currently being used to maintain open positions. It is also referred to as "Used Margin".

  5. Use of Leverage: Use of leverage refers to the amount of leverage that is being used to maintain open positions in your backtesting game account. It is calculated as follows:

    Use of Leverage = (Margin (locked) / Equity) x 100

    The result is expressed as a percentage.

  6. Margin Level: Margin level is the ratio of equity to used margin, expressed as a percentage. It is calculated as follows:

    Margin Level = (Equity / Margin (locked)) x 100

  7. Max (Floating P/L): Max (Floating P/L) is the maximum unrealized profit that has been achieved on any open positions in your backtesting game account.

  8. Min (Floating P/L): Min (Floating P/L) is the minimum unrealized profit that has been achieved on any open positions in your backtesting game account.

Open position: details dialog overview

To show the position dialog simply click/tap on the trading position object, the field where trading volume (1) is displayed.

forexthrive-backtesting-open-trade-dialog
  • ID: This is a unique identification code assigned to the trade for record-keeping purposes.
  • Instrument: This refers to the currency pair being traded, in this case, the EUR/USD.
  • Volume: This represents the size of the position taken in the trade, which is 22,000 units of the base currency (in this case, the euro).
  • Side: This indicates whether the trade is a buy or a sell, with "buy" meaning that the trader is expecting the base currency to appreciate relative to the quote currency and "sell" meaning that the trader is expecting the base currency to depreciate relative to the quote currency.
  • Open Price (Avg Fill): This is the average price at which the order was filled, which is 1.22069 for this trade.
  • Current: This is the current market price for the currency pair.
  • Open Time: This is the date and time at which the trade was executed.
  • Leverage: This refers to the amount of leverage used in the trade, which is 50:1, meaning that the trader is required to have 1/50th of the total position size as margin.
  • Margin (requirement): This represents the amount of margin required to open and maintain the position, which is $539.3 in this case.
  • P/L USD: This is the profit or loss in US dollars for the trade, which is currently $109.78.
  • Fees: This refers to any fees or commissions paid to the broker for executing the trade, which is -$3.20 in this case.
forexthrive-take-profit-stop-loss

In forex trading, T/P stands for "Take Profit" and S/L stands for "Stop Loss".

  • Take Profit Price (T/P): This is the price at which the trader has set a limit for their profit. When the market price reaches this level, the position will automatically be closed, and the profit will be realized. In this example, the Take Profit Price is 1.2303.

  • Take Profit Sum: This is the estimated profit that will be realized if the Take Profit Price is reached. In this example, the Take Profit Sum is $211.42.

  • Stop Loss Price (S/L): This is the price at which the trader has set a limit for their loss. When the market price reaches this level, the position will automatically be closed, and the loss will be realized. In this example, the Stop Loss Price is 1.2237.

  • Stop Loss Sum: This is the estimated loss that will be realized if the Stop Loss Price is reached. In this example, the Stop Loss Sum is $66.22.

Take Profit and Stop Loss are important risk management tools used in forex trading to manage potential losses and profits in a trade. By setting a Take Profit level, a trader can lock in profits at a specific price level, while a Stop Loss level limits potential losses by closing the trade if the market moves against the trader beyond a certain point.