Thanks...I will have a stop as well as filters. The code above is the first step.

As you can expect, an exit like this will increase the system's accuracy to the detriment of the reward/risk ratio. I might end up having a trailing stop exit instead. Just starting with Williams' original work and developing it from there.