Fix logical issues

#1 fixed logical issues in trading situations #2 preparing for log file
creation function