Apprentice, maybe this can do the work if you can add the upper limit for uptrend and lower limit for downtrend in parallel.
http://www.fxcodebase.com/code/viewtopic.php?f=17&t=2467
The upper limit and lower is drawn by finding one higher high (upper) and one for lower low (down).
If it still cant be done, that's ok please don't mind
Thanks in advance,
Captain