-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlibrary.py
More file actions
executable file
·35 lines (26 loc) · 727 Bytes
/
library.py
File metadata and controls
executable file
·35 lines (26 loc) · 727 Bytes
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
34
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Validate user input
# oldChar='lOSZ'
# newChar='1052'
def IsNumbersOnly(ustring):
numbers='0123456789.'
if ustring=='':
return False
for usChar in ustring:
if usChar not in numbers:
return False
return True
# 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
def GetUserNumber(question):
done=False
answer=''
while not done:
answer=input(question)
if IsNumbersOnly(answer):
done=True
else:
print("Enter a number.")
return float(answer)