Try this:
=QUERY(QUERY({QUERY('Movimentações'!A2:J,"Select F,C,D,E,(I*-1),(I*-1*J),(I*0),(J*0) where A matches 'Venda' label (I*-1) '', (I*-1*J) ''",0);QUERY('Movimentações'!A2:J,"Select F,C,D,E,(I*0),(J*0),I,(I*J) where A matches 'Compra'",0)},"Select Col1, Col2, Col3, Col4, sum(Col5),sum(Col6),sum(Col7),sum(Col8),sum(Col5)+sum(Col7) where Col1 is not null group by Col1, Col2, Col3, Col4",0),"Select Col1, Col2, Col3, Col4, Col8, (Col6*-1) where Col1 is not null and Col5 < 0 label (Col6*-1) ''",0)
Result:
You will just need to add the Total column that you already have next to it.