Yeah I guess I can manage with .posTo or pathing.endPos but what if the enemy is not moving ? If his .posTo (or pathing.endPos) is the same as his .pos. ? This champ could be facing you or turning his back on you :/
If you can put me on a working way, it would be nice 
Both .posTo and pathing.endPos do not contain the data you want for a custom solution.
What you want to do is save the current path of a unit and check if it changes on a move order.
Here is some untested code (not behind my desk atm, so cant grab the tested version), but you should be able to figure out how to make it work.
Note: most of the pathing data is broken, also the data you get from :GetPath()
local dirOnMoveOrder = {}
function HasMoved(unit)
local index = unit.pathing.pathIndex
local currPath = unit:GetPath(index)
local prevPath = dirOnMoveOrder[unit.networkID] or myHero.pos
local isMoving = unit.pathing.hasMovePath
if isMoving and index ~= 0 and prevPath ~= currPath then
dirOnMoveOrder[unit.networkID] = currPath --maybe extend this from unit, so it wont bug when the unit reaches his endPos
return true
end
end