SetOption based on Year()

In a rotation system where i set the WorstRankPlus.... i am trying to set this dynamcially based on the year().

WorstRankPlus = IIf(Year()<2019,1,0);
SetOption("WorstRankHeld", Totalpositions+WorstRankPlus);

However, it errors out saying i must have a number and not an array. Any help?


WorstRankPlus must be scalar to make it work in SetOption.
Currently it is array because of Year function being array.
Check out here

To elaborate on what @codejunkie already pointed out, you cannot set Worst Rank Held to different values during the back test. To implement this type of behavior, you would need to implement your own rotational logic in a CBT.

that's what I was afraid of..... I just needed confirmation so I didn't rack my brain all day... thanks