Jump to content
脕kos Mar贸y

update hard stop when partialing out

Recommended Posts

Hi,

I wonder if there is a simple / automated way to update a hard stop in DAS Trader, when partialing out?

When I set a hard stop at the time of taking my order, the stop will have the same number of shares as what I opened my trade with. But as I take partial profits, my number of shares in the trade decrease - but the stop order still has the same number of shares. Thus, if I'm stopped out by the hard stop, it will 'overdo' my stop.

For example, I start my trade with 100 shares, and set a hard stop in DAS Trader to 100 shares. I partial out 25 shares, and I have 75 shares remaining. But the hard stop remains with 100 shares. Then things go the wrong way, and I get stopped out by the hard stop - but it does it at 100 shares, and I'll end up 25 shares in the 'wrong direction'.

I wonder if there is a mechanism / automatism / script, that would adjust my hard stop as I'm partialing out, to reflect the number of shares I still have active in the trade?

Akos

Share this post


Link to post
Share on other sites

Hey Akos,

This is what you're looking for - It will move your stop loss to break even. Let me know if you don't want that for some reason though. You'll need to change the bolt parts to suit you; Route= for your own broker and the Share=Pos* for how much you want to scale out.

Short Scale Out 50%
CXL ALLSYMB;Route=LIMIT;Share=Pos*0.5;Price=Ask+0.05;TIF=DAY+;BUY=Send;ROUTE=STOP;StopType=Market;StopPrice=AvgCost;Share=Pos+share;TIF=DAY+;BUY=SEND

Long Scale Out 50%
CXL ALLSYMB;Route=LIMIT;Share=Pos*0.5;Price=Bid-0.05;TIF=DAY+;SELL=Send;ROUTE=STOP;StopType=Market;StopPrice=AvgCost;Share=Pos-share;TIF=DAY+;SELL=SEND

  • Like 1

Share this post


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

This is what you're looking for - It will move your stop loss to break even. Let me know if you don't want that for some reason though.

my problem is that the number of shares in the stop don't change, but as I'm partialing out, the shares I have in the trade are less and less. my problem is not with partialing out.

again, my example:

I buy 100 shares at a set price. I also add a STOP with a MARKET order for 100 shares at a lower trigger.

I sell 25 shares partiling out, so I have 75 shares left. my STOP order is still set to 100 shares

if I'm stopped out by the STOP order / trigger, it sill sell 100 shares, but I only have 75 left. so it sells more shares than what I have. and I'll end up short 25 shares.

I'd like to have the STOP order / trigger sell exactly as many shares that I have at the time it's triggered

Share this post


Link to post
Share on other sites

The issue is when you buy the 100 shares with a hard stop it has that amount of shares and can't get updated unless you close the current hard stop and create a new one based on the amount of shares you have left. Use what Justin gave you for a script and take the Share=Pos*.5 and just change it with Share=Pos to create a stop loss button.


Here is one I have for break even +.10. The StopPrice can be changed to what you want it to be.聽 The AvgCost is what you paid for it.

ROUTE=STOP; STOPTYPE=MARKET; StopPrice=AvgCost+.10; Share=Pos;TIF=DAY;SELL=Send

Share this post


Link to post
Share on other sites
1 hour ago, 脕kos Mar贸y said:

my problem is that the number of shares in the stop don't change, but as I'm partialing out, the shares I have in the trade are less and less. my problem is not with partialing out.

again, my example:

I buy 100 shares at a set price. I also add a STOP with a MARKET order for 100 shares at a lower trigger.

I sell 25 shares partiling out, so I have 75 shares left. my STOP order is still set to 100 shares

if I'm stopped out by the STOP order / trigger, it sill sell 100 shares, but I only have 75 left. so it sells more shares than what I have. and I'll end up short 25 shares.

I'd like to have the STOP order / trigger sell exactly as many shares that I have at the time it's triggered

That's exactly what this hotkey does, with the caveat that it also moves your stop to break even.

Lets say you are long 120 shares at $10.20 and have a stop set for 120 shares at $10.00
The price goes in your favor at $10.50 and you want to sell 50% of your shares
You hit the hotkey above that sells 50% (60 shares in this case). You now have 60 shares remaining. At the same time, the hotkey will also CANCEL your current stop, and reset a NEW stop at break even ($10.20) with the remaining position 60 shares.

The reason you would want to reset the stop to break even ($10.20), instead of leaving it at the original $10.00 is because it will protect your profits; you wont lose any more than you've already partialed out with.

Share this post


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

That's exactly what this hotkey does, with the caveat that it also moves your stop to break even.

Lets say you are long 120 shares at $10.20 and have a stop set for 120 shares at $10.00
The price goes in your favor at $10.50 and you want to sell 50% of your shares
You hit the hotkey above that sells 50% (60 shares in this case). You now have 60 shares remaining. At the same time, the hotkey will also CANCEL your current stop, and reset a NEW stop at break even ($10.20) with the remaining position 60 shares.

