Statistical Arbitrage V2.5

Developed exclusively for Metatrader MT4

by FX AlgoTrader

Contents

1.0 Product Overview

2.0 Statistical Arbitrage Principles

3.0 System Architecture

4.0 High Level Functionality

5.0 The STD Indicator

6.0 The Generic Arbitrage EA

Appendix A Code Changes/Enhancements/Bug Fixes

 

1.0 Product Overview

The FX AlgoTrader Generic Statistical Arbitrage V2.5 Engine is a substantially upgraded version of the existing FX AlgoTrader V2 arbitrage system. The product provides a semi automated, highly tunable arbitrage platform which can be run on multiple forex pairs on any chart timeframe. The product comprises a custom indicator (STD_Indicator_V2.5) and a custom expert advisor (Gen_Starb_V2.5) The system is currently published on the Metatrader MT4 trading platform.

 

2.0 Statistical Arbitrage Principles

Statistical Arbitrage is based on the concept of mean reversion for two highly correlation assets.

Correlation is a statistical coefficent which is used to measure how closely two assets move together. Assets which have a high degree of positive correlation (meaning they both tend to move in the same direction) have a correlation coefficient close to 1.0. Assets which exhibit a high degree of negative correlation (meaning when one goes up the other normally goes down) have a correlation coefficent close to -1.0.

The arbitrage opportunities discussed from here on will all relate to assets which are positely correlated ie they both tend to move in the same direction.

The idea behind statistical arbitrage is to enter trades when the correlation between two, normally highly correlated assets, breaks down temporarily. In this situation an arbitrage trader would look to trade the assets on the basis that the long term correlation will be restored and when this happens the trader would expect to make a profit.

I have recorded a introduction to arbitrage video which is available here:


The chart above shows the “spread” of the AUDUSD and NZDUSD between 2007 and 2011.

The spread is calculated by differencing the logarithm of the two forex pairs. Looking at the spread over the long term we can see the spread oscillating between stationary and directional conditions. When the spread is stationary the correlation between the two forex pairs is high and when the spread becomes directional the correlation between the pairs reduces. In 2008 the spread became highly directional due to the credit crunch. In essence the AUDUSD weakened considerably relative to the NZDUSD - the correlation between the pairs broke down.

The principle of statistical arbitrage is to time trade entries so that we enter when the spread is reverting (moving back) to the mean or in other words when the spread is 'recoupling'.

To examine how trades are made around the spread let's look at another chart in more detail.


Screenshot of Daily EURUSD/GBPUSD spread 07/03/11

In the screenshot above we can see the spread oscillating around it's moving average and breaching the red and yellow dotted lines which represent +0.5 and -0.5 standard deviations of the spread. When the spread breaches the levels defined by the standard deviation dotted lines we may have an arbitrage opportunity. The small red dot on the right hand side of the screenshot is where the V2.5 arbitrage engine placed a trade. I configured the arbitrage engine to only take trades when the spread was above or below the STD levels (trader defined) and I also told the system that I only wanted to take trades where the spread was recoupling i.e. moving back towards the mean. More on the different types of trades the system can make later.

 

3.0 System Architecture

 

 

 

 

4.0 Statistical Arbitrage V2.5 High Level Functionality

The V2.5 system provides the following trade functionality:-

5.0 The V2.5 STD Indicator (MT4 Indicator)

The V2.5 STD indicator has been hugely improved over the existing V2 system.

First of all look let's take a look at the screenshot below and describe the components of the indicator.


The data display on the right hand side of the indicator tells us important information which is detailed in the table below.

STD Data Label Description Table
Data Label

Description

 

EURUSD-GBPUSD

 

This is the pair configuration for the arbitrage we’re tracking. So this indicator will calculate, plot and monitor the spread between the EURUSD and the GBPUSD.

 

 

STD Multiple

 

The trader has set the STD multiple to 0.50 which means the STD indicator will draw trade trigger thresholds at +2*STD Multiple and -2*STD multiple around the moving average of the spread. E.g. STD Multiple=0.5 creates upper and lower trade trigger thresholds of +1 STD and -1 STD.

 

 

Upper Trigger

This is the current value of the upper trigger zone.

 

Lower Trigger

 

This is the current value of the lower trigger zone.

 

 

Reversion Target


