Process of making a perfect strategy

12 January 2024, 19:31
Rajesh Kumar Nait
0
129

What is a strategy?

If we talk in programming language, A strategy is a tactic which outputs two boolean - true or false or win or loss

Example : Buy when RSI is 30 and price is above EMA 50 or SELL if RSI is 70 and EMA below 50

This strategy is using two indicators. EMA and RSI

Just like that any strategy can use hundreds of indicators or price action tactics such as

condition 1 : If there is a bullish engulfing return true

condition 2 : If any candle breaks high of bullish candle by close, return true;

condition 3: add buy orders on 50% of range of bullish engulfing

In this example a strategy is verifying two conditions

if(condition 1 & condition 2) //true

return true

else return false;


You can code these in less than an hour but when you start testing you will encounter hundreds of problems where SL hits.

So building a strategy is 1 hour task while optimizing a strategy is several years of task.

Optimization can be categorized as

1. Normal Optimization - when a trader adds some filter to strategy e.g. only if condition 1 and 2 is true, add condition 3 to measure the health of 2nd engulfing candle,  if health is weak avoid buying else buy.

2. Over Optimization - When a trader optimizes it using Machine learning or mind when it is really not needed so have to roll back and delete some optimization

3. No Optimization - when a trader has no idea about how to optimize it, he usually use martingale or grid based methods to improve accuracy


Coding an EA is a best idea but the main problem is coding the algorithm of finding highs and lows. For example finding high low on visible chart is not a problem but finding and saving that point where your TP was triggered is a problem, you need extra skills to code such system which can remember your key events of trading such as last trade points.

Usually MySQL and other DB integration articles are already available on database. But for a simple process a trader may start with simple DB, saving as a text or CSV file which is easy

When you remember your trading key events on chart, and if you code in such way that they remember key events in database, on your request you can pull and discard entry exit with complete strategy visualization anywhere on chart, then this will help you finishing your optimization in several months only.

For example : Lets say i over optimized my strategy and added a new condition 12, but I dont have enough data to trade it. If I decide to manually backtest that filter, I really dont know when this condition occured on chart and since i dont have data I will fear to trigger any trade on that filter despite i added that condition on my trading program.

So to solve this problem, use of Database is highly recommended


Share it with friends: