This isn't MUI, sorry 'cause I don't have time to calculate things right now... But here's a 'lil tip:
What you need: 2 triggers, 2 Dummy units with inventories, 1 Ability used to switch between the inventories
Events: A unit acquires an item
Conditions: None
Actions: (Use if then else multiple actions)
If item class of item being manipulated equal to purchasable (your "sellable") and count of items carried by (your Hero) greater than 5 (equal to 6) then do give item being manipulated to (dummy1 "sellable" carrier)
If item class of item being manipulated equal to artifact (your "ancient") and count of items carried by (dummy2 "ancient" carrier") less than 6 then do give item being manipulated to (dummy2)
The next trigger should be associated with an ability...
Events: A unit starts the effect of an ability
Conditions: Ability being cast equal to (Inventory switch or somethin')
Actions:
If (Hero) is selected by (Player) equal to true then do select (dummy1)
If (dummy1) is selected by (Player) equal to true then do select (dummy2)
If (dummy2) is selected by (Player) equal to true then do select (Hero)
(In this way, when your main unit acquires an item, that item will automatically be given to one of your dummy units, depending on its class. And the ability will allow you to switch between the inventories by selecting those dummies using a trigger... This is not tested, this is just a tip by me, sorry if I don't have time to do it MUI)