This value is the reversion target the trader has set. There are two options for reversion targets which are:-

  • 'Reversion to MA' - i.e. a reversion to the moving average of the spread

  • 'Reversion to Opposite Band' -

If the 'Reversion to MA' parameter is set to 'false' in the (STD indicator external input options) the system will calculate the value for a trade exit based on a full reversion to the opposite trigger zone or band. Note: STD lines are effectively a Bollinger band which dynamically adjusts to asset volatility. Having an option to change the trade target is very useful. As an example let's say you set up your arbitrage on an hourly chart but the spread did not recouple. On closer inspection you realize that the long term spread is directional and your arb is on the wrong side of the trend. In this case you could either manually close the arb and put it down to experience OR….. you could examine how much the spread is typically swinging around the MA and redefine your exit target accordingly. Clearly there is a risk to this approach as there no guarantees the spread will retrace. However, forex spot prices ‘wiggle’ a fair amount and there is a reasonable chance you will be able to exit an erroneous trade for a small profit or for a smaller loss if you use time to your advantage.



The screenshot above shows a 4 hour chart for EURUSD-GBPUSD. The trade was executed on a shorter timeframe and the red dot represents the aggregate price which the arbs were opened. The arb was Short EURUSD and Long GBPUSD.

The 4 hour spread for the two pairs should worry you. You can see our trade entry point (the red dot) was made below the 4 hour moving average of the spread. This means that if we set our reversion target to the moving average the trade would be closed at a loss. Let’s examine this in a little more detail with some numbers.

a
I’ve drawn two horizontal red lines on the STD indicator pane. The top line represents the Reversion Target which is -0.15386190.

The red dot where the trade was executed was at -0.15418 which is lower than our intended exit. This would result in a loss.

Clearly in this situation we need to revise our exit target. We can do this in two ways which are:-

1. Change the chart execution timeframe so that the exit target is lower than our entry.

2. Adjust the reversion target in the external input parameters so that the target is based on a reversion to the opposite band (in this case lower trigger level – the dotted yellow line)

The screenshots below demonstrate each approach.

b
Screenshot showing the reversion target being moving to the opposite band. Note the reversion target figure has changed to -0.16662913. I drew a red line around the -0.1670 level and then referred to the V2.5 Arb Engine (EA) for a profit estimation which showed a potential arb profit of $5000 based on a complete reversion to the opposite band (lower trigger level). More on this when we discuss the V2.5 Arb Engine.

c
In this screenshot I have changed the chart timeframe to Daily. What a big difference a day makes! We can see our entry isn’t that bad. Sure the spread has decoupled from our entry but our Reversion target is comfortable below our entry. Remember our trade was short EURUSD and Long GBPUSD so the spread is reflecting the EURGBP. In essence our trade is short EURGPB as we’ve removed the dollar component on both sides of the arb. Referring to the V2.5 Arb engine indicates a potential profit of around $3500 USD based on a standard reversion to the mean. If we changed our reversion target to the opposite band (the yellow dotted line which in this case is -2STDs) the potential arb profit would be approximately $10,000 USD based on 5 lot positions on both sides.

Timing is everything!

Where we choose to set our target will depend on numerous factors. If we’re arbing off longer timeframes and intending to hold arbs for several days/weeks we have to think about fundamentals. So in the case of the EURUSD-GBPUSD arb we know that at the time of writing the BOE’s MPC (monetary pricing committee) are considering a UK rate rise in April. The city are pricing it in and there’s a good chance this will support cable (GBPUSD). On the other hand the Euro has all kinds of uncertainties ahead due to the PIGS – Portugal,Ireland,Greece and Spain. So you could argue a short EURGBP position stacks up from a fundamental perspective particularly in view of sterling's decoupling from the Euro during the credit crunch i.e. Cable depreciated more against the dollar than the Euro.

The next component to our decision is technical. Let's look at the long term trend for the spread of EURUSD-GBPUSD.

f

Here I looked at the long term spread for the EURUSD-GBPUSD. The timeframe is from December 2000 to present. We can see the spread stayed pretty stationary until 2007 after which the Euro appreciated hugely in value against sterling. Drawing some simple trend lines over the spread demonstrated several things which are:-

  • The long term trend of the spread has been upwards.

  • The spread broke the aggressive uptrend (the steeper uptrend in red) around January 2010.

  • Since Dec 2008 the spread has been moving in a descending channel.

