Adaptation of Kıvanç Özbilgiç's Turtle Trade PineScript

Here's my first shot at learning PineScript. I have adapted Kıvanç Özbilgiç's Turtle Trade PineScript :
Turtle Trade Channels Indicator TUTCI


I've also added an 83-year semi-log detrended SP500 index, which is explained at :
billhowell.ca/economics, markets/SP500/multi-fractal/1872-2020 SP500 index, ratio of opening price to semi-log detrended price.html
Trend Analysis

Disclaimer