I modified an existing script for my use. This script will close 1/3rd of the "remaining" position every time you drag to the chart. But overall the partially closed positions will not be equal.