Jump to content
KyleK29

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

Recommended Posts

First off this is pretty awesome that you put in all this time and effort on this.  Thank you very very much.  Awesome.  I have a quick question.  If I want to use the dollar risk to go long at the Bid +.05 instead of the ask, do I change both  "Ask" in the equation or just where it says Price=Ask+0.05?

Here's the original formula:

DefShare=BP*0.97;Price=Ask-Price+0.01;SShare=150/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=100;

To have it go long at the bid instead should it be like this instead?

DefShare=BP*0.97;Price=Bid-Price+0.01;SShare=150/Price;Share=DefShare-SShare;DefShare=DefShare+SShare;SShare=Share;Sshare=DefShare-SShare;Share=0.5*SShare;TogSShare;ROUTE=SMRTL;Price= Bid+0.05;TIF=DAY+;BUY=Send;DefShare=100;

Or should I just change the ask to bid where it says Price=Ask+0.05 like this:

DefShare=BP*0.97;Price=Ask-Price+0.01;SShare=150/Price;Share=DefShare-SShare;DefShare=DefShare+SShare;SShare=Share;Sshare=DefShare-SShare;Share=0.5*SShare;TogSShare;ROUTE=SMRTL;Price= Bid+0.05;TIF=DAY+;BUY=Send;DefShare=100;

 

Thank you for your help.  Again, awesome stuff.  

Share this post


Link to post
Share on other sites

Been playing around with this today.  This is great.  Thank you again.  I have a follow up question I guess just to make sure I'm not doing anything wrong.  I was testing out the Stop - set to break even hotkeys and noticed some things that look weird, but don't seem to be an actual problem.  First off, it seems like they worked so I guess that's all that matters haha.  But I noticed two weird things.  On the chart the hollow arrow that shows up for the stop order would be pretty far away from my actual break even point.  Also, in the trade log the stop would get shown as sent at breakeven, but then what looks like a second order would also get sent when it gets executed that would be around 20-30 cents lower (if long), but the stop would actually execute at break even.  Like I said, it seems to work right, but those things just looked odd to me so I thought I'd point them out to make sure I'm not missing anything.  I'll attach pictures of some examples (FYI those are different trades).  And just for reference I'm using DAS version 5.2.0.36 with IB and using the $ calculated risk.  These trades were all in sim.  I appreciate the help. 

Screen Shot 1-15-2019 at 7.48 AM.png

Screen Shot 1-15-2019 at 8.49 AM.png

Edited by True

Share this post


Link to post
Share on other sites

@KyleK29

Hi Kyle - I do not understand the idea of the  BP in the equation if I specify my risk loss before entering the trade. Like if my risk loss is $50 fixed dollar with 100% BP, would the position size be different if I selected 50% BP? If I selected 50%BP would my risk still be at $50?

Share this post


Link to post
Share on other sites

@KyleK29  I wish I had seen this post a while back. I just came across it last night.  I have been working on a set of hotkeys for risk management for several weeks now. I just started a new post about it. I think your post would have helped me develop mys scripts sooner. My scripts are a bit different than yours, there are some similarities.  If you have time, check it out and provide feedback. Thanks.

 

Edited by rom30

Share this post


Link to post
Share on other sites

I think both of your hotkey work is really great. I will be incorporating this myself soon. So far been clicking in the simulator, but i want to start getting used to using hotkeys.

Share this post


Link to post
Share on other sites

Set up these hotkey scripts on my Stream Deck - love!

Have tried them in Sim and everything seems to work as expected.

One issue I encountered is with the 'Update Stop Order' hotkey. I have this configured and, following the instructions, double-click the stop market order in the orders window and then hit the hotkey. Nothing happens, however -- and I'm not exactly sure what should.

Can you advise?

Thanks -- and thanks for putting these scripts together. Awesomeness.

Share this post


Link to post
Share on other sites

@KyleK29

Awesome stuff.  I've gone through and set some of this up and I'm going to give it a go tomorrow.  I've tested on SIM and will wade in live cautiously tomorrow.

