Rotation - With Position Holding Period and Profit variables

I am trying to create a rotational strategy that focuses on tax efficiency in terms of short term gains. For example, During each evaluation period if a stock drops below the worstrankheld, it would be sold ONLY IF

  1. The position has a negative profit
  2. Or the position has been held for more than 252 bars (to get long term gain tax treatment)

If the position drops from the worstrankheld, has a positve profit but has not be owned for more than 252 days, IT WILL NOT SELL..

Any ideas?

AmiBroker's built-in Rotational Mode uses only PositionScore to determine when to enter and exit positions. I think it would be difficult to implement your rules using Rotational Mode. Instead, I would write it as a normal backtest, using StaticVarGenerateRanks() to rank all your stocks so that you can implement the Worst Rank Held concept as one of your exit rules.

Depending on your strategy rules, it may be difficult/impossible to determine whether "position has a negative profit" without using a CBT.

Thanks for the reply. I was afraid i would have to use CBT..... do u know of any examples of rotational strategy that doesnt use rotational mode? i have looked for quite awhile and had no luck. again thanks