So, essentially the trader can look at a combination of fundamentals and technical for longer term arb trading. Short term arb trading does not necessarily require the same degree of analysis although some may argue that locking short term arbs in the direction of the long term trend is a sensible de-risking strategy.

 

 

MA Delta Threshold


The MA Delta threshold allows short term arbitragers the ability to screen out directional spreads and to only take trades where the spread falls inside the MA Delta Threshold. The screenshot describes this pictorially.


a

The screenshot above shows the STD Indicator on the EURUSD-GBPUSD 5 minute chart. Now we see some additional detail which was obscured on the higher timeframes. The blue dashed lines around the moving average (in white) represent the cost of executing the arbitrage trades i.e. the spread costs. This helps traders to set the STD Multiple wide enough to clear the spread cost channel. Clearly if we try to make arbitrage trades inside the spread cost channel the chances of making a profit a severely impaired!

The MA Delta Threshold (the dotted green lines) creates a trader defined channel above and below the spread moving average (the white line). The trade logic has been set up so that if the spread moving average breaches the MA Delta Threshold channel within the last 5 periods the spread is deemed directional. We can see in this example the spread is contained by the MA Delta Threshold and the ‘Spread Status’ indicates the spread is Stationary and recoupling to it’s moving average (the white line)

b

In the example above I moved down to a 1 minute chart and also narrowed the MA Delta Threshold Channel by changing its parameter to 0.0001. We can see a much narrower MA Delta Threshold channel (dotted green lines above and below the MA of the spread in white). We can also see the spread is not contained by the MA Delta Threshold Channel and therefore the ‘Spread Status’ is ‘Directional –Recoupling’. It is recoupling as the spread is moving towards its moving average.

Another example of a stationary spread where the MA is contained by the entire length of the MA Delta Threshold channel (denoted in yellow for clarity) If any part of the MA (white line) is outside the MA Threshold channel V2.5 would deem the spread directional as shown in the screenshot below.

 

 

Spread Status

 

Displays the current status of the spread with reference to its coupling and relationship with the MA Delta Threshold Channel.

There are four modes which are:-

    • Stationary – Recoupling
    • Stationary – Decoupling
    • Directional – Recoupling
    • Directional – Decoupling

The optimum mode for arbitrage entry conditions are ‘Stationary Recoupling or ‘Directional Recoupling’. The trade entry conditions can be set in the V2.5 Arb Engine (EA). This is discussed in more detail in the V2.5 Arb Engine Section.

 

LT Trend

 

Indicates the long term trend of the spread moving average based on a trader defined number of periods defined using the ‘LT_Trend_Period’ external input parameter.

The LT Trend calculation is based on the current chart timeframe so if the current moving average of the spread is greater than the moving average defined 20 periods ago (assuming the LT_Trend_Period’ is 20) the LT Trend will be 'Rising'

If the current moving average is lower the moving average defined 20 period ago (same basis as above) the LT Trend will be “The LT trend indication can be helpful for determining whether to lock the system to take only trades in the direction of the trend. We will discuss this in the V2.5 Arb Engine in more detail.

 

6.0 The V2.5 Arbitrage Engine (MT4 Expert Advisor)

As we did previously let's look at the chart display for the Arb Engine (V2.5 Arbitrage Engine).

 

 

 

Gen Starb V2.5 EA Data Label Descriptions
Data Label

Description

 

Arb Data eg EURUSD:GBPUSD

 

The first data item shows the arbitrage pair selection, in this case EURUSD & GBPUSD. The Arb engine is self configuring and takes its data from the V2.5 STD Indicator assuming this is loaded on the chart and configured with arbitrage pair data.

 

 

System Time

 

This shows the MT4 system time or the timeframe which your charts are based on. This is useful for accurately configuring the trade timing controls which we’ll discuss later

 

 

Spread

 

This shows the current spread for the arbitrage pairs – this will be slightly different to the spread displayed in the STD indicator window as this spread calculation is based on the log of the difference between the ASK prices of each arbitrage pair. The spread calculation used in the STD Indicator is calculated using the closing data for the arbitrage pairs (in order to produce indicator plots over time)

 

 

High Trigger

 

This shows the high trigger level. If the spread exceeds the high trigger level and other trade entry conditions are met the system will execute a short Pair1/long Pair2 trade.

 

 

