Jump to content
KyleK29

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

Recommended Posts

I bet I could just tweak Williams R:R hotkey in this video couldn’t I?

8BB2B551-C50F-4ED9-BE44-F3BBBA56B6F5.thumb.jpeg.5b0f7ca62339dc6257f58359057c9c2f.jpeg

 


If you don’t have a mountain to climb, find one.

Share this post


Link to post
Share on other sites

Hello All,

Hope all of you are well.

I've got a hopefully easy fix question for those who might have it already. I would like to have a close and flip position hotkey please.

Scenario:

Step 1: Lets say I am short and want to cover my position and therefore I use the following hotkey from Kyle:

CXL ALLSYMB;Route=SMRTM;Share=Pos;Price=Ask+0.05;TIF=DAY+;BUY=Send;

Step 2: Now I would like to enter a long position with fixed risk, therefore I double click my stop loss price on the chart and use the following Kyle's hotkey:

StopPrice=Price-0.01;DefShare=BP*0.97;Price=Ask-Price+0.01;SShare=75/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=0;TriggerOrder=RT:STOP STOPTYPE:MARKET PX:StopPrice-0.05 ACT:SELL STOPPRICE:StopPrice QTY:Pos TIF:DAY+;

Question: Is it possible to have the above 2 steps in one single hotkey please?

Basically, I just need to get the amount of shares held in the current short, and add that number to the result of the long entry hotkey (step 2), before it is actually executed. That way the short is covered and a fixed risk long is opened.

Appreciate all the help.

Thanks in advance and good day,

Kim

Share this post


Link to post
Share on other sites
On 9/8/2020 at 12:32 PM, Thomas said:

Hey @KyleK29, I've been using the hotkeys now for a while and having difficulty with my stop loss being near the risk $ I took. I am risking $250/trade as per the config option, but when I get stopped out it has been $350-380 range. I changed it to a LIMIT instead of market with .05 buffer on the same stock and then I get $260-280. Which is better, but problem with limit stop is I got skipped once and it freaked me out so went back to market order stops.

It calculated too many shares: entry was 21.95 short, stop loss set to 22.11, shares purchased were 2083 and stop loss was triggered at 22.12 ---- the risk was actually $333 versus $250 and my total loss stop amount was $354 based on the share size

Have you experienced this lately as well, or others?  I am getting too many shares for the risk $ Just wondering if other experience this or if this is a bug

here is my SHORT $250 RISK script for reference:

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

bump --- anyone else getting bad slippage when the stop loss triggers? I risk $250 and it's closer to $350.

Share this post


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

bump --- anyone else getting bad slippage when the stop loss triggers? I risk $250 and it's closer to $350.

If you clicked at 21.99 it would calculate at that price, if it was moving fast, or your internet is slow, .04 slippage at entry would give you $83 difference. It doesn’t have to be .04 slippage just at entry, it could be .02 slippage at entry and exit.

 

If you are using DaS you can look at “trade log”, it shows what your order was and where it was filled. You should be able to tell what slippage was from there.

 

hope this helps.

 

Edited by hailchaser2

If you don’t have a mountain to climb, find one.

Share this post


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

Hello All,

Hope all of you are well.

I've got a hopefully easy fix question for those who might have it already. I would like to have a close and flip position hotkey please.

Scenario:

Step 1: Lets say I am short and want to cover my position and therefore I use the following hotkey from Kyle:

CXL ALLSYMB;Route=SMRTM;Share=Pos;Price=Ask+0.05;TIF=DAY+;BUY=Send;

Step 2: Now I would like to enter a long position with fixed risk, therefore I double click my stop loss price on the chart and use the following Kyle's hotkey:

StopPrice=Price-0.01;DefShare=BP*0.97;Price=Ask-Price+0.01;SShare=75/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=0;TriggerOrder=RT:STOP STOPTYPE:MARKET PX:StopPrice-0.05 ACT:SELL STOPPRICE:StopPrice QTY:Pos TIF:DAY+;

Question: Is it possible to have the above 2 steps in one single hotkey please?

Basically, I just need to get the amount of shares held in the current short, and add that number to the result of the long entry hotkey (step 2), before it is actually executed. That way the short is covered and a fixed risk long is opened.

Appreciate all the help.

Thanks in advance and good day,

Kim

Hi Kim,

