Jump to content
KyleK29

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

Recommended Posts

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 2

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

Thanks @Justin I appreciate the clarity. While I have your attention, can I get some more clarity on the function of these hotkeys, but in some layman's terms? 

Lets say a stock is 20 dollars currently, and I am eyeing a good stop .20 cents away at a moving average, with a planned target of 20.60.

So, if my max risk on any trade is $45, and I am using the "dollar risk" hotkey (as shown), then am I correct in stating that I will be double clicking on the price I want to set my stop (19.80), and then the hotkey function is going to be calculating how many shares I can afford at the current price (20) based on my risk per share (.20 cents), with a total max risk in the trade of $45 worth? 

So it seems in this example, I would be purchasing 225 shares at $20. Is that how this all works? I watched some of Kyle's example videos, and that seems to be what is happening, I'd just really appreciate some clarity on the function of it all. Thanks in advance for the help, it is VERY appreciated. 

  • Like 1

Share this post


Link to post
Share on other sites
3 minutes ago, Andrew from Jersey said:

Thanks @Justin I appreciate the clarity. While I have your attention, can I get some more clarity on the function of these hotkeys, but in some layman's terms? 

Lets say a stock is 20 dollars currently, and I am eyeing a good stop .20 cents away at a moving average, with a planned target of 20.60.

So, if my max risk on any trade is $45, and I am using the "dollar risk" hotkey (as shown), then am I correct in stating that I will be double clicking on the price I want to set my stop (19.80), and then the hotkey function is going to be calculating how many shares I can afford at the current price (20) based on my risk per share (.20 cents), with a total max risk in the trade of $45 worth? 

So it seems in this example, I would be purchasing 225 shares at $20. Is that how this all works? I watched some of Kyle's example videos, and that seems to be what is happening, I'd just really appreciate some clarity on the function of it all. Thanks in advance for the help, it is VERY appreciated. 

You require zero clarity! 😛 

Your scenario is exactly how it works! You even understand the math on how it calculates the shares! 🥳

Share this post


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

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

Amazing! Thanks.

  • Like 1

Share this post


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

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

Having a crack at the reciprocal hotkey to cover 25%. Is it:

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

Share this post


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

Having a crack at the reciprocal hotkey to cover 25%. Is it:

You got it!

Share this post


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

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

Hi Justin

I've been having the same problem (not being able to scale out while long on an SSR. With the first hotkey script that you listed, is that strictly for scaling out while long on an SSR? can that be used for scaling out long on a non SSR stock? I'm really trying to use the least amount of hotkeys as possible as I am still in SIM and practicing. Here is what I have been using.

LONG $250 risk
StopPrice=Price-0.01;DefShare=BP*0.97;Price=Ask-Price+0.01;SShare=250/Price;Share=DefShare-SShare;DefShare=DefShare+SShare;SShare=Share;Sshare=DefShare-SShare;Share=0.5*SShare;TogSShare;ROUTE=LIMIT;Price= Ask+0.05;TIF=DAY+;BUY=Send;DefShare=400;TriggerOrder=RT:STOP STOPTYPE:MARKET PX:StopPrice-0.3 ACT:SELL STOPPRICE:StopPrice QTY:Pos TIF:DAY+;                                                                                        

LONG scale out 10%
Route=LIMIT;Share=Pos*0.10;Price=Bid-0.05;TIF=DAY+;SELL=Send            

LONG scale out 25%
Route=LIMIT;Share=Pos*0.25;Price=Bid-0.05;TIF=DAY+;SELL=Send            

LONG scale out 100%
;CXL ALLSYMB;Route=LIMIT;Share=Pos*1;Price=Bid-0.05;TIF=DAY+;SELL=Send                

 

SHORT $250 risk
StopPrice=Price+0.01;DefShare=BP*0.97;Price=Price-Bid+0.01;SShare=250/Price;Share=DefShare-SShare;DefShare=DefShare+SShare;SShare=Share;Sshare=DefShare-SShare;Share=0.5*SShare;TogSShare;ROUTE=LIMIT;Price=Bid-0.05;TIF=DAY+;SELL=Send;DefShare=400;TriggerOrder=RT:STOP STOPTYPE:MARKET PX:StopPrice+0.3 ACT:BUY STOPPRICE:StopPrice QTY:Pos TIF:DAY+;                                                                                        

SHORT scale out 10%
Route=LIMIT;Share=Pos*0.10;Price=Ask+0.05;TIF=DAY+;BUY=Send            

SHORT scale out 25%
Route=LIMIT;Share=Pos*0.25;Price=Ask+0.05;TIF=DAY+;BUY=Send            

SHORT scale out 100%
;CXL ALLSYMB;Route=LIMIT;Share=Pos*1;Price=Ask+0.05;TIF=DAY+;BUY=Send                

 

LONG/SHORT move stop to break even
;CXL ALLSYMB;Route=Stop;Price=AvgCost;StopType=MARKET;STOPPRICE=AvgCost;StopPrice=Round2;Share=Pos;TIF=DAY+;Send=Reverse;                                

 

I just added SHORT SSR (haven't used it yet)
StopPrice=Price+0.01;DefShare=BP*0.97;Price=Price-Bid+0.01;SShare=250/Price;Share=DefShare-SShare;DefShare=DefShare+SShare;SShare=Share;Sshare=DefShare-SShare;Share=0.5*SShare;TogSShare;ROUTE=LIMIT;Price=Bid+.01;TIF=DAY+;SELL=Send;DefShare=400;TriggerOrder=RT:STOP STOPTYPE:MARKET PX:StopPrice+0.3 ACT:BUY STOPPRICE:StopPrice QTY:Pos TIF:DAY+;          

 

1. What do I need to do to be able to scale out long on SSR? Do i need to add a whole new set of scale out Long SSR keys or replace the ones that I have?

2. Scaling out while short SSR? are they the same as Scaling out Short?

3. Will my "move stop to break even" be universal (LONG, SHORT, SSR SHORT, SSR LONG)? 

3. Does this all make sense? I really appreciate all of your help. Any other tips or suggestions to help me streamline the process or narrow down my hotkeys is greatly appreciated.   Let me know if you need any clarification or information.                                                                    

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.