Mean

 

This is the current value for the moving average of the spread.

 

 

Low Trigger

 

This shows the low trigger level. If the spread exceeds the low  trigger level and other trade entry conditions are met the system will execute a long Pair1/short Pair2 trade.

 

 

System Status

Will display ‘Active’ or ‘Passive’ – the system will go into passive mode under the following conditions:-

  • The trade timing controls do not permit trading within the current timeframe

  • The system is running in aggregation mode and the daily aggregated profit target has been achieved.


 

Mode

This displays the current mode for the Arb Engine on the current chart. There are four modes which are:-

  • Auto – Entry Search’ – system is actively looking for arb entries

  • Auto – Exit Search’ – arb is filled and system is looking for suitable exits

  • Manual’ – ‘Run Automatic’ external input parameter is disabled and the system will only provide alerts if suitable arbs are identified.

  • Disabled’ – occurs when either:

    • The trader has manually closed all arb trades using the ‘Close_All_Trades’ external input parameter

    • The system is running with profit Aggregation enabled and the daily profit target has been achieved.

 

Trade Type

 

This displays the current trade type the system is configured for. There are four trade types which are:-

  • Stationary- Recoupling

    • Where the spread is contained within the MA Delta Threshold Channel (in the STD indicator) and the spread is moving (recoupling) towards the spread moving average

  • Stationary - Decoupling

    • Where the spread is contained within the MA Delta Threshold Channel (in the STD indicator) and the spread is moving away (decoupling) away from the spread moving average

  • Directional - Recoupling

    • Here the spread is not contained within the MA Delta Threshold Channel (in the STD indicator) and the spread is moving (recoupling) towards the spread moving average

  • Directional - Decoupling

    • Where the spread is not contained within the MA Delta Threshold Channel (in the STD indicator) and the spread is moving (decoupling) away from the spread moving average

If the spread status indicator in the STD Indicator matches the Trade Type and the spread also meets the entry conditions (spread > Upper Trigger or Spread < Lower Trigger) an arb trade will be executed. The Trade Type is set in the external input parameters for the Arb Engine.

The optimum trade types for stat arb trading are Stationary Recoupling and Directional Recoupling. It would be unwise to use Directional Decoupling mode on long term arbs. This mode may have some use on short term arbitrage set ups where the STD Multiple (Trigger Zones) is a long way from the mean. An example of this type of short term arb could be trading economic news releases where the spread can temporarily become extremely directional.

 

 

Lock To LT Trend

 

Allows the trader to configure the system so that only trades in the direction of the long term trend (of the spread) are taken. The ‘LT Trend’ is determined by the chart timeframe and also the ‘LT_Trend_Period’ defined in the STD Indicator external input parameters.

Example.


The screenshot shows where trades would be executed if the System had ‘Lock to LT Trend’ set to True. System would take two long trades when the spread breached the Lower Trigger line. Precise entries would be determined by the Trade Mode as discussed earlier.

 

 

Email Alert

 

If set to true the system will send an email alert to the email address specified within the MT4 email options. The email alert frequency can be determined using the Email Interval which has a default value of 60 minutes

 

 

Max Risk

 

Allows the traders to define the maximum allowable risk as a percentage of account equity. The profit/loss for each arbitrage trade is defined as the aggregated profit or loss for both pairs within the arbitrage. If the aggregate loss for any arbitrage pair exceeds the maximum allowable risk the system will automatically close the arbitrage.

 

 

Lot Size

 

Allows the trader to set the position size for the pairs.

 

 

Reversion Potential

 

Calculates the profit potential based on reversion to defined target. The reversion target is set in the STD Indicator using the ‘Revert_To_MA’ external input parameter. By default the system is set to revert to the moving average of the spread.

 

 

Profit Targetting


Applicable External Input Parameters:-
- 'Auto_Profit_Targetting'- true/false
- 'Exit_When_Profit_Equals' - (value in dollars)

If 'Auto_Profit_Targetting' is set to 'false' the trader can manually set a defined profit target using the 'Exit_When_Profit_Equals' parameter. If 'Auto_Profit_Targetting' is set to 'true' V2.5 will automatically define the profit for each using the reversion potential algorithm which dynamically adapts to the spread and moving average.

 

Aggregation

 

