Jump to content
KyleK29

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

Recommended Posts

understand that, no worries, thanks very much Peter.

this is for swing trade part of my portfolio actually, so i was thinking if i can get targets in place it is more hands off. 

 

Share this post


Link to post
Share on other sites

Is it possible to use this code to send a limit order short 20 cents ABOVE current ask?

CXL ALLSYMB;StopPrice=Price+0;DefShare=BP0.99;Price=Price-Bid+0.00;SShare=50/Price;Share=DefShare-SShare;DefShare=DefShare+SShare;SShare=Share;Sshare=DefShare-SShare;Share=0.5*SShare;TogSShare;ROUTE=SMRTL;Price=Bid-0.1;TIF=DAY+;SELL=Send;DefShare=200;Price=StopPrice-Bid*3;Price=Bid-Price;TriggerOrder=RT:STOP STOPTYPE:RANGEMKT LowPrice:Price HighPrice:StopPrice ACT:BUY QTY:POS*0.25 TIF:DAY+;TIF=DAY+;TriggerOrder=RT:STOP STOPTYPE:RANGEMKT LowPrice:Price HighPrice:StopPrice ACT:BUY QTY:POS*0.25 TIF:DAY+;TIF=DAY+;TriggerOrder=RT:STOP STOPTYPE:RANGEMKT LowPrice:Price HighPrice:StopPrice ACT:BUY QTY:POS*0.25 TIF:DAY+;TIF=DAY+;TriggerOrder=RT:STOP STOPTYPE:RANGEMKT LowPrice:Price HighPrice:StopPrice ACT:BUY QTY:POS*0.25 TIF:DAY+;TIF=DAY+

 

Share this post


Link to post
Share on other sites

what do you mean? If I set risk at 6, and current ask is at 5, I want it to send a limit order at 5.2. Risking 50 dollars. Is that possible?

I have tried, but didn't find out what number to change to get it to work, that's why I'm asking

Share this post


Link to post
Share on other sites

I understand that 20 cents could be too much or too little, what I want is just a limit order that don't get filled right away, and which I can drag around to get filled on a bounce (closer to my risk), I know the risk will increase/decrease depending on where I drag it, and that's okay. Also I will have two or three hotkeys for it depending on what price range it is. It just to get a better price on a bounce, and risk somewhere around what I'm willing to risk without having to calculate how many shares I need. 

Thank you,  I will try this when market opens.

Share this post


Link to post
Share on other sites

Seems like I had to chance this last part (in bold) for it to work, I tried with and without your suggestion (first bold part), but it didn't make a difference, so not sure what it does:

Price=Price-Bid+0.00;SShare=10/Price;Share=DefShare-SShare;DefShare=DefShare+SShare;SShare=Share;Sshare=DefShare-SShare;Share=0.5*SShare;TogSShare;ROUTE=SMRTL;Price=Bid+0.2;TIF=DAY+;

 

Price=Price+0.2-Bid+0.00;SShare=10/Price;Share=DefShare-SShare;DefShare=DefShare+SShare;SShare=Share;Sshare=DefShare-SShare;Share=0.5*SShare;TogSShare;ROUTE=SMRTL;Price=Bid+0.2;TIF=DAY+;

reason why I want this is because stocks moves so fast, so the bounce back to where I want to get in might be too fast for me to react to enter.

 

Thank anyway 🙂

Share this post


Link to post
Share on other sites

First and foremost, thank you so much for creating this hotkey setup @KyleK29

I have a question which I feel may be very simple, but for someone like me is making me tear my hair out. I don't want to click on the chart for where my stop goes. I simply want a 1% stop from my entry, but I still want DAS to autocalculate the position size for me. Is this possible? 

ex. Stock is flushing towards $100 and I want to buy it right at 100 with a 1% stop and risk $1000. Is there a way to script a hotkey where I can just throw my order on the bid as it flushes down into 100 and it will automatically know to throw the stop down around 99 with a position size of 1000 shares? And vice versa for shorting? 

 

Thank you in advance brother. If there is ever anything I can do for you, please don't hesitate to reach out. @RickyAnalog on twitter. 

 

Regards

Edited by rickyanalog

Share this post


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

i am not Kyle but it has been discussed here

 and also in this very topic here


https://forums.bearbulltraders.com/topic/716-das-dynamically-calculate-shares-on-risk-or-risk-hot-key-configuration-updated-91019-v21/?do=findComment&comment=22590

but the challenge with this approach is the spread which is getting effectively bigger with less priced stock and smaller with higher priced stocks so i highly do not recomend you this until whole your strategy is built around percentages as it will cause you to make many time too tight stop and many times too wide stop

I know how to create the stop loss. But I don't know how to have it automatically calculate the position size so that my risk is a set $ risk. I already use the hotkey created by Kyle in this thread. But what I need is different. In Kyle's hotkey the price field of DAS is used as what will become your stop level. But I need the price field to be my entry (or if possible I would like the hotkey to have the entry automatically be on the bid for longs and on the ask for shorts). Hopefully I'm explaining myself ok.

As black and white as I can word it is: hotkey that does 3 things - 1. entry that adds liquidity 2. calculates the position size based on $ risk 3. sets stop 1% away from entry

 

I appreciate your help @peterB and anyone else out there that reads this and knows the answer. 

Share this post


Link to post
Share on other sites
On 11/7/2021 at 12:57 AM, peterB said:

this opens a Long position with risk 1000 and stop 1% below the current price. do you need something else?


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

