Jump to content
KyleK29

DAS - Dynamically Calculate Shares on %Risk or $Risk - Hot Key + Configuration, Updated 9/10/19, v2.1

Recommended Posts

8 minutes ago, forkey said:

I think the original problem derived from DAS assuming BP leverage is 4:1 and IB is 3.3333:1 so I will just discount the BP in the syntax to 75% or something like I denoted in the first post: DefShare=BP*0.75; 

I think by default they make it 4:1 for everyone because US residents get that.  But canadians only get 3.333333.  If you compare your actual BP in TWS and DAS they should be equal and they probably aren't right now.

You can contact DAS and ask them to fix your BP to the actual value so you don't have to mess with the script.  That's what I did.

Share this post


Link to post
Share on other sites
3 hours ago, Yann said:

I think by default they make it 4:1 for everyone because US residents get that.  But canadians only get 3.333333.  If you compare your actual BP in TWS and DAS they should be equal and they probably aren't right now.

You can contact DAS and ask them to fix your BP to the actual value so you don't have to mess with the script.  That's what I did.

Thank you @Yann.  You just saved me from having to hard code a constant 0.75*BP in basically everything ^_^

Share this post


Link to post
Share on other sites

New to the group. In the webinar Kyle mentioned that he is updating the hotkeys into a web browser. Just curious if that has been done or is the link at the beginning of this thread still the most up to date? Thanks

  • Like 1

Share this post


Link to post
Share on other sites
4 minutes ago, Casey Gates said:

New to the group. In the webinar Kyle mentioned that he is updating the hotkeys into a web browser. Just curious if that has been done or is the link at the beginning of this thread still the most up to date? Thanks

Yeah, beginning of the thread is still the most up-to-date. Just use the spreadsheet for now 🙂

  • Like 2

Share this post


Link to post
Share on other sites
Posted (edited)

Is it possible to do hotkey with stoploss and target like range order. ( im clicking to stoploss on the chart and then hotkey and it buys stock and creates

range order for selling)

Im now using 2 different hotkeys one for buying with stoploss order and second to sell +2R target. And i need to watch if one order is filled i need to delete second. It would be amazing that

im only buying once and no need to watch stock...

If this one hotkey is not possible is it possible to do hotkey with range order -1R and +2R targets?

Edited by Peter
  • Like 2

Share this post


Link to post
Share on other sites
On 5/31/2020 at 12:54 AM, Peter said:

Is it possible to do hotkey with stoploss and target like range order. ( im clicking to stoploss on the chart and then hotkey and it buys stock and creates

range order for selling)

Im now using 2 different hotkeys one for buying with stoploss order and second to sell +2R target. And i need to watch if one order is filled i need to delete second. It would be amazing that

im only buying once and no need to watch stock...

If this one hotkey is not possible is it possible to do hotkey with range order -1R and +2R targets?

+1

I am looking for this as well. I have a frequent problem when I use the 2 separate hotkeys outlined above - if I am in a long position and the stock is not shortable, the bracket order errors out because there is already a sell order placed (the stop loss).

Share this post


Link to post
Share on other sites

Today I ran into an issue using these hotkeys. Basically I was trying to buy SHOP at $748 with a spread of 0.66. So an expensive stock with a big spread. When I first try to issue a buy at risk nothing happened. I tried again, and then suddenly I was down a huge amount. Fortunately I was in sim. I suspect the problem is because of the big spread of the stock. 

If you have already encountered the same issue, or know what could be the cause, I would be happy to hear from you. Many thanks!

Share this post


Link to post
Share on other sites

Hi All,

During last nights session I ran into the issue of my Sell order being rejected by DAS for stocks under SSR. I am using Kyle's dynamic hotkeys to fix risk and set a Stop order. Scripts below:

Buy:

StopPrice=Price-0;DefShare=BP*0.925;Price=Ask-Price+0.00;SShare=60/Price;Share=DefShare-SShare;DefShare=DefShare+SShare;SShare=Share;Sshare=DefShare-SShare;Share=0.5*SShare;TogSShare;ROUTE=SMRTL;Price= Ask+0.05;TIF=DAY+;BUY=Send;DefShare=200;TriggerOrder=RT:STOP STOPTYPE:MARKET PX:StopPrice-0.05 ACT:SELL STOPPRICE:StopPrice QTY:Pos TIF:DAY+

Sell: 

ROUTE=LIMIT;Price=Bid-0.03 ;Share=Pos*0.25;TIF=DAY+;SELL=Send

I found that if I cancelled the stop order then the Sell Hotkey would work. Has anyone else experience this issue?

Cheers,

Justin

Share this post


Link to post
Share on other sites

@Seydou Dia Yeah, you've answered your question 🙂 That's a huge spread. With slippage the chances of being in the red instantly are quite high. Highly advise looking at stocks with a much smaller spread (like 0.05)

@Justin T Hey, I'm a bit confused. You mentioned you were trying to short a stock on SSR, but then posted your Buy hotkey. I'm probably just confused, but if you could clarify that would be great!

If you're trying to Short a stock on SSR you need to make sure you are buying 1 penny above the bid.