Applicable External Input Parameters:-
- 'Profit_Aggregation' - true/false
- 'Profit_Aggregation_Auto_Reset' - true/false
- 'Profit_Aggregation_Timed_Reset' - true/false
- 'Profit_Aggregation_Reset_Time' - Seconds

Allows the trader to run a daily aggregation system where the system has a defined aggregated profit target. If the profit for closed trades and the current profit/loss for open trades exceeds the aggregation target the system automatically closes all open trades and shuts down. The trader can also control whether V2.5 automatically resets and when this action takes place.

 

 

Closed Arb Profits

 

Displays the profit/loss of closed arb trades generated since 00:00 from the order history pool.

 

 

Open Arb Profits

 

Displays the current profit/loss for ALL open arb trades on the MT4 platform.

 

 

PL Current Arb

 

Displays the current profit/loss for the current arb, if applicable.

 

 

Risk of Stop Out

 

Displays a risk gauge for the current arb. The gauge will dynamically update based on the profit/loss. As the loss approaches the maximum risk threshold the gauge will display a higher risk reading.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Appendix A - Code


Changes / Enhancements / Bug Fixes

Change Data

Date

Notes

 

Addition of Global Control Variables - GVARs.

 

20/05/11

 

Some V2.5 traders run the system on multiple charts and if they want to make global changes to system parameters such as lot sizing or aggregation targets they can do so by using the MT4 global

GVARs - (Global Variables) can be added manually into the Global Variable Table in MT4.

Press F3 to display the GVAR table. If the variables listed below are present in the GVAR table they will overide local controls (specific to lot sizing and aggregation targets) for any V2.5 EAs loaded on the platform. The current GVARs are:-

  • 'V2.5 Global Aggregated Target' - allows trader to define a global aggregation target for all V2.5 EAs

  • 'V2.5 Global Lot 1' - defines primary pair lot size- eg EURUSD/GBPUSD - primary is EURUSD

  • 'V2.5 Global Lot 2' - defines secondary pair lot size- eg EURUSD/GBPUSD - secondary is GBPUSD

As well as aggregation tragets and lot sizing some traders requested the facility to dynamically control the operation of the system based on the Equity Balance Ratio. If the system is being run on multiple charts multiple open arbs can be triggered depending on market conditions. Traders need to wait for their arbs to turn into profits and it was deemed desirable to control the activity of the arb engines based on the Equity Balance Ratio. This concept is called 'Dynamic Slow Down' and there are four GVARs which are used to control it.

They are:-

    • 'V2.5 Global Dynamic Slow Down' - If this GVAR is present the system will dynamically calculate the Account Balance/Equity Ratio and create a new GVAR called 'V2.5 Equity Balance Ratio' containing this data

    • 'V2.5 Global Dynamic Stop Level' (eg 0.8) - If Equity Balance Ratio falls below the Dynamic Stop level the system will not open any new trades.

    • 'V2.5 Global Dynamic Start Level' (eg 0.9) - If Equity Balance Ration rises above the Dynamic Start level after the system has gone into "Slow Down" the system will start opening new positions again. Essentially business as usual.

If all three Global Dynamic GVARs are specified (V2.5 Global Dynamic Slow Down,V2.5 Global Dynamic Stop Level & V2.5 Global Dynamic Start Level) the system will cease opening new trades when the Equity / Balance ratio falls below the value specified by the 'V2.5 Global Dynamic Stop Level'. When the Equity / Balance ratio improves and is greater than the 'V2.5 Global Dynamic Start Level' the system will go into normal trading mode. When the system is in Dynamic Slow down mode the Mode will be changes accordingly.

 

 

Lock to LT_Trend

 

20/05/11

 

Assuming the LT_Trend_Period set at 20 - the system will  loop through the last 20 periods and if the current MA value is higher than the previous bar a ‘rising’ counter will increment. The opposite or a falling trend – a 'falling' counter will increment. If the rising counter is greater than the falling counter at the end of the calculation the trend is assumed to be rising. Vice versa for falling conditions. The length of the LT_Trend_Period is important if you want to lock the EA to trade the LT_Trend direction. For short timeframes ie 15 mins and below the LT_Trend_Period should be reduced to reflect the immediate spread dynamics. For longer term arbs the opposite is true – if you’re trading off hourly charts and you use an LT_Period of say 100 the trend indication will be more indicative than a period of say 20. 'Lock_To_LT_Trend' should keep you on the right side of the MA spread trend.

 

 

