Lee W 82 Posted February 5, 2018 Someone asked in the chat last week how to create a hotkey that would buy a position based on a certain percentage of your available Buying Power (BP). At first, I created this with the script wizard in DAS, but it wasn't calculating correctly. I sought help from the chat and it has been figured out. Thanks to Robert H for figuring it out. I'm still not sure why the script wizard doesn't do it correctly, but whatever. Let's say you want a hotkey that buys a position based on 30% of your available Buying Power. So if your current available BP is $100,000, 30% is $30,000. I created CTRL+3 for that. Here is the script: ROUTE=SMRTL;Price=Ask+0.05;Price=Round2;Share=BP*0.3;TIF=DAY+;BUY=Send If you wanted one that buys based on 10% of your BP, then: ROUTE=SMRTL;Price=Ask+0.05;Price=Round2;Share=BP*0.1;TIF=DAY+;BUY=Send Please note that these two scripts also contain the rule to limit the price to no more than 5 cents above the ASK. You can adjust as necessary. I've marked in bold the part of the script that controls the # of shares based on a percentage of the Buying Power. Share this post Link to post Share on other sites
Jason H. 53 Posted February 5, 2018 This is cool! Thanks for sharing! Would this calculate correctly with a short as well? Share this post Link to post Share on other sites
Lee W 82 Posted February 5, 2018 I don’t see why it wouldn’t. If you want to test it without sending the order, change the end to LOAD instead of SEND. It will create the order in the montage but won’t execute it. Share this post Link to post Share on other sites
John Arndt 1 Posted February 19, 2018 Great idea. I'm going to try it this week in Sim. Share this post Link to post Share on other sites
John Arndt 1 Posted February 22, 2018 Tried it this week in Sim. I think there are two problems: 1) The share size becomes an odd lot and therefore adding commission cost. 2) I over invested in single trades instead of adding in. It was silly the amount of fake money I lost. Sorry, but I'll be sticking to my mental BP limits. - Watch position size based on liquidity, price action, and risk. Share this post Link to post Share on other sites
wpicotte 16 Posted April 8, 2018 What function for the following snippet within the hotkey commands above perform: Price=Round2 Share this post Link to post Share on other sites
Robert H 452 Posted April 8, 2018 From DAS Command Tip This is to round the order price to specified number of decimals to avoid too many decimals which could lead to order being rejected. Currently Round1, Round2, Round3 and Round4 are supported, which correspond to 1 ,2 ,3 and 4 decimals. For example, if original price is 25.238, after executing hotkey "Price=Round2", new price will be 25.24. Share this post Link to post Share on other sites
michael3301 3 Posted April 30, 2018 If you prefer to buy based on the dollar value instead of the percentage of buying power you can use the following script: Example of buying 30k dollar worth of stock: ROUTE=SMRTL;Price=Ask+0.05;Price=Round2;Share=30000/PRICE;TIF=DAY+;BUY=Send Thanks Robert for helping me figuring this out. Share this post Link to post Share on other sites
jmeasow 1 Posted July 22, 2019 I think the problem in going with BP is that the leverage is different for different stocks - atleast for IB. BP includes the leverage. With this hotkey setting, sometimes the order can get rejected due to insufficient capital. There is no leverage for stocks below $2 on IB. So it's all on cash. Just an example. Share this post Link to post Share on other sites
Paul Bhangle 0 Posted July 22, 2022 On 7/22/2019 at 7:19 AM, jmeasow said: I think the problem in going with BP is that the leverage is different for different stocks - atleast for IB. BP includes the leverage. With this hotkey setting, sometimes the order can get rejected due to insufficient capital. There is no leverage for stocks below $2 on IB. So it's all on cash. Just an example. Did anyone every figure out how to set this up for IB so you don't get reject for insufficient funds do to leverage? Share this post Link to post Share on other sites
Avinash Mahtani 0 Posted September 15, 2022 On 4/30/2018 at 2:14 PM, michael3301 said: If you prefer to buy based on the dollar value instead of the percentage of buying power you can use the following script: Example of buying 30k dollar worth of stock: ROUTE=SMRTL;Price=Ask+0.05;Price=Round2;Share=30000/PRICE;TIF=DAY+;BUY=Send Thanks Robert for helping me figuring this out. Do you have the script for going short? Thanks! Share this post Link to post Share on other sites
Adam Bauer 0 Posted September 27, 2022 I to would like the short version of this hot key if it can be done. Share this post Link to post Share on other sites
tms 0 Posted July 26 You change "Ask+" to "Bid-" and "BUY" to "SELL" for the short version Share this post Link to post Share on other sites