Technical Analysis in Algo Trading

Hi ^^

This is my very first post here!

I’ve got software engineering background and am new to Algo Trading. I am trying to automate my friend’s strategy and become rich :smiley: (would be nice, wouldn’t … )

I am wondering how technical chart analysis is performed in Algo Trading? For instance, a Trader would draw such lines to identify a trading range:

Trading Range

In order to identify a range in the code, I am thinking of using a combination of Math and Machine Learning. So I am in the process of collecting data and building a dataset so I can use for training the model and use it as a source of truth against the algorithm result. My approach might work or I might find a simpler way to implement it. But it makes me wonder how software developers tackle such challenges in the Algo Trading world? I am trying to make sure that I am not using the wrong tool for questions that might already have simpler ways to answer.

Thank you!

Speaking as a programmer I can say that the support and resistance lines you mention are the most difficult part to code. You can code SMA, EMA and other indicators pretty easily but the concept of the range is a difficult one to solve and I do not believe there is one good solution for all circumstances. Some techniques involve putting the chart on a grid and using pattern detection based on the filled in squares. Others involve dragging a time window along the graph and noting the highs and lows for the window as it moves. A lot of developers concentrate on the indicators that are easy to code. The biggest problem is trying to find the overall highs and lows and not the local highs and lows.

1 Like

I buit a Forex robot and I used the Oanda API to get data, it is easy to do and you only need to have a demo account with them to use it. You can get up to 5000 candles of history for each currency pair and by using different timescales you can end up with a lot of data to analyse.

1 Like

For non-algo traders struggling with s/r levels, this issue sums up the key difficulty - defining what your levels are.

1 Like

Very good point. That’s why I think in this case Machine Learning technique can cater in finding a good solution as through optimizing weighted parameterized you can get close enough result to the Trader outlook.

Hi, focus on one time frame, also try to find price level ( pending stop orders ) with higher probability to trend continue. Regards Greg

I’m trying to apply neural networks and machine learning, but not to automate particular strategy, but for AI to come up with one itself. I believe machine learning will have better results without imposing our “human” view on the chart :slight_smile:

For algo trading it may be easier to introduce some volatility measures and hunt for breakout. Eg. very narrow bollinger bands or multi moving average squeeze. I’ve had one EA where I took 4-5 EMA and if all of them were contained within n*ATR range, EA set straddle (both long and short pending orders) waiting for burst out of consolidation.

One technique you could try is to move to a higher timeframe and look for what are called “Trend Candles”. These are consecutive candles that have higher highs and higher lows (or lower highs and lower lows). This is because each candle on the higher timeframe encompasses multiple candles on the lower timeframe so, in effect, you have your time window neatly packaged up into one candle. Of course, it is easy to create any time window in code anyway.

I did a neural network test a year or so ago. I used 5 candles as an input and I wanted it to produce the next candle as an output. The closest it got was to produce almost (but not quite) the previous candle as the output. It was as if it figured out that the closest you are going to get to the next candle is the previous one.

This is interesting and tallies with my own observations of forex pairs in trends. I only want to get into trend-following positions so I only checked what happened to price in an uptrend and in a downtrend.

As a rule of thumb, in a D1 uptrend, 2 successive higher closes are probably followed by a lower close. But a lower close will probably be followed by a higher close. This is how trends are self-sustaining.