Lock Long/Lock Short

 

20/05/11

 

Some V2.5 customers have been experimenting with a alternative approach to dynamic rebalancing in cases where an open arb trade is decoupling from it's MA and creating a drawdown.Rather than rebalancing the lot sizing of the existing arb a new arb is set up which is the exact opposite of the current arb. For example if you had a 5 lot per leg EURUSD/GBPUSD arb which was triggered off an houly chart you would set up a GBPUSD/EURUSD arb running on a 15 minute chart and use the 'Lock_Long' or 'Lock_Short' parameters to force any new trades off the 15 minute chart to the exact opposite of the arb on the longer timeframe. This creates a perfect hedge and also allows reduces the drawdown as the shorter term arb will gradually eat into the drawdown created by the longer term decoupled arb. The principle is simply based on trading short term spread volatility seen on the shorter timeframe. This approach is not a guaranteed "Get of jail free card" but it can substantially de-risk positions where significant decoupling has taken place and in tandem reduce the magnitude of a potential loss.

 

Mods to the ‘Trade_Off_Timeframe’ system

 

20/05/11

 

Some traders get confused about the system not making trades due to the Trade_Off_Parameters not being set for the specific timeframe. We’ve introduced a speech based alert which tells the trader the chart is disabled on the timeframe. The Mode label now also changes to reflect the system isn’t active for the timeframe. Another external parameter has been added which allows the trader to turn off the speech based alerts – it’s called ‘Audio Alert’ – the default value is true.

 

Bug Fix 20/05/11

Fixed risk control label clashing with P/L data for current arb

Bug Fix 20/05/11

Added additional Debug and change revision options.

Trend Locking Mod (EA) 10/06/11

Changed 'Lock_To_LT_Trend' label in EA to 'Trend Locking' - there are three external input parameters as detailed earlier: Lock_Long; Lock_Short and Lock_To_LT_Trend

LT Trend Label Mod (STD Indicator) 10/06/11

Added 'LT_Trend_Period' data to 'LT Trend' label in STD Indicator eg Rising(20)

X Pos Modification (STD/EA) 10/06/11

Improved EA data placement in chart window so that EA auto locates if 'Label_X_Position' value is changed in STD Indicator

Time Display Mod (EA) 10/06/11

Added zero padding for single digit system time variables to improve system time display

Auto Hedging Added 10/06/11

 