The reason you would want to reset the stop to break even ($10.20), instead of leaving it at the original $10.00 is because it will protect your profits; you wont lose any more than you've already partialed out with.

indeed it does! you're a genius! 馃檪

I was corresponding with DAS at the same time, and they figured this cannot be done... I'll share your script with them, giving credit to you of course

  • Haha 1

Share this post


Link to post
Share on other sites

a follow up question: currently I'm entering these trades with the following script:

go long with a $100 risk:

StopPrice=Price-0;DefShare=BP*0.925;Price=Ask-Price+0.00;SShare=100/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+;

now, if I enter a trade, and I use your script to partial out - great.

but if I want to add more to the trade, my stop will not be updated. how would one update the existing stop, when adding into the trade?

Share this post


Link to post
Share on other sites

If you've added to your trade and want to update your stop loss I have two scripts for you (they will also work whether you are long or short):

Update Stop Shares - Moves to Breakeven:
CXL ALLSYMB;Route=Stop;Price=AvgCost;StopType=MARKET;STOPPRICE=AvgCost;StopPrice=Round2;Share=Pos;TIF=DAY+;Send=Reverse;

Update Stop Shares - Doesn't move stop:
CXL ALLSYMB;Route=Stop;StopType=MARKET;STOPPRICE=STOPPRICE;StopPrice=Round2;Share=Pos;TIF=DAY+;Send=Reverse;

Edited by Justin
  • Like 3

Share this post


Link to post
Share on other sites

Thanks Just I was having the same issue as well.聽 Your posts are very helpful.聽 Just a question if I want to add more shares with the same amount of risk, do I just press the same hotkey as your first trade? Or is there another hotkey to add more shares.

Thanks.

Share this post


Link to post
Share on other sites

Hey @Gforce1! Happy to help 馃檪

I'm assuming you are using Kyle's hotkeys to calculate your risk? If that's true, then no, don't hit the hotkey. On his spreadsheet in the Hot Keys tab you'll see Scale-In POS % - This will allow you to scale in by a percentage amount utilizing your same risk profile set up in the first tab.

I'm reticent to post the script, because it's very custom to each trader. My buying power offset could be different, my bid/ask offset could be different, route information, etc.

If you didn't use his spreadsheet, just let me know and I'll post it with some instructions on what to change. Otherwise it will be a lot easier and safer to grab your custom script from the spreadsheet.

  • Like 1

Share this post


Link to post
Share on other sites

Jumping in her as well, say you use the scripts with $50 risk with a hard stop, and you want to add another $25 or $50, you can hit the keys again (assuming you have two keys one for $25 and one for $50 risk). This will reset your stop out price to the new one with the new position聽share聽count. You are adding to your position so you will need to be aware what you are hitting and keep a mental note.聽 I havent tried to Scale-In POS% yet, that could be simpler/superior coming from Kyle I dont doubt it 馃檪

Share this post


Link to post
Share on other sites

@Brendon Interesting, I just tried a raw version of Kyle's hotkey and hitting the hotkey again doesn't add to the position. Is it possible you've modified your hotkey a bit to make that work? Or it could be because the market is closed too...

Anyway, I think there was a rare occurrence reason why it wasn't recommended, but I could be totally wrong! I'll ask Kyle 馃構

Share this post


Link to post
Share on other sites

@Justinoh sorry I forgot to mention you have to double click on the chart for your new stop then hit the kotkey with the amount you want to add (but you prob did that). I used the hotkey from BBT's Automatic聽hotkey youtube video..in the description. I can paste my script if it doesnt work. It seemed to work perfectly for me,聽it just cancels your old stop聽order and adds more, say the $50, with a new stop of your position size per symbol.

Edited by Brendon

Share this post


Link to post
Share on other sites

HI Justin,

@JustinI tried your hotkey to sell x% of shares that you posted above.聽 However I'm getting a problem. So I changed your hotkey code to 0.75 to sell 25% of my shares and move my stop to break even.聽 It works perfectly the first time I use the hotkey but when I want to sell another 25% and move stop to break even it doesn't work.聽 When I use it the second time it sells my whole position. Do you know what I'm doing wrong?


Thanks.

Edited by Gforce1

Share this post


Link to post
Share on other sites
On 5/21/2020 at 8:38 PM, Justin said:

If you've added to your trade and want to update your stop loss I have two scripts for you (they will also work whether you are long or short):

Update Stop Shares - Moves to Breakeven:
CXL ALLSYMB;Route=Stop;Price=AvgCost;StopType=MARKET;STOPPRICE=AvgCost;StopPrice=Round2;Share=Pos;TIF=DAY+;Send=Reverse;

Update Stop Shares - Doesn't move stop:
CXL ALLSYMB;Route=Stop;StopType=MARKET;STOPPRICE=STOPPRICE;StopPrice=Round2;Share=Pos;TIF=DAY+;Send=Reverse;

thanks - these are perfect!

you're awesome 馃檪

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.