If you knew your trading strategy would work 50% of the time, would you commit your scarce savings to trade it? What if it worked 75% of the time? Backtesting gives one the confidence to know that your trading strategy will work.

Backtesting Trading Strategies

[av_video src=’′ format=’16-9′ width=’16’ height=’9′]
[av_heading heading=’Backtesting Trading Strategies’ tag=’h1′ style=” size=” subheading_active=” subheading_size=’15’ padding=’10’ color=” custom_font=” admin_preview_bg=”]
If you knew your trading strategy would work 50% of the time, would you commit your scarce savings to trade it? What if it worked 75% of the time? Backtesting gives one the confidence to know that your trading strategy will work. Backtesting is simply the intentional testing procedure to verify that your trading strategy works using historical (back) market data and market conditions.
The simplest form of backtesting is looking at old data and saying “if I saw this at that time, I would have done that.” The goal is to get an accurate prediction of the future using past information. Computers, big data, and programming tools, like Python, make this more systematic and more likely to produce reliable predictions.
The procedure is simple but implementing it isn’t.

Winning by Backtesting

One wins when one’s backtest identifies an accurate signal or prediction of the future. In trading, this is when your strategy proves to work and you can actually trade profitably.
To win one has to play the game well. A scientific method works best. Many of your peers follow the following process to request an allocation from CloudQuant.
Backtest Research Life Cycle for Trading Strategies

Scientific Step
1. Think of interesting trading strategies Using your imagination and insight come up with questions about market conditions.
2. Formulate a hypothesis about how you will trade What signals, what information will drive your decision to buy/sell/hold and close positions?
3. Figure out your method to test the hypothesis Write your trading algorithm and figure out what data will verify that the hypothesis either worked and didn’t work. Also, figure out what historical data you will need to conduct experiment. For example, historical market data or historical social sentiment data. CloudQuant helps by providing a market simulation backtesting engine and historical data sets.
4. Conduct your experiments and collect data The collected data will provide you quantitative reasons to prove or disprove your hypothesis.
5. Objectively review your data Reviewing your data objectively to the original decision points you decided upon in step 2.
6. Form data-driven conclusions Increased objectivity in drawing data-driven conclusions leads to better trading strategies.
7. Either improve your trading strategy or request an allocation from CloudQuant If you don’t have an actionable model, then improve by going back to step 1.
If your model is profitable, and you are ready to present it, then ask CloudQuant for a capital allocation and license your strategy so that it can be traded with our money.

After you have done this, only now should you see if your hypothesis was correct. If it is, then you have won. If not, then go back to step one.

You win when your backtest proves your hypothesis

and you can take action steps to profit from your trading strategy hypothesis.

Losing by Cheating on Your Backtest

You lose when you cheat in backtesting. Using knowledge that you didn’t have at the time to improve your trading strategy and make your backtest look successful is the most common form of cheating. If you design your algorithm to work because you already know that the stock price changed in your favor on a given day then you are cheating. Your backtest may look really good, but your trading strategy can’t actually achieve those results because you had foreknowledge of events.

Inputs to a Successful Trading Strategy Backtest

A successful backtest could be completed using nothing but the old prints of the Wall Street Journal in your local library. It has the open and close price, news items, and fundamental data of the stock market. One could manually conduct the trading strategy using that information only.
The major components of a successful backtesting strategy are:

Component Description
Historical Market Data Market data, correlated to a time standard, is essential. This allows for different stock prices to be compared.
Historical News and Events Just as historical market data has to be time stamped so must news and data streams. This allows the changes in a stock price to be correctly correlated with any event that was reported in social media or on the news wire.
Market Simulation Engine A market matching engine matches buy orders with sell orders in accordance with the rules of the particular marketplace or exchange. Market participants use a variety of order types to execute trades. Market orders, Limit orders, Stop, Stop Limit, Market on Open, Limit On Close, VWAP, TWAP, Pegged, trailing stop, and more.
A simulated matching engine must accurately estimate how inbound orders will be processed against what has happened historically.
A simulation engine also needs to be able to simulate market events, like a tweet or news item, at the correct time.
Cost Estimations The cost schedules for each market, execution, clearing, short sales, and more are essential to correctly calculating the realized and unrealized profit and loss.
Account & Position Management Each trading account is responsible for managing the money, margin, and the account’s positions.
Order State Management Orders have life cycles. They may be unsent, working, rejected, partially filled, filled, and expired. They exist in the market for defined periods of time. Backtesting engines need to properly maintain the correct order state. This logic is very complex when dealing with exchange and broker provided order functionality including brokerage algorithms.
Risk Pre-Trade risk controls are applied to every trading system. This is evident in the rules that regulators have been applying to trading systems.
A backtesting engine needs to:

  1. Properly reject orders that would exceed credit or capital requirements for a given account.
  2. Properly reject erroneous orders that exceed business logical errors including duplicate orders or resting orders that would cause credit or capital limit exposure.

What You Should See in a Backtest

Scorecard on CloudQuant

CloudQuant encourages crowd researchers to be creative, innovative, and independent. To this end we provide information about the performance of a backtest. The following statistics help you to be successful in your research:

  • Sharpe Ratio
  • Calmar Ratio
  • Trade Kelly Edge %
  • Daily Kelly Edge %
  • Total Profit
  • Total Return
  • Total Net Profit
  • Total Commission
  • Avg Dollar Risk
  • Avg Trade Duration
  • Compound Annual ROR
  • Max Drawdown
  • Avg of Roll 20 Day Win %
  • Monthly Win %
  • Net Edge/Share
  • Number of Trades
  • Number of Years
  • Trade Win %
  • Daily Win %

Many more statistics are available in the downloadable reports.

Start your trading strategy algo on CloudQuant
Click Here to Start your trading strategy algo on CloudQuant