if you want to understand it check in Kyle's XLS sheet on the Example - $Risk tab

for an entry triggered by price in the future there is this topic

 

@peterB, I tried to make the same hotkey for the short side and i messed sometthing up. would you happen to know what i did wrong? FWIW, i did change the long hotkey script to make it so I bought on the bid in order to add liquidity and be able to hotkey into the trade as a stock is flushing emotionally into my levels. So for the short side I would want it to short on the ASK as a stock is spiking into my levels. I truly appreciate the help.

StopPrice=BID*1.01;DefShare=BP*0.97;Price=Ask-StopPrice+0.01;SShare=1000/Price;Share=DefShare-SShare;DefShare=DefShare+SShare;SShare=Share;Sshare=DefShare-SShare;Share=0.5*SShare;TogSShare;ROUTE=CARCAL;Price=ASK;TIF=DAY+;BUY=Send;DefShare=100;TriggerOrder=RT:STOP STOPTYPE:MARKET PX:StopPrice-0 ACT:SELL STOPPRICE:StopPrice QTY:Pos TIF:DAY+ 

Share this post


Link to post
Share on other sites
42 minutes ago, peterB said:

change BUY=Send; to SELL=Send if you want to short and not sure about the Ask-StopPrice. Maybe do Bid+StopPrice instead

tried that and it didn't work. it keeps shorting at the ask 11 shares. something is off about how it is calculating the position size. fwiw, this is the script as i have it at the moment

StopPrice=BID*1.01;DefShare=BP*0.97;Price=Bid+StopPrice-0.01;SShare=1000/Price;Share=DefShare-SShare;DefShare=DefShare+SShare;SShare=Share;Sshare=DefShare-SShare;Share=0.5*SShare;TogSShare;ROUTE=CARCAL;Price=ASK;TIF=DAY+;SELL=Send;DefShare=100;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
2 hours ago, peterB said:

StopPrice=Price*1.01;DefShare=BP*0.97;Price=Price-Bid;SShare=1000/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=200;TriggerOrder=RT:STOP
 STOPTYPE:MARKET PX:StopPrice+0.05 ACT:BUY STOPPRICE:StopPrice QTY:Pos TIF:DAY

that gives me an error saying "can't get valid price!". but i played around with an excel sheet to try and reverse engineer what is actually going on here with this script and came to the conclusion that this is what I need:

StopPrice=ASK*1.01;DefShare=BP*0.97;Price=StopPrice-Ask;SShare=1000/Price;Share=DefShare-SShare;DefShare=DefShare+SShare;SShare=Share;Sshare=DefShare-SShare;Share=0.5*SShare;TogSShare;ROUTE=CARCAL;Price=ASK;TIF=DAY+;SELL=Send;DefShare=100;TriggerOrder=RT:STOP STOPTYPE:MARKET PX:StopPrice-0 ACT:BUY STOPPRICE:StopPrice QTY:Pos TIF:DAY+ 

Can anyone look this over and let me know if this seems to be correct? It appears to work, but I'm wondering if there is something I'm missing or not thinking about that might get me into hot water down the road. Thanks in advance. 

Share this post


Link to post
Share on other sites
3 minutes ago, peterB said:

yes i forgot to change the stopprice at the start coz Price is that variable which comes from the click so yiu replaced it with ask which is correct

thank you so very much @peterBfor all of your help. if i can ever do anything for you, please reach out. not sure if you're on twitter, but you can always dm me there at @rickyanalog   

Share this post


Link to post
Share on other sites

Hi There - I had a Das Trader/bearbull help session yesterday and got setup with the risk based hotkeys.  Everything works fine...once - and then I get the 'Cannot Find Valid Price' error on subsequent attempts to use the hotkey (or on the sell side).  Hotkeys were setup in a screenshare so not sure where to begin, but here is what I have: 

 

CXL ALLSYMB;StopPrice=Price-0;DefShare=BP*0.925;Price=Ask-Price+0.00;SShare=25/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=200;Price=Ask-StopPrice*2+Ask;TriggerOrder=RT:STOP STOPTYPE:RANGE LowPrice:StopPrice HighPrice:Price ACT:SELL QTY:POS TIF:DAY+

 

The only thing I noticed is that after execution, the default in montage is set to limit, from market when the trade executes, but don't know enough to know whether that's relevant here.  

 

Any help appreciated!

Share this post


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

Hi There - I had a Das Trader/bearbull help session yesterday and got setup with the risk based hotkeys.  Everything works fine...once - and then I get the 'Cannot Find Valid Price' error on subsequent attempts to use the hotkey (or on the sell side).  Hotkeys were setup in a screenshare so not sure where to begin, but here is what I have: 

 

CXL ALLSYMB;StopPrice=Price-0;DefShare=BP*0.925;Price=Ask-Price+0.00;SShare=25/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=200;Price=Ask-StopPrice*2+Ask;TriggerOrder=RT:STOP STOPTYPE:RANGE LowPrice:StopPrice HighPrice:Price ACT:SELL QTY:POS TIF:DAY+

 

The only thing I noticed is that after execution, the default in montage is set to limit, from market when the trade executes, but don't know enough to know whether that's relevant here.  

 

Any help appreciated!

right click on the grey area of your montage, go to style then make sure you select " stop order"  let me know if that helps 

Share this post


Link to post
Share on other sites

Another thing is with Shorts if thats what order your trying to place, that the equity doesn't have an SSR " short sale restriction 

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.