Jump to content
KyleK29

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

Recommended Posts

On 6/17/2020 at 5:49 AM, samnaha74@gmail.com said:

Thank you so much TommyK667. Yes, I am with IB.  I updated the script with SMRTM but that also did not worrk.

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

 

For the STOP routing / StopType, use LIMIT or MARKET (preferably market, it's safer). The reason is that these are routed differently, even with IBCO. If you manually set it up in montage you'll notice the STOP Route type doesn't have SMRTM or SMRTL. So when a hotkey tries to populate that, it can't find a match and fails.

Try this one for IB:

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

 

 

On 6/19/2020 at 7:01 PM, forkey said:

I am currently clicking the chart for each additional entry and sometimes I want to manage the adds completely independently from the first entry.  In a perfect world, each entry will have its own stop loss (and ideally its own target too with a 6:1 range - my second question) and can be therefore independently managed. 

Correct.

Here is the current long entry with a 0.35% risk (i hit this up to 5 times maximum depending on the setup and how tight I can get). 

;CXL ALLSYMB;StopPrice=Price-0;DefShare=BP*1;Share=DefShare*0.3*Price*0.0035;Price=Ask-Price+0;SShare=Share/Price;Share=DefShare-SShare;DefShare=DefShare+SShare;SShare=Share;Sshare=DefShare-SShare;Share=0.5*SShare;TogSShare;ROUTE=ARCAL;Price=Bid;TIF=DAY+; Account=ABC123;BUY=Send;DefShare=100;TriggerOrder=RT:STOP STOPTYPE:MARKET PX:StopPrice-0 ACT:SELL STOPPRICE:StopPrice QTY:Pos TIF:DAY+;

___________________________________

So the above includes the stop but not the target.  Once I get in the trade and it starts working, I will put out a 4:1 range with a stop using this:

;CXL ALLSYMB;ROUTE=STOP;StopType=Range;LowPrice=Price;HighPrice=AvgCost-Price*5+AvgCost;Share=Pos;TIF=DAY+;SELL=Send

_________________________________

Is it possible to simply conjoin the first hotkey's entry+stop and the second hotkey's target as a single hotkey?


Is it possible to tier in with my the first hotkey and then when clicking it again (after clicking chart to indicate the next entry's stop) I am in with tier2 and it has its own stop (and target? - ideally).?

 

Thanks so much @Justin

 

 

If I'm understanding this correctly, you want to have multiple risk positions (e.g. multiple "strategies" in play)?

So for example, you enter a stock at $20.00, with a $19.80 stop price and qty 50. The stock moves in your favor and sets up for another strategy, and you add at $21.00, with another stop at $20.50 and a qty of (example) 50. Your position / open orders looks like:

STOCK, Qty: 100, $20.50(avgcost)
OPEN STOP, $19.80, Qty: 50
OPEN STOP, $20.50, Qty: 50

Something like that?

 

On 6/27/2020 at 1:39 PM, Fernando Samora said:

Hey all, hope someone can help me out. Im trying the hotkets and they work GREAT. 

I do have one issue and would like some help: When im long in a position and scale out I can reclick my Long range order hotkey:

  • (CXL  ALLSYMB; Route=Limit;Share=Pos;Price=AvgCost-StopPrice;Price=Price*3;Price=Price+AvgCost;Price=Round2;Route=Stop;StopType=Range;LowPrice=StopPrice;HighPrice=Price;TIF=DAY+;SELL=Send;ROUTE=LIMIT)

and it re calculates the remaining shares to reset the new share number with the same stop range....

However, when im in a short position and i click the same scale out hotkey and hitting the Short Range Order:

 

  • (CXL ALLSYMB; Route=Limit;Share=Pos;Price=StopPrice-AvgCost;Price=Price*2;Price=AvgCost-Price;Price=Round2;Route=Stop;StopType=Range;HighPrice=StopPrice;LowPrice=Price;TIF=DAY+;BUY=Send;ROUTE=LIMIT)

it cancels the range order without getting into a new one. 

 

I'll have to remember to try this tomorrow, I have an idea on what might be causing an issue but I need to test it.

 

On 7/5/2020 at 5:50 AM, Benjamin Tang said:

I use the following commands in SIM and trying to figure out what is going on. 

Double click to trade and Montage > Style > Stop Order is set

Long
image.thumb.png.a0e502b5387ad753b76275724adc520c.png

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

I use this Long command (please ignore the entry, its on purpose). i was expecting the stop loss will be triggered but that is not the case. can some body explain what is going on?
 

Short:
StopPrice=Price+0.01;DefShare=BP*0.97;Share=DefShare*0.167*Price*0.01;Price=Price-Bid+0.01;SShare=Share/Price;Share=DefShare-SShare;DefShare=DefShare+SShare;SShare=Share;Sshare=DefShare-SShare;Share=0.5*SShare;TogSShare;ROUTE=LIMIT;Price=bid-0.03;TIF=DAY+;SELL=Send;DefShare=100;TriggerOrder=RT:STOP STOPTYPE:MARKET PX:StopPrice+0.3 ACT:BUY STOPPRICE:StopPrice QTY:Pos TIF:DAY+;

I use this short command (please ignore the entry, its on purpose). i was expecting the stop loss will be triggered but that is not the case. can some body explain what is going on?
image.thumb.png.a2447a1acc39e01d1e81e1ca5c590c37.png
 

image.png

image.png

Few things, can you confirm you have 6:1 leverage (margin) on this account? Default is 4:1. The hotkeys you pasted are setup for 6:1 and a mismatch in leverage to the account can cause anomalies. Second, can you add a Trigger Order window and try again, see if a trigger order is being created? It's under Main Menu -> Trade -> Trigger Order .... this window works like the Open Orders window and will populate the status of active (not triggered) TO's.

3 hours ago, Seydou Dia said:

Hello friends, anyone using CMEG with the BBT promo code AND Kyle's hotkey; would you be kind enough to copy me your hotkey config. I am kinda confused with which ROUTE to use. I have read somewhere that LAMP route is not use anymore; but I am not sure. Thank you for any answer!

If you find a working setup for CMEG, please do post your config so I can roll it in as the recommended. CMEG is the odd-duck, as they have certain things  that mess with the hotkeys.

I've heard some users have luck setting the Time in Force to --> TIF=DAY;   instead of the default TIF=DAY+. Apparently that solves some rejection issues with them.

 

  • Like 2

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

Share this post


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

Do you ever see any open order in the Orders window to the left?

Hi Justin,

No open orders at all (hope you can see it on one of the screenshot from my original post)

Share this post


Link to post
Share on other sites
27 minutes ago, Benjamin Tang said:

Hi Justin,

No open orders at all (hope you can see it on one of the screenshot from my original post)

Hey, yeah I saw - I was just wondering if you even saw it flash and disappear right away?

Also did you see Kyle's comment?

16 hours ago, KyleK29 said:

Few things, can you confirm you have 6:1 leverage (margin) on this account? Default is 4:1. The hotkeys you pasted are setup for 6:1 and a mismatch in leverage to the account can cause anomalies. Second, can you add a Trigger Order window and try again, see if a trigger order is being created? It's under Main Menu -> Trade -> Trigger Order .... this window works like the Open Orders window and will populate the status of active (not triggered) TO's.

 

  • Thanks 1

Share this post


Link to post
Share on other sites
16 hours ago, KyleK29 said:

Few things, can you confirm you have 6:1 leverage (margin) on this account? Default is 4:1. The hotkeys you pasted are setup for 6:1 and a mismatch in leverage to the account can cause anomalies. Second, can you add a Trigger Order window and try again, see if a trigger order is being created? It's under Main Menu -> Trade -> Trigger Order .... this window works like the Open Orders window and will populate the status of active (not triggered) TO's.

Interesting, Didnt know my hotkeys are based on 6:1.  my leverage in SIM is currently at 4:1.

can you tell me what i need to change in my Hotkey setup?

Share this post


Link to post
Share on other sites
18 minutes ago, Benjamin Tang said:

Interesting, Didnt know my hotkeys are based on 6:1.  my leverage in SIM is currently at 4:1.

can you tell me what i need to change in my Hotkey setup?

I don't recommend doing it manually. Here's what the Configurator put out for what I believe is your settings.


LONG - % Equity Risk Version, 1%, DAS DEMO Broker, 4:1 Margin:

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


SHORT - % Equity Risk Version, 1%, DAS DEMO Broker, 4:1 Margin:

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

If these don't work for you, you'll need to go into DAS -> Main Menu (Top Bar) -> Setup -> Other Configuration, check the option "Don't Delete History Logs" and "Log Debug Message". Close and restart DAS.  Go test the hotkeys in a trade where it fails. Then PM me the content of the log file in the C:\DAS Trader Pro\LOG\ directory, it should be named for the date, e.g. YYMMDDLog.txt --> 200707Log.txt would be today.

  • Like 1

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

Share this post


Link to post
Share on other sites
On 9/5/2019 at 9:46 AM, KyleK29 said:

Can you post the hotkey command(s) that you are using? And / or did you create them using the configuration Excel sheet yourself or did someone send them to you? I find that the ones users pass around tend to fail because a lot of messaging programs strip out (sanitize) the "*" in the command which causes calculation issues.

 

Hello - I am having the same problem. Every time that I try to send an order, the prompt "set default share to 400" pops up on my montage. I am not sure how to fix this? I got my script from Thor's dropbox in the chatroom. 

Share this post


Link to post
Share on other sites
1 hour ago, jpierson3 said:

Hello - I am having the same problem. Every time that I try to send an order, the prompt "set default share to 400" pops up on my montage. I am not sure how to fix this? I got my script from Thor's dropbox in the chatroom. 

The "set default share to 400" is normal, as Thor has it set to 400. It uses the DefShare variable for another calculation and then resets it to a user specified value at the end. 

With that said, I don't recommend new users to use Thor's desktop hotkeys as they're specific to his setup, mainly his broker. If you're in DAS Demo/Sim they will fail frequently and have an assortment of issues. They're for IBCO users (I've reached out to him to see if he can append those files to signal this). I recommend new users to download the Excel configuration sheet and configure them for their specific setup to minimize the chance of having issues.

  • Like 1

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

Share this post


Link to post
Share on other sites
On 6/27/2020 at 1:39 PM, Fernando Samora said:

Hey all, hope someone can help me out. Im trying the hotkets and they work GREAT. 

I do have one issue and would like some help: When im long in a position and scale out I can reclick my Long range order hotkey:

  • (CXL  ALLSYMB; Route=Limit;Share=Pos;Price=AvgCost-StopPrice;Price=Price*3;Price=Price+AvgCost;Price=Round2;Route=Stop;StopType=Range;LowPrice=StopPrice;HighPrice=Price;TIF=DAY+;SELL=Send;ROUTE=LIMIT)

and it re calculates the remaining shares to reset the new share number with the same stop range....

However, when im in a short position and i click the same scale out hotkey and hitting the Short Range Order:

 

  • (CXL ALLSYMB; Route=Limit;Share=Pos;Price=StopPrice-AvgCost;Price=Price*2;Price=AvgCost-Price;Price=Round2;Route=Stop;StopType=Range;HighPrice=StopPrice;LowPrice=Price;TIF=DAY+;BUY=Send;ROUTE=LIMIT)

it cancels the range order without getting into a new one. 

 

I was able to locate the issue on the short side.

Try this one:

CXL ALLSYMB;Route=Limit;Share=Pos;StopPrice=HighPrice;Price=StopPrice-AvgCost;Price=Price*2;Price=AvgCost-Price;Price=Round2;Route=Stop;StopType=Range;HighPrice=StopPrice;LowPrice=Price;TIF=DAY+;BUY=Send;ROUTE=LIMIT;

 

  • Like 1
  • 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
50 minutes ago, Andrew from Jersey said:

Good afternoon all, 

Is there a way to scale into a trade, long or short, and have the stop set to break-even? 

Thanks, 

Andrew

Hey Andrew, If you open Kyle's spreadsheet you'll see he has options to scale in additional risk:

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

Hard to test right now (because the market is closed), but I think if you simply change StopPrice to AvgCost, that will reset your stop to break even at the same time.

Share this post


Link to post
Share on other sites
9 minutes ago, Justin said:

Hey Andrew, If you open Kyle's spreadsheet you'll see he has options to scale in additional risk:

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

Hard to test right now (because the market is closed), but I think if you simply change StopPrice to AvgCost, that will reset your stop to break even at the same time.

@Justin Is there a way to accomplish this with scaling in a percentage risk, instead of the set dollar amount risk? I use the 25% and 50% of position scale in function. 

Share this post


Link to post
Share on other sites

Yes, that's also in the spreadsheet (although I added the stop order portion from the $ script).

This will add 50% to an existing position. So if you're long 100 shares, this will add another 50 shares and reset your stop to break even.

CXL ALLSYMB;DefShare=BP*0.97;Share=Pos;SShare=Share *0.5;Share=DefShare-SShare;DefShare=DefShare+SShare;SShare=Share;Sshare=DefShare-SShare;Share=0.5*SShare;TogSShare;ROUTE=SMRTL;Price= Ask+0.02;TIF=DAY+; BUY=Send;DefShare=400;TriggerOrder=RT:STOP STOPTYPE:MARKET PX:StopPrice-0 ACT:SELL STOPPRICE:AvgCost QTY:Pos TIF:DAY+;

  • Thanks 1

Share this post


Link to post
Share on other sites

@Justin Thank you! So I see the end of the script is what I was missing in mine, namely " TriggerOrder=RT:STOP STOPTYPE:MARKET PX:StopPrice-0 ACT:SELL STOPPRICE:AvgCost QTY:Pos TIF:DAY+; ". Now, if I wanted to switch this to a short position function, would I just change that last part of the script from "SELL STOPPRICE:AVGCost" to "BUY STOPPRICE:AVGCost" ??

Share this post


Link to post
Share on other sites

A couple more spots to change will make that work - Which I've highlighted below:

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

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.