Hello geniuses 
i'd like to backtest this strategy if anyone can help me. i'd be grateful. thank you. 

Strategy with XOM (Exxon Mobil) and IBB
Analysis periods :

Four-year Reference Period for XOM and IBB: For example, from 2020 to 2023 to assess historical performance.
Two consecutive 4-year periods for IBB: From 2016 to 2019 and from 2020 to 2023, to assess IBB's upward trend.
 

Conditions for entering a Buy Position on IBB :

Condition 1 (XOM): Exxon Mobil must reach a new high in the current period (2024-2027) relative to its previous high in the four-year reference period (2020-2023).
Condition 2 (IBB): IBB must also reach a new high in the current period (2024-2027) in relation to its previous high in the same four-year reference period.
Condition 3 (IBB - Uptrend): IBB must have shown an uptrend for two consecutive three-year periods (2016-2019 and 2020-2023), defined by a closing price at the end of each period that is higher than the closing price at the end of the previous period.

Buy IBB: If all the above conditions are met, a buy position is taken on IBB at its new high. 
 

With a 10% target
calculation of drawdown 
and sharpe ratio calculation

the dates given are just to illustrate what I want to do. but you have to understand that I know when it's going to happen. so four-year reference period for XOM and IBB.  Two consecutive 4-year periods for IBB. 

 

thanks