It looks like you're new here. If you want to get involved, click one of these buttons!
co_lower = co_lower/100
co_upper = co_upper/100
trigger = price - (co_upper * price)
if sl < trigger:
sl = trigger
else:
trigger = sl
x = 0
if transaction_type == 'Buy':
x = (price - trigger) * quantity
else:
x = (trigger - price) * quantity
y = co_lower * price * quantity
margin = x if x > y else y
margin = margin + (margin * 0.2)