Added Auto Hedging Feature which has three new external input parameters:-

  • Auto_Hedging - true/false

  • Auto_Hedging_Threshold - loss level at which auto hedging takes place (must be negative value otherwise system will produce speech based alert and won't allow hedge trade to process)

  • Exit_Hedge_At_Entry - true/false - if set to true system will close the hedge component if the spread recouples to primary arb entry point (red dot on STD indicator trace - Entry point can also be viewed in the GVAR table. It's notation will be 'Pair1/Pair2 Entry' followed by a value.

 

Profit & Loss Data Label Revision 10/06/11

 

Revised P&L data labels with additional P&L Hedge value. If hedge trades are made the system will aggregate the total open hedge P&L and display it in this location. When the spread recouples to the primary arb entry point and if 'Exit_Hedge_At_Entry' is true the system will close the hedge and save the hedge P&L data in a specific GVAR. Closing hedges at the primary arb entry level will always carry a hedging cost which will be subtracted from the primary arb P&L data. The 'P&L Current Arb' data label will now be updated to reflect the cost of the hedging process. If the spread recouples to the mean (reversion target) and the 'P&L Current Arb' value is positive the trade will close in the normal fashion

 

Magic Number Implementation 10/06/11

 

Magic_Number external input parameter - default value is 999999999. This can be used for all V2.5 arb trades or changed to whatever the trader defines. This has been implemented to stop other EAs erroneously editing SL and TP levels and prematurely closing one side of arb trades.

 

Speech Alert Enhancements 10/06/11

 

Speech alerts and warnings added for:-

  • Trade Off Timeframes (if trading is disabled for particular chart timeframe)
  • Trade open and closed
  • Hedge Trade open and closed
  • Warning for hedge locking conflict
  • Warning for incorrect hedging threshold

 

Close All Trade Enhancement 10/06/11

 

'Close_All_Trades' function now closes all V2.5 trades on the platform (use with care)

 

 

Auto Hedging Functional Improvements

 

10/06/11

 

Auto Hedging function

  • An additional external input parameter in the Gen Starb V2.5 EA has been added called "Engage_Hedge_Exit_Logic_After" - this allows the trader to pause the hedge exit logic for a defined number of seconds after the hedge is initially opened. This prevents the hedge from being closed by spread volatility if the hedge hedge opening level is close to the orginal arb entry (denoted by the red dot)

  • The Mode label has also been improved so that when a hedged position is enabled the label is changed accordingly. The hedged mode label has two states:- the first one shows the time in seconds before the hedge exit logic becomes active and the second state is where the hedge exit logic is active and the system is monitoring the spread/entry differential for an exit.

  • The hedge exit code has also been debugged so that the hedge is closed correctly when the spread is above/below the initial trade entry point (depending on the initial arb direction ie whether the primary is long or short)

  • Also the hedging strategy is now repeatable - so if the spread reverses again and the primary arb position breaches the auto hedging threshold the system will rehedge the overall positions. This process will continue indefintiely until the spread moves in the planned direction and the aggregate profit for initial and the cost of the hedging options is greater than zero. So in essence the objective is to forget about arb trades which don't go to plan initially. Eventually (equity permitting) the spread will go in the intended direction. The added bonus is the spread doesn't have to travel nearly as far for the trader to exit the trade and move on in comparison to an unhedged arb which goes into deep drawdown.

 

 

Correlation Indicator

 

10/06/11

 

  • The old indicator can be quite machine intensive in CPU terms as it calculated real time correlation over 200 periods for all the active pairs every time a incoming tick was received in the underlying chart. Clearly in active markets this could create quite a heavy processor overhead especially for less powerful machines. An additional parameter called "Recalc_Period" has been added to the system so that the trader can decide how frequenty the indicator recalculates "real-time" or "near real time" correlation data. The default value is every 60 seconds which seems more than adequte unless you are an HF arb trader.

 

Profit Locking 25/09/11

 

Two new external input parameters added which allow the provision of a trailing stop based on the total arb profit. This allows the trader to lock in profit on a trailing basis. The two external input parameters are:-

  • Profit Locking - true/false -

  • Trailing_Profit - the physical profit at which point the system will start locking in profit.

 

Unilateral Trading Option 01/10/11

 

This allows the trader the option to only trade one side of the arb pair. When Unilateral Trading is set to true the system will only trade the first pair in the arb. For example if the trader has set up an arb on the EURUSD and GBPUSD. The system would take the first quoted pair in the data label from the STD Indicator ie 'Pair 1' in the external input parameters. Trend locking can be applied when the system is in Unilateral mode so the V2.5 Arb Engine can be used for vanilla directional trading with the bonus of an automated entry.

 

Profit Locking Label 17/01/12

Added Trailing Profit figure into 'Locked in Profit' label in main EA data display window

Split Lot Sizing for Leg A/Leg A 17/01/12

Added option to specify lot sizes for leg A/Leg B and modified profit monitoring system accordingly.

IsConnected check 17/01/12

System checks for internet connection before commencing program run

Account number resolution 17/01/12

System checks MT4 account number has been resolved before commencing processing. Prevents erronous F16 function calls.

DLL & Expert import alerts 17/01/12

Added check code on the STD indicator and EA to alert traders if the DLL and Expert import check boxes are not ticked.

Modified DLL and library files 17/01/12

Changed the login process to allow traders 2 additional login attempts if Ref number is incorrect. Also changed license checking procedure in DLL to cater for duplicate MT4 account numbers and recoded library files accordingly

Debug Modification 17/01/12

Ammended F16 Debug codes

Changed label naming convention in STD indicator 17/01/12

All data labels in the data window now have an 'FXB' prefix. Old version used an 'FXA' prefix. This stops the EA from deleting 'FXA' prefixed data on initialisation.

Added IsTradeAllowed to V2.5 order module 17/01/12

Inclusion of IsTradeAllowed() check prevents trades being submitted it context is busy

Modified Pair detection algorithm in EA 17/01/12

Caters for 'FXB' prefix in 'FXBPair' data label created by STD indicator

     
try { var pageTracker = _gat._getTracker(" "); pageTracker._trackPageview(); } catch(err) {} x