Jump to content
odayum

DAS hotkey that buys a fixed share then adjusts stop to a fixed amount based on share size

Recommended Posts

Hey all, 

I'm trying to figure out how to script a hotkey in DAS for adding to or creating a new position that will buy or short a set number of shares and then set a stop loss for fixed amount calculated based on the overall position and average cost per share. 

For example I want to buy 100 shares and I want to set my stop to fixed amount say $100 dollars.  The math for this seems pretty basic just (average cost- (risk amount/position)) but I can't seem to make that work in a hotkey script. 

I would also want the script to update the stop if I add to the position so for example for a $10 stock: the first time I hit the button it buys 100 shares at current ask then sets a stop to sell 100 shares at $9, then I hit it again (assuming the ask is still $10) it buys another 100 shares (now I have 200 shares) and sets the new stop loss (cancelling the old) to sell 200 shares at $9.50. and then will do that each time I mash the button so were I to hit it 10 times for a 1000 shares my new stop loss would be to sell 1000 shares at $9.90.  

Any help would be greatly appreciated!! 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.