Jump to content
Lee W

Hotkey for buying based on a percentage of BP

Recommended Posts

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

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

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

What function for the following snippet within the hotkey commands above perform: Price=Round2

Share this post


Link to post
Share on other sites

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

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

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

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.