HOW TO BUILD A PROFITABLE TRADING SYSTEM PART 1: CONFIDENCE IN NUMBERS — DARA | Automate your trading without learning how to code (2024)

There is something very compelling about mathematics.There are no ‘buts’ and no ‘maybes’. Mathematics is not subjective. 2+2=4 and that's that – no matter how hard someone will try to insist that it is not. Numbers do not lie.

As an engineer, my love for numbers helped me in my trading from day one. I was never comfortable trading with subjective projections or on the recommendations of other traders. I needed concrete black-and-white proofs, with real hard numbers, to convince me that the trading rules and strategies I used had a statistical advantage and was profitable over time.

Any trading rules or strategies that I learned – whether from books, courses or other traders who came to me asking to automate their strategies – I rigorously tested to confirm their profitability. As you might have guessed, most of the trading strategies I tested over the last 14 years were shams, some even coming from prominent and highly respected traders. Out of almost a hundred different trading strategies that I tested, only a handful of them constantly made profits in the market.

While testing whether a strategy has worked in the past is a relatively simple task, the real challenge is evaluating its future profitability. Can we reasonably expect the strategy to perform the same in the future as it did in the past? Will we get the same results if we keep doing the same things we did 10 years ago? Most likely not since markets change all the time. To have the best shot of developing a trading strategy that not only worked in the past but also has a high chance of working in the future, we must employ the following three methods.

  1. Statistical significance (Confidence in Numbers)

  2. Simple strategies (Antifragile trading systems)

  3. Continuous and automated strategy adjustments(when our knowledge changes our probabilities must change too)

CAN WE HAVE CONFIDENCE IN NUMBERS?

In this article, we will look at the first factor: statistical significance and what is required to have confidence in your numbers.

A widespread mistake by discretionary traders is to look only at small sample sizes (typically less than 100 trades) when building a strategy or deciding on a trading rule. Couple this with the human tendency to see what you want to see –and you can see how relying on manually performed subjective strategy tests can quickly go wrong. Performing tests manually often leads to errors and overconfidence in the test results. The only way to be confident in your statistics is if it’s performed in an automated way with a testing-algorithm applied to a large enough data set. What size sample is large enough?How to know if the results are due to pure luck or is statistically significant?

Don't worry; there is a formula for this.

It's called Cochran's Sample Size Formula.

Where:

  • Z is Z score

  • p is currently known result (for example 50% win rate for the strategy)

  • q is 1-p

  • e is margin of error (for example 5%)


With this formula, we can calculate how many trades we need to have in our sample size to be confident in the statistical result, given our margin of error. This test is commonly used with a 5% margin of error.

Putting some figures into the formula we get:

  • Confidence level 99%

(2.58)^2 (0.5)(0.5)/0.05^2 = 666

To be 99% confident with a projection that has a 5% margin of error we need 666 trades in our sample.

  • Confidence level 98%

(2.33)^2 (0.5)(0.5)/0.05^2 = 543

To be 98% confident with a projection that has a 5% margin of error we need 543 trades in our sample.

  • Confidence level 95%

(1.96)^2 (0.5)(0.5)/0.05^2 = 385

To be 95% confident with a projection that has a 5% margin of error we need 385 trades in our sample.

  • Confidence level 90%

(1.645)^2 (0.5)(0.5)/0.05^2 = 271

To be 90% confident with a projection that has a 5% margin of error we need 271 trades in our sample.

  • Confidence level 80%

(1.28)^2 (0.5)(0.5)/0.05^2 = 164

To be 80% confident with a projection that has a 5% margin of error we need 164 trades in our sample.

  • Confidence level 70%

(1.03)^2 (0.5)(0.5)/0.05^2 = 107

To be 70% confident with a projection that has a 5% margin of error we need 101 trades in our sample.


To be 70% confident in your statistical result, you need at least 107 trades in your test sample; to be 99% confidence you need 666 trades.A commonly accepted confidence level is 95%: thus when you have 385 trades in your test sample, you can be reasonably confident that the results are not obtained by chance.


WHAT IF YOU DON’T HAVE ENOUGH TRADES IN YOUR TEST SAMPLE?

If the signals of your trading strategy are rare and you don’t have the required sample size we’ve discussed, the best way to get more results is to combine test results from multiple markets. In particular, closely correlated markets. For example, you can expect the results for your strategy to be very similar on EURUSD and GBPUSD currency pairs since these currency pairs are closely correlated. But the important thing to remember is that the strategy rules must be exactly the same and you should not optimise the strategy separately for each market. The significance of this we cover in part two of this article series: How to build a profitable trading system Part 2: Antifragile trading systems.

Having a large enough sample size is very important when testing and developing trading strategies. If you’re using small sample sizes you risk picking up random noise obtained by chance alone. That’s not a good way to build your strategies. The larger the sample size the more confidence you can have in the statistical result.

HOW TO BUILD A PROFITABLE TRADING SYSTEM PART 1: CONFIDENCE IN NUMBERS — DARA | Automate your trading without learning how to code (2024)

FAQs

How to automate trading without coding? ›

No Code Algo Trading Strategy Example
  1. Step 2 – Set account size and position sizing. We will use a fixed size of $10,000 per position. ...
  2. Step 3 – Select Symbol(s) ...
  3. Step 4 – Select Entry and Exit rules. ...
  4. Step 5 – Generate Code. ...
  5. Step 1 – Open Development Environment. ...
  6. Step 2 – Create new strategy File. ...
  7. Step 3 – Copy and Paste.

How to build your own automated trading system? ›

