One of the questions we received recently was if it is possible to trigger a trade in a certain market based on another trading system trading a different market. The answer is yes. Here is how to do it and some traps to watch out for.
The upper chart (IEURUSD) runs on a simple test trading system while the trading system in the lower chart (IUSDCHF) just takes the opposite position.
Just like a custom study or condition, any trading system we create is automatically featured in the trading system section of the Formula Toolbox.
Probably the simplest way is to trigger an entry in the following system by the entry signal of the leading system. It is very important to hand over the same parameters that are used in the leading system (1).
It is also important to substitute the @ sign of the signal by the market the leading system is applied to. In this case it is IEURUSD (2).
Here we want to trade short if the leading system opens a long position; therefore, I am looking only for a long signal from the leading system (3).
The exits follow the same principal: you need to hand over parameters, symbols, and the direction of the leading trade as well.
The whole concept is pretty easy and straight forward if you run the two trading systems on markets with the same opening hours. It gets really tricky when the markets are open at different times and/or the bars do not exactly match.
For example, if trading EP and USA on 60-minute charts, the 60-minute EP chart will have bars with a 2:00 time stamp during the Globex night session, but with a 9:30 time stamp at the Globex day session. The USA chart will always have clean full hour time stamps such as 17:00. Because of these unwanted offsets, the trades might not sync up as perfectly as expected.
Another problem might be if the leading system is creating signals at times when the market of the following system is not open, for example with EP leading and DD (DAX in Germany) following. Signals, no matter if they are entry or exit signals, would not be recognized if they happen at times when the leading market is open, but the following market is not.
Here is a picture with two markets out of sync:
One way around this dilemma is using custom sessions of both markets to make them match 100%, but this also might influence the indicators of the leading system if we cut away trading hours there.
Alternatively, you could use the open position to determine if the leading system is in a trade or not.
LEAD^.OpenPosition(IEURUSD,5,2,9000) > 0
LEAD^.OpenPosition(IEURUSD,5,2,9000) < 0
At least the trades would start or exit if the following market kicks in again.
As a bottom line, it is possible to trigger a trade in a certain market based on another trading system trading a different market, but it needs a lot of very careful testing to make sure the results are realistic.
As a little bonus, you could create a custom study combining the two P&L curves (or any other statistics) together for a total result, but this only makes sense if the results are in the same currency; otherwise, you need to incorporate a conversion factor to get meaningful results.
The pac contains the leading system (LEAD) and the following system (FOLLOW) based on a very simple example created for the FX market using 1,000,000 as the trading quantity.