This is a simple implementation of Jesse Livermore's Market Key as presented in his book. To define the areas for the trends I use ATR and as a base line the average between highest and lowest price on a defined period (default is 26). The script is actually my first script, if you use it please give me a feedback, any advice on the code is really appreciated