Your first code is ok, but the second not. adviseLong is not for exporting prices. Also, BALANCE is wrong here and the objective parameter is missing.