Skip to content

Commit

Permalink
Bug fix is plotting profit or loss.
Browse files Browse the repository at this point in the history
Changes to be committed:
	modified:   Extras/OliverTwist/OliverTwistTrades
  • Loading branch information
rapmd73 committed May 2, 2024
1 parent bb06da5 commit 810a7c7
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions Extras/OliverTwist/OliverTwistTrades
Original file line number Diff line number Diff line change
Expand Up @@ -128,16 +128,22 @@ for line in lines:

# Prft/Loss
action=data[6]
dir=data[7].split(',')[0].lower()

bTime=FindStartDateTime(dt,dur)
amount=abs(float(data[8].split(':')[0]))
bPrice=float(data[9])

sTime=dt
sPrice=float(data[11].split('/')[0])
rpl=float(data[11].split('/')[1].strip(','))

if action.lower()=='loss':
rpl*=-1
if dir=='long':
rpl=(sPrice-bPrice)*amount #float(data[11].split('/')[1].strip(','))
else:
rpl=(bPrice-sPrice)*amount #float(data[11].split('/')[1].strip(','))

# if action.lower()=='loss':
# rpl*=-1

if action.lower()=='prft' and rpl>0: # Profit
col="rgba(0,128,0,1)"
Expand Down

0 comments on commit 810a7c7

Please sign in to comment.