Thursday, 10 March 2016

Webinar with Algo Trader Cameron Madlani - Creating Scalping Robots

Recently we joined Meet Up and registered for memberships in groups related to Finance, Algorithmic Trading and Data Science.

Our first Webinar was hosted by Cameron Madlani, an algorithmic trader based in Sydney. The topic was "Making Daily Money with Automated Trading- Creating Scalping EAs". Here's what we learnt:

Types of Automation

- Fully Automated

This is where the robot calculates risk, places trade, manages stop losses and targets, and closes the trade. To set up trading robots to enter high probability set ups in fast moving markets, we would require a virtual private server (Equinix Data Centre is popular with brokers) to enable trades to execute in milliseconds. In January 2016, the first Artificial Intelligence Hedge Fund 'Aidyia' launched. They place all trades using artificial intelligence. San Fran based Santient Technologies also runs a $143mill hedge fund that uses AI since 2015.

- Semi Automated

This is where the trader chooses or places the trade manually though the robot identifies the opportunity with a signal. It is based on the trader's own fundamental analysis and risk aversion to accept the trade. If they do choose to go through with the trade, the robot still manages stop losses and targets and closes the trade as it would normally do if the entire process was fully automated.

- Radars

As the name suggests, this refers to the robot monitoring multiple markets with an onscreen view of the financial instruments universe, and provides signal on dashboard for traders.

- Indicators

Indicators identify trading opportunities and provides general trade signal.

The process of automation for beginners:

1. Clearly define mechanical strategy
2. Identify intuition/experience. Depending on your trading style, you are able to include experience in the code. For instance, if you were a day trader, you would have code to check market spreads and timing. However if you find your most profitable trading hours are from 9am to 10am from experience, you can still optimise the robot to find the best hours from 0-24 and days of the week as the bot can combat time zone differences, and for instance, finding 4am-5am is actually the most profitable. Something interesting to check out is XML feeds. These are show fundamental figures, and the robot can be plugged in to trade based on these fundamental figures, such as reading interest rates which then directs their trade accordingly.

3. Write out strategy in pseudo code. Pseudo code refers to using if and else statements to plan out the strategy in a logical method. For instance:

If Moving Average 1 > Moving Average 2

    then Buy
If Moving Average 1 < Moving Average 2
    then Sell
Else do nothing

4. Learn coding: You could hire a professional automation firm or code yourself using languages such as MQL, JForex, Ninja Script, EFS. Alternatively, use algorithmic creation tool (Drag & Drop).

5. Test for extreme situations such as market closing times

6. Optimise but avoid curve fitting
7. Back test
8. Run on Demo Account to ensure satisfactory results

These steps are outlined in greater detail in our other blog posts relating to Algo trading.

Real Life Examples

Moving Average Crossover

The below examples use AUD as one of the currencies in the currency pair. This market trends well due to carry trading. Carry trading refers to investors using their accounts to buy $A due to relatively high interest rates, which makes them long carry trade revenue.

GBP/AUD: Jan 2015 - Dec 2015

This chart shows 3 Moving Averages (MA1, MA2, MA3). These moving averages refer to averages over different time frames. For instance, MA1 is a short term moving average compared to MA2. With two moving averages, the philosophy is when the shorter MA crosses the longer MA on the upside, this is a buy signal. If the shorter MA crosses the longer MA on the downside, this generates a sell signal. Note this is a momentum strategy. The more space between the two MA lines, the more confident you can be that the signal is correct and will continue. 

The same thing applies to three moving averages. Imagine a trader plotting a 5 day, 10 day and 20 day MAs on a chart, then buy and sell signals generated from when the 5 day moving average cross the 10 and 20 day moving average. This approach is suitable for those who will accept some delay in entering new trades in exchange for more accuracy in signals. The 3 moving average model is useful in keeping out of the trade if the price movements stop trending and start going sideways, or becomes choppy and volatile, so that you would need an exceptionally long moving average to see the trend. 

The above example has a total profit of 830 pips. If you traded with $10/pip, that would total to a profit of $8300! The ratio of profit to loss is 2.23. This means you are making $2.23 for each dollar you risk in the markets. Generally, investment banks are happy with even $1.10 profit to loss, so this is a good return. A common question that people ask is why might it be unreasonable to scale out automatically - i.e. take some of the profit as soon as the trade proves successful. This adversely affects the profit to loss ratio as we are risking more money than we profit. 

