TBA,
originally it was my intention to follow the advice of Zizou and waste no more time on this. But since you, unlike him, are a kind soul, your post certainly deserves an answer.
The script already scales out on MAs, 1/3 when prices hit MA20, another 1/3 when MA40 is hit. IMHO it is...