Trading the spread of multiple symbols

Avatar
  • updated
  • Under review

Hi, from my initial research I think it might work very well to define a custom price as

p1 - x * p2

where p1 is the price of e.g. EURUSD

and p2 is the price of EURGBP


Basically, we are trading the spread here.


The main advantage of this approach is that the spread is always reverting. So If situations like covid as in march 2020 occur, the spread reverts because all assets went down.


If you are new to this concept, I can recommend this book: https://b-ok.cc/book/667720/3ffe3a?dsource=recommend

Image 1694


When the EA triggers an order to the custom symbol, there must be some specific logic which implemntes:

Going long of 1 lot with the custom asset, means:

going long of 1 lot of EURUSD and 1.3 short of EURGBP.

Vice versa for closing a position.



Avatar
0
Andrey Khatimlianskyi

Hannes, thanks for your investigation!

Terminal should build the maximum possible history of spread symbol — https://www.metatrader5.com/en/terminal/help/trading_advanced/custom_instruments#synthetic_bars

Try to download M1 data for GBPCHF and USDCHF before making the new symbol (delete history files before the next attempt!).

Avatar
0
Hannes Waser

all right, looks good actually.

Last issue (hopefully):

I only have data from June 2021. Not earlier.

Any ideas how to get it? The symbol-request ui does not get older data either.

However, the backtest for the 3 months looks good :P

Avatar
0
Hannes Waser

fixed: The issue was, that after import the formula got lost. I added it manually and the bars appeared.

Will do more tests then...

Avatar
0
Hannes Waser
Quote from Andrey Khatimlianskyi

Do you want to analyze spread chart for signals?

And do you also want to open several trades with different lots on signal (like sell GBPCHF 1.0 + buy USDCHF 1.38 lots)?


Why do you think it should work good? )

Please, try to test custom symbol I sent to you and share the results

Hi @Andrey,

1) yes, this is the idea (like sell GBPCHF 1.0 + buy USDCHF 1.38 lots). 
The main idea behind it is that if something like the covid crash is happening everything is going down.  So we are basically hedged against crazy events. And if this is true, the rest is some usual random distribution. 
And if this is true, we can apply martingale with much higher success here.  Tbh, this is something we need to prove or dismiss by backtesting.

2) I used your json file today and it seems like my MT5 does not load any candle data for the new symbol GBPUSD_CHF.

Thats what I see in a chart window:

If I try to "request" the symbol data

no candles become visible. :(

Any ideas what the issue might be?

Avatar
0
Andrey Khatimlianskyi
Quote from Hannes Waser

Just had another thought on that article: we should not really use it. It tries to find a portfolio with criteria's which do not really matter if CP is applied as the trading engine. ;)

I would prefer a portfolio which can be traded well using stochastic K or macd. Means: the trend reverses smoothly and does not generate false breakouts.

A better solution would be to select the combined symbols in the set file properties and let the MT optimizer search for the best combination. @andrey, would that be possible to run a backtest on?

Do you want to analyze spread chart for signals?

And do you also want to open several trades with different lots on signal (like sell GBPCHF 1.0 + buy USDCHF 1.38 lots)?


Why do you think it should work good? )

Please, try to test custom symbol I sent to you and share the results

Avatar
0
Hannes Waser
Quote from Hannes Waser

Nice! Looks like a good tool for the research of "good" portfolios before putting one into CP.

Just had another thought on that article: we should not really use it. It tries to find a portfolio with criteria's which do not really matter if CP is applied as the trading engine. ;)

I would prefer a portfolio which can be traded well using stochastic K or macd. Means: the trend reverses smoothly and does not generate false breakouts.

A better solution would be to select the combined symbols in the set file properties and let the MT optimizer search for the best combination. @andrey, would that be possible to run a backtest on?

Avatar
0
Hannes Waser
Quote from Andrey Khatimlianskyi

You can check yourself.

Just disable all order-management functions (SL, TP, martingale, trailing-stop, etc) and open a trade using panel.

You will also like this indicator, I guess — https://www.mql5.com/ru/code/11859 (description in Russian only).

Nice! Looks like a good tool for the research of "good" portfolios before putting one into CP.

Avatar
0
Andrey Khatimlianskyi
Quote from Hannes Waser

Awesome!

What happens in the background when 0.1 lot of GBPUSD_CHF is going long? 


Based on the uploaded pdf analysis (see above), which looks like the spread started a down-trend recently.


I started this week a manual test (opening a position of a short position of  1xGBPCHF - 1.4 USDCHF)

and this is the result sofar:

Really looking forward to test your json file @Andrey.


You can check yourself.

Just disable all order-management functions (SL, TP, martingale, trailing-stop, etc) and open a trade using panel.

You will also like this indicator, I guess — https://www.mql5.com/ru/code/11859 (description in Russian only).

Avatar
0
Hannes Waser
Quote from Andrey Khatimlianskyi

Hannes, I have some success with custom symbol testing.

Try to import symbol settings from the attached JSON file - GBPUSD_CHF_config.json (Ctrl + U -> Create custom symbol -> Import)

Custom symbol name has sense too, don't change it.

Here is visual testing of CP on custom symbol:



If you want to have longer history of spread, you should use custom script to generate and upload history.

Please, try to find it on mql5.com


Everything is possible )

Awesome!

What happens in the background when 0.1 lot of GBPUSD_CHF is going long? 


Based on the uploaded pdf analysis (see above), which looks like the spread started a down-trend recently.


I started this week a manual test (opening a position of a short position of  1xGBPCHF - 1.4 USDCHF)

and this is the result sofar:

Really looking forward to test your json file @Andrey.


Avatar
0
Andrey Khatimlianskyi
Quote from Hannes Waser

I did some more trials and this time I got the custom symbol data to work - at least partially.

- Creating a custom symbol worked after I added spaces into the formula: "GBPCHF - 1.38 * USDCHF" instead of "GBPUSD-1.38*USDCHF"

- The data is available as 1M candles after June. Dont know why I can't run the backtest on older data - even if use the "request" button inside the custom symbol properties...

- When running the backtest the position sizes are always super small. The final equity is not really changing. However I can at least generate some trades and see them on the chart.

Here is the set file I created to obtain the results:

statarb_v0.set

I am afraid I won't be of any further help here tuning the internals of MT5. Andrey, I hope these first insights are of some help for you.

In summary, The spread has much less power runs, which break the martingale EAs. Due to this property, the spread can already be traded with a very simple CP-configuration like the provided above using actually StochasticK + TrendFilter.

I think having the possibility within CP to trade symbol spreads or maybe one day also a symbol "package", would bring us here to a new robustness level where rather larger hedge funds operate.


Hannes, I have some success with custom symbol testing.

Try to import symbol settings from the attached JSON file - GBPUSD_CHF_config.json (Ctrl + U -> Create custom symbol -> Import)

Custom symbol name has sense too, don't change it.

Here is visual testing of CP on custom symbol:



If you want to have longer history of spread, you should use custom script to generate and upload history.

Please, try to find it on mql5.com


Everything is possible )