Jump to content
KyleK29

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

Recommended Posts

Hi

If I understand this script correctly, does it place a stop order for your WHOLE position? Cause I already was short 50 shares, and had a range order on that, and when the stop order came (after I pushed the hotkey for a certain risk), I think it included those 50 shares I had before, as I got stopped out on the whole position

Share this post


Link to post
Share on other sites

Is there a way to make with a one click hotkey. Place order at HOD with stoploss at LOD calculate share size based upon a fixed dollar amount stoploss?

Share this post


Link to post
Share on other sites
Hey guys,
 
I have issues with the hotkeys from the BBT video series. For instance, I have been testing this $50 risk hotkey and 1:2 Range order R:R key. My stop order ain't going through...only my buy/sell order is going through...It's calculating the shares correctly though. I cannot see my stop order at all, neither on the chart nor the order window. 
 
Here are the scripts that I'm using...I haven't changed anything..I just copied and pasted it from the BBT video series pdf. 
 
$50 Risk hotkey

Buy $50 Risk:-
StopPrice=Price-0;DefShare=BP*0.925;Price=Ask-Price+0.00;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=200;TriggerOrder=RT:STOP
STOPTYPE:MARKET PX:StopPrice-0.05 ACT:SELL STOPPRICE:StopPrice QTY:Pos TIF:DAY+;

Short $50 Risk:-
StopPrice=Price+0;DefShare=BP*0.925;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.05;TIF=DAY+;SELL=Send;DefShare=200;TriggerOrder=RT:STOP
STOPTYPE:MARKET PX:StopPrice+0.05 ACT:BUY STOPPRICE:StopPrice QTY:Pos TIF:DAY+;
 
Long Position 2R $25
CXLALLSYMB;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+;

Short Position 2R $25
CXLALLSYMB;StopPrice=Price+0;DefShare=BP*0.925;Price=Price-Bid+0.00;SShare=25/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=200;Price=StopPrice-Bid*2;Price=Bid-Price;TriggerOrder=RT:STOP STOPTYPE:RANGE LowPrice:Price HighPrice:StopPrice ACT:BUY QTY:POS TIF:DAY+
 
I have attached the montage screen. For illustration purposes, I have shorted AMC @46.84 with a stop of 47.12  (using $25 risk key). It correctly calculated 89 shares and placed the order, but I cannot see the stop order on my order window or the chart. I'm using a simulation account.
 
Can someone help me out?

Thanks 
Paul

Screen.jpg

Edited by Deepak Paul

Share this post


Link to post
Share on other sites

I am having issues with the double clicking required to enter a position. Is there a way to change the hotkey script to calculate share size to just as an example as a %of the stock price and use that to calculate entry size and stop placement instead of using the calculation from the double click? For example, stock is priced at $100, so using that price*10% your stop would be set and calculated as if you double clicked $1 below for your stop? Thanks

Share this post


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

yes it is absolutely possible just by changing the stop price calculation in the script and use the current price *0.99 for 1% stop loss or 0.995 for 0,5% stop loss instead of the clicked stop loss

Are you sure it isn’t price*.01? Wouldn’t 100*.99 give me a $99 stop?

So instead of StopPrice=Price-0.01; I would want StopPrice=Price*0.01?

Share this post


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

if price is 100 and you want 1 dollar stop you need the stop to be at 99 so price * 0.99

the stop price is an absolute value not relative

of course first try in sim

This is my long hotkey do you think you can highlight what you mean when you say change the stop price calculation?

StopPrice=Price-0.01;DefShare=BP*0.97;Price=Ask-Price+0.01;SShare=10/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.2 ACT:SELL STOPPRICE:StopPrice QTY:Pos TIF:DAY+; 

Share this post


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

the value you double click on the chart to set the stop is in the Price variable so you need to change the StopPrice=Price-0.01 to StopPrice=Ask*0.99

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

It looks like this change works but only on stocks less than about $10. Anything higher priced and it doesn't enter a position. 

This is what it says in the montage:

Set default share to 400
Error:Invalid Shares!
Set default share to 2525
Set default share to 2525
NIO Bid:38.28 Ask:38.29

Edited by Oliver

Share this post


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

you might need to use the round2 parameter to get proper decimals handling

What do you mean round2 parameter?

Share this post


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

;StopPrice=Round2;

add this to the script

Like this?

StopPrice=Ask*0.99;StopPrice=Round2;

Share this post


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

maybe add it before the calculation is done so it knows it will be rounded before the calculation

Still getting this same error:

Set default share to 400
Error:Invalid Shares!
Set default share to 2523
Set default share to 2523
NIO Bid:38.16 Ask:38.17

It looks like it's trying to take 2523 shares of NIO when $10 risk would be around 20 shares. Not sure why this is throwing it off.

Edited by Oliver

Share this post


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

are you telling me that it worked with the double click method and now it does not with the counted percentage method? post your hotkey

Yes it worked while double clicking. 
this is what I was using:

StopPrice=Price-0.01;DefShare=BP*0.97;Price=Ask-Price+0.01;SShare=10/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.2 ACT:SELL STOPPRICE:StopPrice QTY:Pos TIF:DAY+; 

 

Now it is this:

StopPrice=Round2;StopPrice=Ask*99;DefShare=BP*0.97;Price=Ask-Price+0.01;SShare=10/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.2 ACT:SELL STOPPRICE:StopPrice QTY:Pos TIF:DAY+; 

Share this post


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

ask*99 is the problem. make it ask*0.99

Same problem, sorry this is such a pain.

Set default share to 400
Error:Invalid Shares!
Set default share to 892
Set default share to 892
AMD Bid:106.36 Ask:107.39

StopPrice=Round2;StopPrice=Ask*0.99;DefShare=BP*0.97;Price=Ask-Price+0.01;SShare=25/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.2 ACT:SELL STOPPRICE:StopPrice QTY:Pos TIF:DAY+;

 

It's still trying to take way too many shares.

Edited by Oliver

Share this post


Link to post
Share on other sites

Good evening.

When I use the below listed scripts almost all of the features execute as expected. Double click. No problem. Stop order. No problem. Buy / Sell order (profit). No problem. My curious issue is when the trade moves my way and fills to the ultimate buy / sell order, it immediately places me into another trade. If I'm playing a reversal to the upside. Double click 10 cents below on the screen. Select the hotkey. Immediately filled. Stop order sent. Sell order sent. When the trade goes my way to the Sell order (in this example) the order will fill, and at the same time enter a new long position after the fill. Curious. Is there something off in my script?   I believed it was set to 1R loss and 3R profit.                                           

Thank you much

LONG

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

SHORT

CXL ALLSYMB;StopPrice=Price+0;DefShare=BP*0.925;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.05;TIF=DAY;SELL=Send;DefShare=200;Price=StopPrice-Bid*3;Price=Bid-Price;TriggerOrder=RT:STOP STOPTYPE:RANGE LowPrice:Price HighPrice:StopPrice ACT:BUY QTY:POS TIF:DAY

Share this post


Link to post
Share on other sites

Interesting.

Ok. I will post more details of the behavior. The range order is the correct size yes. It does not perform the same misbehavior when stopped out. I am also using the latest version of DAS. 

Thank you

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.