AFL code - buy on the trading day 20

Hi all,

How to write the code buy on the trading day 20 or 100 for every year?

Thanks very much!

Maury

@maury314 a possible idea here,

TradeDayOfYear = BarsSince( year() > Ref(year(),-1) )+1;
// alternatively,  BarsSince( year() != Ref(year(),-1) )+1;

Buy = TradeDayOfYear == 20;