if you're looking to flip your short position to a long position (i wouldn't recommend it) but here is the code for it: 

Flip SHORT to LONG position

CXL ALLSYMB;ROUTE=SMRTL;Share=Pos*2;Price=Ask+.05;TIF=DAY+;BUY=Send

 

Flip LONG to SHORT position

CXL ALLSYMB;ROUTE=SMRTL;Share=Pos*2;Price=Bid-.05;TIF=DAY+;SELL=Send

 

I hope this helps.

Peter

 

Share this post


Link to post
Share on other sites
5 hours ago, pjjsfv said:

Hi Kim,

if you're looking to flip your short position to a long position (i wouldn't recommend it) but here is the code for it: 

Flip SHORT to LONG position

CXL ALLSYMB;ROUTE=SMRTL;Share=Pos*2;Price=Ask+.05;TIF=DAY+;BUY=Send

 

Flip LONG to SHORT position

CXL ALLSYMB;ROUTE=SMRTL;Share=Pos*2;Price=Bid-.05;TIF=DAY+;SELL=Send

 

I hope this helps.

Peter

 

Hello Peter,

Thanks for your reply but no I do not want to just flip the position with same amount of shares, as the stop (according to my fixed risk) would not be a technically good one.

Let say I am left with 100 shares from a previous short trade, and now my strategy is giving me a signal to go long.

The hotkey to go long, with particular fixed risk,(which I have and works great) calculates that it needs to buy 250 shares.