For reference for anyone using IB here are the BETA versions that might be of interest.

http://www.dastrader.com/download/fixes/DASInstallIBCO.5.2.0.34.exe

5.2.0.34 is the stable version that Kyle mentions you need in order to automatically send stops when you place an order.

http://www.dastrader.com/download/fixes/DASInstallIBCO.5.2.0.37.exe

5.2.0.37 is the most recent version.  I'm currently using this one and if I encounter any issues with it I'll report back here.

Share this post


Link to post
Share on other sites

I'm assuming I can change the ROUTE from "market" to "SMRTM" with no issues? The spreadsheet has SMRTL but not SMRTM. I am with Interactive Brokers. 

Share this post


Link to post
Share on other sites

@KyleK29 we just got this via email:

 

Quote

 

I'm not a member of your group, but just wanted to reply to the KyleK29 to say thanks heaps for this post, it gave me an idea to write a python script to test and generate DAS scripts.

 Just wanted to share my idea based on this in case anyone else finds it useful:

https://github.com/jseparovic/DASTraderScripts

 Cheers,

 Jason

 

Share this post


Link to post
Share on other sites
On 1/14/2019 at 8:57 PM, True said:

First off this is pretty awesome that you put in all this time and effort on this.  Thank you very very much.  Awesome.  I have a quick question.  If I want to use the dollar risk to go long at the Bid +.05 instead of the ask, do I change both  "Ask" in the equation or just where it says Price=Ask+0.05?

Here's the original formula:

DefShare=BP*0.97;Price=Ask-Price+0.01;SShare=150/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=100;

To have it go long at the bid instead should it be like this instead?

DefShare=BP*0.97;Price=Bid-Price+0.01;SShare=150/Price;Share=DefShare-SShare;DefShare=DefShare+SShare;SShare=Share;Sshare=DefShare-SShare;Share=0.5*SShare;TogSShare;ROUTE=SMRTL;Price= Bid+0.05;TIF=DAY+;BUY=Send;DefShare=100;

Or should I just change the ask to bid where it says Price=Ask+0.05 like this:

DefShare=BP*0.97;Price=Ask-Price+0.01;SShare=150/Price;Share=DefShare-SShare;DefShare=DefShare+SShare;SShare=Share;Sshare=DefShare-SShare;Share=0.5*SShare;TogSShare;ROUTE=SMRTL;Price= Bid+0.05;TIF=DAY+;BUY=Send;DefShare=100;

 

Thank you for your help.  Again, awesome stuff.  

Would this be for stocks with SSR? If you still need it, I can add the option to do it. It's kinda cumbersome trying to figure by editing the hotkey itself.

This is my $80Risk SSR: 
StopPrice=Price+0.01;DefShare=BP*0.97; Price = Price-Bid+0.01;SShare = 80/Price;Share = DefShare - SShare; DefShare = DefShare + SShare; SShare = Share; SShare = DefShare - SShare; Share = 0.5 * SShare; TogSShare; ROUTE =LIMIT; Price = Bid + 0.01; TIF=DAY+; SELL=Send; DefShare = 400; TriggerOrder=RT:STOP STOPTYPE:MARKET PX:StopPrice STOPPRICE:StopPrice QTY:Pos TIF:DAY+ ACT:BUY;

And my normal $80Risk: 
StopPrice=Price+0.01;DefShare=BP*0.97;Price=Price-Bid+0.01;SShare=80/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 ACT:BUY STOPPRICE:StopPrice QTY:Pos TIF:DAY+;

In this example, the part you'd edit is the one right after the "ROUTE=LIMIT".

On 1/15/2019 at 9:46 AM, True said:

