I got the idea of an algorithm using a gap, which would behave a bit like RSI, therefore I called it momentum line. Don't know if it's very useful or how to improve it, it can keep you in trends, however it suffers from whipsawing. My first attempt in programming a strategy.
A Donchian Channel divided in five zones, blue up trend zone, gray ranging zone, orange down trend zone