Topic: ATR Trailing / Target

Could someone code a ATR based Profit Target and a ATR based Trailing Stop with a Trailing Floor (so that trailing only starts if X * ATR has been reached and then trails with X * ATR)?