-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
lesson2
executable file
·33 lines (22 loc) · 907 Bytes
/
lesson2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Ask for the closing price and give the stop loss and take profit prices.
# stop loss and take profit in the form reward/risk.
# R:R 2:1 means 2 times the reward for your risk
# Ask for the closing price
closingPrice=float(input("What is the closing price? "))
# Get the risk percentage
risk=float(input("What is the risk percentage (number only)? "))/100
reward=2*risk
stopLoss=closingPrice-(closingPrice*risk)
takeProfit=closingPrice+(closingPrice*reward)
print("Closing Price:",closingPrice)
print("Take Profit:",takeProfit)
print("Stop Loss:",stopLoss)
# Ask user how much they want to buy.
# display how much they will profit or loose.
buyAmount=float(input("How much do you want to buy? "))
win=buyAmount*reward
loss=buyAmount*risk
print("Profit:",win,"Winning Position:",buyAmount+win)
print("Loss:",loss,"Loosing Position:",buyAmount-loss)