I hope it's not too late to revive this topic.

First of all, congrats to OP for coding your own dual momentum strategy!

I'm also working my own flavor dual momentum recently. The biggest problem I have is understanding how to properly do a reality check on a trend following, reinvesting strategy such as dual momentum.

Is it necessary to detrend PRICES for the benchmark result of reality check? As this will remove the trend, it really messes up the results. Any advise and maybe explanation on when and why this would be necessary?

// Reality Check
NumTotalCycles = 1000;
if (TotalCycle > 1) Detrend = PRICES+SHUFFLE;
else Detrend = PRICES;
set(LEAN,PRELOAD);

Or is it enough to just do it this way?

// Reality Check
NumTotalCycles = 1000;
if (TotalCycle > 1) Detrend = SHUFFLE;
set(LEAN,PRELOAD);