May-27-2017, 07:00 PM
So I am trying to code a python script to assist me with my stock trading. here's my code so far.
When I run the program, I enter 1, the program exits with no errors. I'm trying to make it so whenever I enter 1, the function buy() executes. Thanks.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
def buy(): datr = float ( input ( "Daily ATR: " )) dzd = float ( input ( "Demand Zone Distal: " )) dzp = float ( input ( "Demand Zone Proximal: " )) szp = float ( input ( "Supply Zone Proximal: " )) szd = float ( input ( "Supply Zone Distal: " )) wr = (datr * 0.02 ) sl = (dzd - wr) rsk = (dzp - sl) rwd = (rsk * 3 ) t1 = (dzp + rwd) t2 = szp print ( "Target 1:" , t1) print ( "Target 2:" , t2) def intromenu(): choice = input ( "1. Buy\n2. Sell\n\nEnter: " ) if choice = = 1 : buy() else : exit() intromenu() |