Stocks News

The process of creating the perfect strategy – Trading Strategy – January 12, 2024

What is a strategy?

Speaking in programming language, a strategy is a tactic that outputs two booleans (true or false, win or loss).

Example: buy when RSI is 30 and price is above EMA 50 or sell when RSI is 70 and price is below 50.

This strategy uses two indicators: EMA and RSI

Likewise, any strategy can use hundreds of indicators or price action tactics, such as:

Condition 1: Returns true if there is an upward trend.

Condition 2: Returns true if the candle breaks the high of the bullish candle according to the closing price.

Condition 3: Add buy order at 50% of bull market range

In this example, the strategy checks two conditions:

if(condition 1 & condition 2) //true

returns true

Otherwise returns false.

You can code it in less than an hour, but once you start testing you’ll be faced with hundreds of problems that SL encounters.

So while creating a strategy can be an hour-long task, optimizing a strategy can take years.

Optimizations can be categorized as:

1. General optimization – when the trader adds some filters to the strategy, for example, add condition 3 only if conditions 1 and 2 are true to measure the health of the second engulfing candle, avoid buying if the health is weak and I buy it.

2. Over-optimization – If traders are optimizing using machine learning or mind when they don’t really need to, they need to roll back and delete some optimizations.

3. No optimization – If traders do not know how to optimize, they usually use martingale or grid-based methods to increase accuracy.

Coding the EA is the best idea, but the main problem is coding the algorithm to find the highest and lowest points. For example, finding high and low points on a visible chart is not a problem, but finding and storing the point where the TP was triggered is a problem. Coding a system that can remember key trading events, such as the last trading point, requires additional skills.

Typically MySQL and other DB integration articles are already available for your database. However, for a simple process, traders can start with a simple DB and easily save it as a text or CSV file.

By remembering the key trading events on your chart and coding them in a way that remembers the key events in your database, you can pull or delete entries and exits anywhere on the chart with full strategy visualization on demand. Optimized in just a few months.

Example: Let’s say I over-optimized my strategy and added a new condition 12, but I don’t have enough data to trade it. If you decide to backtest that filter manually, you won’t really know when this condition occurred on your chart, and because you don’t have the data, you’ll be afraid of your trades being triggered on that filter even though you added that condition to your trading program.

Therefore, we highly recommend using a database to solve this problem.

Related Articles

Back to top button