Market Sentiment EA

I’ve been looking at using correlated markets to give an overall market sentiment. The theory is as follows:
USD and gold are both safe havens, so XAUUSD is difficult to know what the market is doing as I find it tends to lag events somewhat. By using something else vs USD that isn’t a safe haven, we can essentially cancel out the USD effect and create a sentiment on gold vs something that is not a safe haven.

Originally I set out to make an indicator that I would share on here, but that’s had some problems with my broker and candles not aligning so I made an EA instead.

EA function is that if sentiment is moving risk on then buy, if it’s moving risk off then sell. It’s intended to work for indices, but should work for risk vs safe pairs eg AUDUSD too, I’ll back test those later.

Backtesting on DAX shows profitability for each of the last 5 years to differing degrees. There’s some missing data before 2020, so not sure what that’s about or the accuracy. I’ll be running this on a demo account next week to fish out the bugs then set it live when I’m happy.