How does a trading strategy work?

A trading strategy - also called a 'system' - exploits market inefficiencies for predicting price trends of financial assets.
Any market inefficiency establishes a deviation of the price curve from pure
randomness. In a perfect, efficient market, prices would only be affected by real events, such as the publication of company results. All traders are 'informed', decide rationally and act immediately. The price curves in such a hypothetical market would be pure random-walk curves that contain no information for predicting future prices.

Fortunately for trading strategies, real markets are far from this theoretical ideal. Market inefficiencies are everywhere. They are caused by slow reaction on news, incomplete information, rumors, and irrational trading behavior (such as following advices by trading gurus). Any inefficiency can allow a strategy to predict a small part of the price curve with some degree of accuracy. However, there's a problem: Aside from the most obvious, such effects in price curves are not visible to the human eye.
You need a computer for analyzing price curves and detecting inefficiencies.

This is an example of a potential market inefficiency that can be seen by spectral analysis:

The histogram displays the amplitudes of regular cycles found in the S&P 500 price curve in a week of January 2013. The x axis is the cycle duration in hours. As you can see, the highest peak is a cycle of about 24 hours, some minor peaks are at 36, 54, and 64 hours, and a broad peak at 120 hours, equivalent to a weekly cycle (a week is 5 days x 24 hours, as weekends are skipped in price curves). Cycles arise from synchronized trading behavior and are not necessarily aligned to days or weeks. Some of those cycles remain stable for several days or weeks. They can be exploited for generating profit in automated strategies. You can find an example for cycle based trading in the tutorial. A similar trade method is used in Zorro's Z2 strategy.

Often, temporary price patterns establish and can be used by intelligent algorithms for predicting short-term trends. The following curve is produced by a 'deep learning' neural net structure:

The net was fed with EUR/USD price changes of the last 60-minutes bars, and predicted the price direction of the next hour. The blue curve shows the accumulated correct predictions minus the wrong predictions from a walk-forward analysis. The price direction was predicted with 57% average accuracy. The net was re-trained every 4 weeks, as the patterns began to lose their predictive power after that time. We can see that some short-term predictive patterns pop up almost all the time in the market. Such patterns can not be found in random data - a prediction curve had no clear direction in such a case.

Another interesting inefficiency can be seen in the following price distribution:

In the chart, the height of a bar is equivalent to how often a certain price appears in the price curve. The red bars are based on the EUR price in Swiss Francs (EUR/CHF) from October 2011 up to January 2015; the green bars are the EUR price in US Dollars (EUR/USD) in the same time period. You can generate such a chart with the Distribution script. We can see that the red EUR/CHF price distribution is quite narrow and ends abruptly on the left, as if cut with a knife. In contrast, the green EUR/USD price distribution is much wider with a broad peak in the middle. It resembles a bell curve (more or less), which indicates a random price distribution. The EUR/CHF distribution however is no bell curve. It reveals a market inefficiency that can generate profit in automated trading. In this case, the inefficiency is the result of the CHF price ceiling that was established by the Swiss National Bank from September 2011 until January 2015. It prevented the EUR from dropping below 1.20 CHF. This kind of market inefficiencies can be very successfully exploited by grid trading strategies.

How to develop own trading strategies

You'll need basic knowledge of the financial assets that you want to
trade. You'll need a concept of exploiting a particular market inefficiency.
You'll need to be able to read and write code. And you'll need to be aware
of all the subtle statistical effects that can cause different outcomes of test
and real trading, and know how to deal with them.

A good strategy is as simple as possible, but not simpler. The general process of designing a strategy is described here:
Build
Better Strategies. For going deeper into the matter, check out the
book list under links. When you need help with
strategy coding, contact our
development
service.

One thing is certain: the future is unknown. When you develop a strategy, you use historical price data for testing and optimizing. But when you trade it, prices are real. The market and its inefficiencies can undergo changes of any kind. What worked in the past is not guaranteed to work in the future. Therefore, even when you're using proven systems such as the Z strategies, you always deal with an element of uncertainty. For not relying
only on your luck, learn as much as you can, and develop and deploy as many different strategies as possible.