Here´s a simple code to calculate price channels based on 2 time windows. After reading the book, anyone can trade the famous "turtle style".
For example, If you want to build and back-test a simple trend-following system, turtle style, you will need a moving channel of lowest and highest X-day closing price. If price breaks out, you should open a position. Converserly, if price moves in the opposite direction after a break-out, you should put stops in channel of X-N size. Usually, you can try that with 20 and 10 days windows.
This function will calculate the moving bands for you. Enjoy.