@feliziano7 ok, makes sense! You could also use "check type (last closed)" == buy/sell.
Mql4 makes no difference between demo and real. Your trades dont close because you have set a group number in the entry logic but no group number in closing blocks. Remove the group # or set the same number everywhere:
0_1599042722261_6f1c378e-e83f-4df2-a1a2-e45cb4a2f484-image.png