Been playing around with this today.  This is great.  Thank you again.  I have a follow up question I guess just to make sure I'm not doing anything wrong.  I was testing out the Stop - set to break even hotkeys and noticed some things that look weird, but don't seem to be an actual problem.  First off, it seems like they worked so I guess that's all that matters haha.  But I noticed two weird things.  On the chart the hollow arrow that shows up for the stop order would be pretty far away from my actual break even point.  Also, in the trade log the stop would get shown as sent at breakeven, but then what looks like a second order would also get sent when it gets executed that would be around 20-30 cents lower (if long), but the stop would actually execute at break even.  Like I said, it seems to work right, but those things just looked odd to me so I thought I'd point them out to make sure I'm not missing anything.  I'll attach pictures of some examples (FYI those are different trades).  And just for reference I'm using DAS version 5.2.0.36 with IB and using the $ calculated risk.  These trades were all in sim.  I appreciate the help. 

Screen Shot 1-15-2019 at 7.48 AM.png

Screen Shot 1-15-2019 at 8.49 AM.png

The price marker is wonky in DAS. For stops, it uses the "PRICE" value. If you do a STOP-MARKET order, the flag is placed at "0.00" (so it doesn't show). If you do a STOP-LIMIT order, the flag is placed at the PRICE value (so if your Limit is Price+0.30, it'd be placed at Price+0.30). If you're currently using any breakeven with a STOP-LIMIT, I'd recommend swapping them out with the new ones in 1.5 that will be releasing in the next few days.

Edited by KyleK29

---------------------------------------------------------
Profile / Project Pages (Dynamic Hotkeys, StreamDeck Files, and other contributions are located here)

Share this post


Link to post
Share on other sites
On 1/15/2019 at 10:25 AM, ragy said:

@KyleK29

Hi Kyle - I do not understand the idea of the  BP in the equation if I specify my risk loss before entering the trade. Like if my risk loss is $50 fixed dollar with 100% BP, would the position size be different if I selected 50% BP? If I selected 50%BP would my risk still be at $50?

If you're using the DOLLAR RISK version, the initial BP calculation is calculating the Maximum Affordable Shares -- the shares your buying power can afford to buy. In this scenario, if you selected 50% BP, your risk would still be at $50, but the Maximum Affordable Shares calculation would now be cut in half. This only comes into play if you're doing position sizes that bump up against your actual leveraged buying power.

On 1/17/2019 at 12:49 PM, wpicotte said:

Set up these hotkey scripts on my Stream Deck - love!

Have tried them in Sim and everything seems to work as expected.

One issue I encountered is with the 'Update Stop Order' hotkey. I have this configured and, following the instructions, double-click the stop market order in the orders window and then hit the hotkey. Nothing happens, however -- and I'm not exactly sure what should.

Can you advise?

Thanks -- and thanks for putting these scripts together. Awesomeness.

I'll be including it when I release the video along with a bunch of other things.

On 2/19/2019 at 11:58 AM, nmarnson said:

I'm assuming I can change the ROUTE from "market" to "SMRTM" with no issues? The spreadsheet has SMRTL but not SMRTM. I am with Interactive Brokers. 

Yes, you can type whatever you want. The new version will have the SMRTM in it.

On 5/18/2019 at 3:56 PM, Jramosent said:

Any videos on how to get this going? Seems like around January everything paused? 

Yes, I'll be releasing them by the end of this month. Been a hectic year so far as I had many projects come due at the same time. I've got a lot of stuff brewing that I can't wait to share. V1.5 will be out this week with the following changes:

- Bug Fixes
- Price Target Hotkey
- Range Order Hotkey
- Zoom Y Axis Hotkeys

I just have to nuke my Excel as it keeps locking up with the latest version of Windows.

 

Along with the video and the new version (I want to launch both together)

Edited by KyleK29
  • Like 4
  • Thanks 1

---------------------------------------------------------
Profile / Project Pages (Dynamic Hotkeys, StreamDeck Files, and other contributions are located here)

Share this post


Link to post
Share on other sites

Great stuff! Thanks so much for this. Am excited to use it with my new gaming keypad that just arrived! Will the new version and video be out this week? If not I'll run with the existing one first.

Share this post


Link to post
Share on other sites

Awesome!  I had to give up on first version because I couldn't figure it out.  I am psyched to try again with video instruction.

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.