How can I get a simulation to buy in specific periods of time?

Hi, I want to design a simulation that buys only in specific periods of times, in others it goes to cash.For example in following 3 years it would buy stocks only in two different periods of time. I tried with Asofdate and Dayssince, but still with no success. Could anyone help me? Thanks!

You could set up an Exposure List for the investment periods.

Here is a list that results in no stocks being bought in the summer months.

04/26/99 10/24/99
04/24/00 10/29/00
04/30/01 10/28/01
04/29/02 10/27/02
04/28/03 10/26/03
04/26/04 10/24/04
04/25/05 10/23/05
04/24/06 10/29/06
04/30/07 10/28/07
04/28/08 10/26/08
04/27/09 10/25/09
04/26/10 10/24/10
04/25/11 10/23/11
04/30/12 10/28/12
04/29/13 10/27/13
04/28/14 10/26/14
04/27/15 10/25/15
04/25/16 10/23/16
04/24/17 10/29/17
04/30/18 10/28/18
04/29/19 10/27/19
04/27/20 10/25/20
04/26/21 10/24/21
04/25/22 10/23/22
04/24/23 10/29/23
04/29/24 10/27/24
04/28/25 10/26/25
04/27/26 10/25/26
04/26/27 10/24/27
04/24/28 10/29/28
04/30/29 10/28/29
04/29/30 10/27/30

Let’s say you want to go to cash on 9/7/22 and back in stocks on 12/4/22, then cash on 3/2/23 and stocks on 5/23/23. In your simulation, click on the Hedge tab, then on “Go to Cash.” In the Entry Rules box type in (AsOfDate > 20220907 and AsOfDate < 20221204) or (AsOfDate > 20230302 and AsOfDate < 20230523). In the exit rules box type in (AsOfDate > 20221204 and AsOfDate < 20230302) or (AsOfDate > 20230523).

great tips, thank you!
going further, is there a possibility to use instead of cash another strategy as a hedge? My aim is to combine long strategy with a short strategy. The moment the yield curve inverts would be the starting point of hedging with short strategy. In all of my long strategies invertion of the yield curve preceded >30% drawdowns.

You need to set up a formula for when the yield curve inverts like:
$YieldCurveHedge_entry
and $YieldCurveHedge_exit
Then you use them in the hedge module as entry and exit rules. Use ETF SH for going short.