For a visual range alarm in HMD, e.g. raise an alarm if vessel (any dynamic object) has moved more than say 10m away from either a static position (waypoint) or another dynamic object:

 

Set up a Range/Bearing view between a static waypoint and your dynamic object (or between two dynamic objects).

Left double-click the view (e.g. View settings); select Data Items; check dataitem Rng and edit (double-click) the data item; 

Select page Alarm; set Max. value to say 10m;
Check Sound alarm if an audible alarm is needed as well;

 

Press Ok (accept); press Ok;

Same approach goes for a min. distance instead which can be setup similarly (or combined with both a max. and min. distance applied).