PilotFish 23 Posted December 13, 2019 (edited) Maybe you will tell me this is all easily done with buttons..but I haven't looked into the button calculations yet. It takes a share price and based on your account size will show you the max shares you can afford as well as display the money you'd lose/gain for each .05 interval up to 50 cents. account_size = 30000 from decimal import Decimal print("Welcome Tom, your account size is set to " + str(account_size)) share_price = input("\r\nPlease enter share price... ") shares = account_size//Decimal(share_price) print("**************************************") print("\r\nYou can afford " + str(shares) + " shares.") print("**************************************\r") stoploss = Decimal('0.05') while(stoploss <= .5): risk = 0 risk = int(shares)*stoploss print("stop loss of " + str(stoploss) + " risks " + str(risk)) stoploss+= Decimal('0.05') Edited December 14, 2019 by PilotFish 2 Share this post Link to post Share on other sites
Christopher 129 Posted December 20, 2019 (edited) Dude! I just wrote a similar program in C++ and came here to post it and saw this lol. I think it's a really rare occurrence that'd you'd want to buy as many shares as your account will allow. I remember seeing a hotkey where you buy a % of your accounts value. Like you buy as many shares as possible with %25 of your account size. I can see those hotkeys being useful. For my program you input the max you're willing to lose on the trade, and then it tells you how many shares you can buy based off of your stop loss (which also goes in .05 increments) Here's mine Edited December 20, 2019 by Christopher Patterson 2 Share this post Link to post Share on other sites
PilotFish 23 Posted December 20, 2019 36 minutes ago, Christopher Patterson said: Dude! I just wrote a similar program in C++ and came here to post it and saw this lol. I think it's a really rare occurrence that'd you'd want to buy as many shares as your account will allow. I remember seeing a hotkey where you buy a % of your accounts value. Like you buy as many shares as possible with %25 of your account size. I can see those hotkeys being useful. For my program you input the max you're willing to lose on the trade, and then it tells you how many shares you can buy based off of your stop loss (which also goes in .05 increments) Here's mine Nice man! Great minds something something. I am under the impression it would be perfectly fine to trade an entire account with strict stop loss/risk management control? Also, have a gander here if you haven't already, Kyle has set up DAS to do all of this for us automagically. (Although we won't get cool readouts like our programs do) 1 Share this post Link to post Share on other sites