How to Build a Custom Trading Bot for Automated Trading
  1. Step 1: Define your objectives. ...
  2. Choose the right technical partner. ...
  3. Trading Bot Development & Testing. ...
  4. Backtest Your Strategy and Implement Risk Management. ...
  5. Regular Monitoring and Iterative Improvements.
Oct 16, 2023

What is the simplest most profitable trading strategy? ›

One of the simplest and most widely known fundamental strategies is value investing. This strategy involves identifying undervalued assets based on their intrinsic value and holding onto them until the market recognizes their true worth.

How to code an algorithm for trading? ›

5 Steps to Create an Algorithmic Trading App
  1. Step 1: Create Algorithmic Trading Platforms. ...
  2. Step 2: Construct a Trading Algorithm Approach. ...
  3. Step 3: Define the Timeframe and Frequency of Trade. ...
  4. Step 4: Evaluate the Trading Algorithm Using Prior Data. ...
  5. Step 5: Connect the Algorithm to the Demo Trading Account before the Live.
Feb 23, 2024

Can I code my own trading bot? ›

With the right strategy, tools, and risk management measures, you can create a trading bot that automates your trades and maximizes your profits. Remember to test your strategy thoroughly, and always practice responsible risk management.

How do I automate my trading strategy? ›

You need a strategy to automate the trading system. Consider the following steps:
  1. Formulate rules and conditions for order placement and execution.
  2. Decide on a platform based on the available feature list (or launch your own.)
  3. Apply your rules using platform functionality.
  4. Backtest your system. ...
  5. Start real-life trades.
Mar 15, 2023

Which algorithm is best for trading? ›

Top Five Algo Trading Strategies of 2024
  1. Trends and Momentum Following Strategy. This is one of the most common and best algo strategy for intraday trading. ...
  2. Arbitrage Trading Strategy. ...
  3. Mean Reversion Strategy. ...
  4. Weighted Average Price Strategy. ...
  5. Statistical Arbitrage Strategy.
Jan 16, 2024

How do you make a profitable trading system? ›

There are seven easy steps to follow when creating a successful trading plan:
  1. Outline your motivation.
  2. Decide how much time you can commit to trading.
  3. Define your goals.
  4. Choose a risk-reward ratio.
  5. Decide how much capital you have for trading.
  6. Assess your market knowledge.
  7. Start a trading diary.

How to create an AI bot for trading? ›

Step-by-Step Guide to Building Your AI Crypto Trading Bot
  1. Choosing a Programming Language. ...
  2. Setting Up an API Connection. ...
  3. Designing Your Trading Strategy. ...
  4. Coding the Bot. ...
  5. Testing and Backtesting. ...
  6. Deploying on Cloud Infrastructure. ...
  7. Optimization and Monitoring.

Is there a 100% trading strategy? ›

A 100 percent trading strategy is an approach that involves investing all of your capital into a single trade. While this can be risky, it can also lead to significant profits if executed correctly.

What is the most profitable trade ever? ›

The best trade in history is often considered to be George Soros's shorting of the British Pound in the early 1990s, making over $1 billion. This trade, along with others by notable investors, involved highly leveraged currency exploitation.

Which trading style is most profitable? ›

The defining feature of day trading is that traders do not hold positions overnight; instead, they seek to profit from short-term price movements occurring during the trading session.It can be considered one of the most profitable trading methods available to investors.

Can I create my own trading algorithm? ›

If you choose to create an algorithm be aware of how time, financial and market constraints may affect your strategy, and plan accordingly. Turn a current strategy into a rule-based one, which can be more easily programed, or select a quantitative method that has already been tested and researched.

How to create a trading bot without coding? ›

Write your bot using if-then statements Our programming language is plain english. Connect your bot Get notified whenever your bot makes a trade, or have your bot text you for permission before submitting a trade. Track your bot's performance Compare it to the ticker being traded.

What is the code for algorithm? ›

An algorithm is not computer code; it's written in plain English and may be in the form of a flowchart with shapes and arrows, a numbered list, or pseudocode (a semi-programming language).

Can I automate trading? ›

Traders do have the option to run their automated trading systems through a server-based trading platform. These platforms frequently offer commercial strategies for sale so traders can design their own systems or the ability to host existing systems on the server-based platform.

Is it legal to automate stock trading? ›

Yes, algorithmic trading is legal. There are no rules or laws that limit the use of trading algorithms. Some investors may contest that this type of trading creates an unfair trading environment that adversely impacts markets. However, there's nothing illegal about it.

Are automated trading bots legal? ›

While trading bots are legal, investment firms and traders are responsible for ensuring that they're used in a compliant manner. Compliance issues cover topics such as data privacy, algorithmic trading laws, and prohibitions on market manipulation.

Is coding necessary for trading? ›

For beginners or those opting for user-friendly platforms, programming skills might not be mandatory. Many brokerage firms and trading platforms, like uTrade Algos, offer user-friendly interfaces with pre-built algorithms or strategies that allow users to engage in algo trading without coding knowledge.

Top Articles
Latest Posts
Article information

Author: Neely Ledner

Last Updated:

Views: 5374

Rating: 4.1 / 5 (42 voted)

Reviews: 81% of readers found this page helpful

Author information

Name: Neely Ledner

Birthday: 1998-06-09

Address: 443 Barrows Terrace, New Jodyberg, CO 57462-5329

Phone: +2433516856029

Job: Central Legal Facilitator

Hobby: Backpacking, Jogging, Magic, Driving, Macrame, Embroidery, Foraging

Introduction: My name is Neely Ledner, I am a bright, determined, beautiful, adventurous, adventurous, spotless, calm person who loves writing and wants to share my knowledge and understanding with you.