StopPrice=Price+0.01;DefShare=BP*0.97;Price=Price-Bid+0.01;SShare=20/Price;Share=DefShare-SShare;DefShare=DefShare+SShare;SShare=Share;Sshare=DefShare-SShare;Share=0.5*SShare;TogSShare;ROUTE=SMRTL;Price=Bid+0.01;TIF=DAY+;SELL=Send;DefShare=400;TriggerOrder=RT:STOP STOPTYPE:MARKET PX:StopPrice+0 ACT:BUY STOPPRICE:StopPrice QTY:Pos TIF:DAY+;

 

Share this post


Link to post
Share on other sites
8 hours ago, Justin said:

@Seydou Dia Yeah, you've answered your question 🙂 That's a huge spread. With slippage the chances of being in the red instantly are quite high. Highly advise looking at stocks with a much smaller spread (like 0.05)

@Justin T Hey, I'm a bit confused. You mentioned you were trying to short a stock on SSR, but then posted your Buy hotkey. I'm probably just confused, but if you could clarify that would be great!

If you're trying to Short a stock on SSR you need to make sure you are buying 1 penny above the bid.

StopPrice=Price+0.01;DefShare=BP*0.97;Price=Price-Bid+0.01;SShare=20/Price;Share=DefShare-SShare;DefShare=DefShare+SShare;SShare=Share;Sshare=DefShare-SShare;Share=0.5*SShare;TogSShare;ROUTE=SMRTL;Price=Bid+0.01;TIF=DAY+;SELL=Send;DefShare=400;TriggerOrder=RT:STOP STOPTYPE:MARKET PX:StopPrice+0 ACT:BUY STOPPRICE:StopPrice QTY:Pos TIF:DAY+;

 

Hi Justin,

Apologies should have been more clear. To clarify, after I have taken a long position on an SSR stock with a Stop market order in place, I am unable to sell (order is rejected by DAS) unless I remove the stop order. Not sure if this is an anomaly or if my script is written incorrectly.

Justin

  • Like 1

Share this post


Link to post
Share on other sites
13 hours ago, Justin T said:

Hi Justin,

Apologies should have been more clear. To clarify, after I have taken a long position on an SSR stock with a Stop market order in place, I am unable to sell (order is rejected by DAS) unless I remove the stop order. Not sure if this is an anomaly or if my script is written incorrectly.

Justin

Hey Justin,

Yeah, it's an issue with DAS and having a Stop order open at the same time. You need to cancel the stop order and replace it. Luckily we can do that all in one hotkey:

CXL ALLSYMB;Route=LIMIT;Share=Pos*0.25;Price=Bid-0.03;TIF=DAY+;SELL=Send;ROUTE=STOP;StopType=Market;StopPrice=StopPrice;Share=Pos-share;TIF=DAY+;SELL=SEND

That will cancel the stop order, sell 25% of your shares, and replace the stop order in the same position with the new share count.

If you want to move your stop to breakeven you would use:

CXL ALLSYMB;Route=LIMIT;Share=Pos*0.25;Price=Bid-0.05;TIF=DAY+;SELL=Send;ROUTE=STOP;StopType=Market;StopPrice=AvgCost;Share=Pos-share;TIF=DAY+;SELL=SEND

  • Like 1

Share this post


Link to post
Share on other sites
@KyleK29 This is amazing work you've done. Quick question/issue... When I am trying to edit the "Dollar Risk" hotkey in Google Sheets, and I switch the dollar amount from "$40" to "$45", I am seeing a little red tab on that cell, and when hovered over will show a small bubble pop up with the words "Invalid: Input must fall within specified range". However, despite the red flag, I do see the new dollar risk value being inputted into the hotkey script. Will this "red flag" corrupt the hotkey at all, or can I just ignore that red flag? Thanks for your time and expertise.
 
Thanks,
Andrew 
 
 

Share this post


Link to post
Share on other sites
4 minutes ago, Andrew from Jersey said:
@KyleK29 This is amazing work you've done. Quick question/issue... When I am trying to edit the "Dollar Risk" hotkey in Google Sheets, and I switch the dollar amount from "$40" to "$45", I am seeing a little red tab on that cell, and when hovered over will show a small bubble pop up with the words "Invalid: Input must fall within specified range". However, despite the red flag, I do see the new dollar risk value being inputted into the hotkey script. Will this "red flag" corrupt the hotkey at all, or can I just ignore that red flag? Thanks for your time and expertise.
 
Thanks,
Andrew 
 
 

Can you post the hotkey? I can check to make sure it's complete.

  • Like 1

Share this post


Link to post
Share on other sites

@Justin 

Here is the script:  StopPrice=Price-0.02;DefShare=BP*0.95;Price=Ask-Price+0.02;SShare=45/Price;Share=DefShare-SShare;DefShare=DefShare+SShare;SShare=Share;Sshare=DefShare-SShare;Share=0.5*SShare;TogSShare;ROUTE=LIMIT;Price= Ask+0.04;TIF=DAY+;BUY=Load;DefShare=100;TriggerOrder=RT:STOP STOPTYPE:MARKET PX:StopPrice-0.3 ACT:SELL STOPPRICE:StopPrice QTY:Pos TIF:DAY+;

 

Here is a screenshot of what I was seeing. 

screenshot.png

Share this post


Link to post
Share on other sites

@Andrew from Jersey

Looks good Andrew. It's simply there is validation on that cell to use whatever Kyle chose in the dropdown. $45 isn't one of them, so it's throwing an error.

Obviously test it out in SIM, but it should work as expected!

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.