Creating trends by using script

Please see Wiki - how to post code on this forum.
Then you can edit your post to format the code block and format the error text. Thanks.