Now, I need one hotkey (which would be 2 of Kyle's hotkeys but merged) which takes the 250 shares long and adds another 100 shares so that it covers the current open short trade too.

This way, apart from opening the long position, based on my strategy, the short position is also closed automatically.

Thanks a lot in advance, all the help is greatly appreciated.

Thanks

Kim

Edited by kimfarr83

Share this post


Link to post
Share on other sites

Hello All,

Just an update, managed to make the hotkey work as I needed but only for entering a new short position.

1. To Close the current long trade, workout the the new amount of shares/fixed risk to go short, and execute, I am using the following. Basically I just added the bold part to Kyle's hotkey:

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

2. I have a problem though when covering the short and opening a long trade, as current Pos would be a negative value and it actually subtracts instead of adding to the total. Would be nice to have an ABS(Pos) function, or another way to do it maybe in DAS.

Thanks a lot to everyone. Maybe there is a simple solution.

Kim

Share this post


Link to post
Share on other sites

@KyleK29 Ive asked DAS and they obvs told me to ask you. I only use your Hkey to trade. Is there any way to get the hotkey to just tell me how many shares it would take based on the distance to SL from where I clicked but not actually send the order to market. 

What I'm trying to achieve and why: Sometimes a stock wants to break up through an important level lets say $50. But by the time I hit the Hkey its already at $50.20. So I want to just use the hotkey in these rare instances to show me how many shares it'd execute if I pre-empted the trade at like $49.99 and then just manually type the trade into the montage with a limit order so I don't get skipped. 

Also, the script has the TIF as Day+ but I want to make it just DAY. I need to do that in my order routing template and change all instances of TIF in the script to DAY as well right? And will this work or screw it up? 

Thx

Edited by Sapperstien

Share this post


Link to post
Share on other sites

Ok. hotkey people, will this work for what I described a few posts above this?

 

Long Position , 25% Range order at Break Even and Avg Cost +1

ROUTE=STOP;StopType=Range;LowPrice=AvgCost;HighPrice=AvgCost+2;Share=Pos*0.25;TIF=DAY+;SELL=Send

Long Position, 25% Range Order at BE and Avg Cost +$2

ROUTE=STOP;StopType=Range;LowPrice=AvgCost;HighPrice=AvgCost+2;Share=Pos*0.25;TIF=DAY+;SELL=Send

Short Position 25% Range Order at BE and Avg Cost -$1

ROUTE=STOP;StopType=Range;HighPrice=AvgCost;LowPrice=AvgCost-1.00;Share=Pos*0.25;TIF=DAY+;Buy=Send

Short Position 25% Range Order at BE and Avg Cost -$2

ROUTE=STOP;StopType=Range;HighPrice=AvgCost;LowPrice=AvgCost-2.00;Share=Pos*0.25;TIF=DAY+;Buy=Send

 

I'm not very good at building hotkeys, so any help from anyone would be appreciated.

 


If you don’t have a mountain to climb, find one.

Share this post


Link to post
Share on other sites
On 10/1/2020 at 6:55 PM, hailchaser2 said:

If you clicked at 21.99 it would calculate at that price, if it was moving fast, or your internet is slow, .04 slippage at entry would give you $83 difference. It doesn’t have to be .04 slippage just at entry, it could be .02 slippage at entry and exit.

 

If you are using DaS you can look at “trade log”, it shows what your order was and where it was filled. You should be able to tell what slippage was from there.

 

hope this helps.

 

Hey, thanks a lot for the reply!

The #'s I posted were directly from my trade log --- entry was 21.95 short, stop loss set to 22.11, shares purchased were 2083 and stop loss was triggered at 22.12

---- the risk was actually $333 versus $250 and my total loss stop amount was $354 based on the share size. The script is giving me too many shares for the risk $.

Just seeing if my script is whack or if others are experiencing this as well, and just something we all live with.

  • Like 1

Share this post


Link to post
Share on other sites

This is AMAZING!  @KyleK29 Thank you so much for all the work you (and others) put in to this!  I've been trading/learning to trade for a little over a year now and am finally switching myself over to DAS/IB - and I can't even tell you how amazing I think this all is!  Provides such an edge for trading!  Ok, I'll stop with all the exclamation marks 😉  I've been practicing with these in SIM for the past week and it makes things so much easier.  This was probably the deepest thinking I've done in years trying to catch up with your mind and make this all work - but obviously not anything near the amount of work you put in making all this work and putting the "instructions" together for everyone to use.  Thank you!

Share this post


Link to post
Share on other sites

Hey @KyleK29 and everyone else I was just wondering if it is possible to make a hotkey fixed risk long button where it just loads the hot key into the montage but does not actually send to market. I looked over the Excel spreadsheet and do not see a modifier drop down option but I do however see in the script where near the end it does say: buy=send. Is there a way to get it to not send? Also when you use DAS' hotkey script builder there is an option for 'mode' drop down for "load and send" or just "load" so that might be what I’m after. Thx

Basically in very certain circumstances im trying to get DAS to just show me when I 2x click on the chart where my SL would be how many shares Id be using in the montage in the little green message log but not actually send the order to the market. Thx. 

Edited by Sapperstien

Share this post


Link to post
Share on other sites
On 10/18/2020 at 12:13 AM, peterB said:

yeah exactly as you said its the send vs load

So in stead of this: StopPrice=Price-0.01;DefShare=BP*0.97;Price=Ask-Price+0.03;SShare=10/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=100;TriggerOrder=RT:STOP STOPTYPE:MARKET PX:StopPrice-0.3 ACT:SELL STOPPRICE:StopPrice QTY:Pos TIF:DAY+;                             ^^^^^

I would have this as the only difference?: StopPrice=Price-0.01;DefShare=BP*0.97;Price=Ask-Price+0.03;SShare=10/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=Load;DefShare=100;TriggerOrder=RT:STOP STOPTYPE:MARKET PX:StopPrice-0.3 ACT:SELL STOPPRICE:StopPrice QTY:Pos TIF:DAY+;                               ^^^^

Share this post


Link to post
Share on other sites

I occasionally get an invalid share message when entering trades which causes me to miss my entry.  Can anyone tell me how to fix this?  Hotkey script below:

StopPrice=Price-0;DefShare=BP*0.90;Share=DefShare*0.25* Price * 0.0010;Price=Ask-Price+0.00;Price=Round2;SShare=Share/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+;

Share this post


Link to post
Share on other sites

@KyleK29 Hey Guys, I'm trying to set a hotkey with a set $ risk vs a % risk.  What I have so far is a trigger order hotkey that determines the amount of shares that I can purchase with $250 and that sets a stop loss for a percentage of that amount.  What I'm looking for is a trigger order that calculates how much shares I can get with a set amount of money then set a stop loss for a set amount of money vs a percentage if that makes sense.

ROUTE=NSDQL; Price=Ask;ACCOUNT=TMCME9043; Share=250/PRICE;TIF=DAY+; BUY=Send;TriggerOrder=RT:STOP STOPTYPE:MARKET STOPPRICE:AvgCost2*.90 ACT:SELL QTY:POS TIF:DAY+

Edited by Terrence McIntyre

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.