AUD/JPY: Jan 2015 - Dec 2015

The second chart shows the same strategy being applied to a different currency pair. With a profit of 959 pips and profit to loss ratio of 7.27, it demonstrates the strategy is very effective in different currency pairs.

AUD/JPY: Jan 2012 - Dec 2015

To ensure the returns are not isolated to one period of time, the strategy is again tested on the AUD/JPY currency pair from 2012 to 2015. It is still profitable, making 3691 pips or points. The profit to loss ratio however is  now lower at 3.28, though this number is still acceptable.

Bollinger Bands AUD/JPY Jan 15- Dec 15 

This chart demonstrates the application of two strategies together on one currency pair- the AUD/JPY over the time period from Jan 2015 to Dec 2015. The two strategies are ranging and trending. This means that when the trend is falling, we are profiting from the ranging strategy (mean reversion). Here we are using moving average crossovers as signals. Profit is 583 pips, profit to loss ratio is 1.23.

Using additional filter - with Bollinger bands, when the price hits the upper band, we go short. When the price hits the lower band, we go long. Here Easy Trend is a filter developed and placed into this strategy. It shows up as the red line. When the price action is under the red line, go short, and if the price action is above, go long. It is looking for more than just the traditional hitting the band method- for instance, we are looking for the candle to close below the band, which suggests reversal. Compared to the initial strategy, the filter helps improve profits. Profitability is now 727 pips over one year, and profit to loss ratio is 3.75.

Watch List Signal Radar 

Automated Signal Indicator

Daily Income 

The above chart demonstrates hourly EU vs AUD. Bollinger bands identify where prices are at extremes. The middle is the moving average. Outer bands represent two standard deviations from the moving average. Bollinger bands act as rubber bands and works well with currency pairs. This chart is trading from 12th Feb to present, making 477 points. We are able to trade hourly charts and fully automate this process.

The circles represent the set up occurring. If the circle is at the bottom of the candle it indicates the candle closed below the Bollinger band, whilst a circle at the top indicates the candle closed above the Bollinger band. An up arrow indicates long position, down arrow is short position. Squares means it hit the pre-specified stop loss. Diamond means take profit. If the strategy involved closing out the trade when the price hits the next Bollinger band or stop loss, and taking profit where it hits baseline (middle of the band), then this is destroying the profit to loss ratio as we risk more money to make less.

As shown below, a filter is applied called "EasyTrend" that focuses on trading market direction i.e. "bullish", "bearish" or "ranging". This is applied through ticking the box 'Only trade with market direction' rather than simply going long/short with a high time frame. This means when the green line appears, go long, exit trade when trend changes and stop loss is on line or previous candle's low. The stop loss is variable - we can bring the trend line closer or further to the market. EasyTrend speed setting is 4, which makes the trading less sensitive to the market direction changes. As a result trades are slower to enter, though this strategy is good for high volatility. Cameron suggests an obscure time frame gives advantage against other traders. This changes the profit to loss ratio from 1.92 to 2.01.

Hourly Intraday Strategy: Ichimoku Indicator 

Ichimoku is intended as a at a glance indicator to allow traders to determine whether a trend is present or whether it is better to wait for a better entry time on a pair. Ichimoku can be used in bull and bear markets regardless of time frame or liquid instrument. The only condition which Ichimoku cannot be used is where there is no trend. There are essentially two dynamic lines that form a 'cloud'. These lines act as support and resistance lines, that is, when the price tries to go above, it will bounce back. This helps traders identify the trend of the current price relative to past price action. 
When the price is above the cloud, we enter a long trade as it indicates a start of a trend (cloud acts as support). When the price is below the cloud, we look for temporary corrections higher to enter a short position (cloud acts as resistance). Once this is set up, we then look at moving averages- Cameron has set up six moving averages, the fast moving average is a 6 period moving average and the slow moving average is 50 period moving average. These moving averages use mid prices rather than closing prices. 

Using Martingale's theory, the stake is increased each time we lose until there is a winning trade in which the amount at stake is reset. The results of this strategy are below:

The disadvantage of this strategy is the large drawdown experienced and greater volatility as shown in the results dashboard. However eventually this strategy was successful. It is advised against trading Euro Dollar as this currency pair is very noisy. A good hedging strategy could involve exploiting the Canadian and Australian dollar being almost mirror images to each other.

Overall we highly enjoyed the webinar meet up and highly recommend it.

No comments:

Post a Comment