Jump to content

We have moved to Discord. Please click here to join us in the Trading Terminal Discord server.



These forums are read-only.

KSFO

How to Modify StopLoss Order after Partial?

Recommended Posts

KSFO

Hello folks,

I have been using this hotkeys for the last two days and it mainly worked well. However, the problems is that after I partial out, the original stop loss was still there with the original share size. So if I don't play close attention after I partial out. When the stop loss hit it would turn into a short order. So the question is how do I edit the share size of the stop loss after I take some partials? Thank you so much!

 

 

 

Hotkey to send an automatic stop loss with 50$ risk per trade(LONG POSITION).

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+;

Share this post


Link to post
Share on other sites
Justin

You can have one hotkey to partial, cancel the current stop, and reset it with remaining position at break even.

This will sell 10% of your position when long and do the rest mentioned above:

CXL ALLSYMB;Route=LIMIT;Share=Pos*0.10;Price=Bid-0.05;TIF=DAY+;SELL=Send;ROUTE=STOP;StopType=Market;StopPrice=AvgCost;Share=Pos-share;TIF=GTC;SELL=SEND

  • Thanks 1

Share this post


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

You can have one hotkey to partial, cancel the current stop, and reset it with remaining position at break even.

This will sell 10% of your position when long and do the rest mentioned above:

CXL ALLSYMB;Route=LIMIT;Share=Pos*0.10;Price=Bid-0.05;TIF=DAY+;SELL=Send;ROUTE=STOP;StopType=Market;StopPrice=AvgCost;Share=Pos-share;TIF=GTC;SELL=SEND

Appreciate the help! So I could do it multiple times and it would keep resetting a new break even for me?

Share this post


Link to post
Share on other sites
Justin

That is correct 🙂

Share this post


Link to post
Share on other sites
jpBlue

Justin, do you know how to do a stop of 1% of the current position? Not using the buying power. I want to place the stop after I enter the trade and have the possibility of moving my stop loss to 1% of the entry. To clarify:

- I buy 100 shares of XYZ at an AvgPrice of $20. 

- I want to Place a stop at 1% below the average price. 

I think is probably super easy but I'm still figuring this out. Your help would be greatly appreciated!!

 

Thanks!!

Share this post


Link to post
Share on other sites
Justin

I haven’t tested this but I believe it would just be adding the bolded part to the stop order script:

ROUTE=STOP;StopType=Market;StopPrice=AvgCost/1.01;Share=Pos-share;TIF=GTC;SELL=SEND

If you want to automatically remove any previous stop that has been placed, just add this to the front:

CXL ALLSYMB;

Share this post


Link to post
Share on other sites
KSFO
On 4/26/2020 at 12:50 AM, Justin said:

You can have one hotkey to partial, cancel the current stop, and reset it with remaining position at break even.

This will sell 10% of your position when long and do the rest mentioned above:

CXL ALLSYMB;Route=LIMIT;Share=Pos*0.10;Price=Bid-0.05;TIF=DAY+;SELL=Send;ROUTE=STOP;StopType=Market;StopPrice=AvgCost;Share=Pos-share;TIF=GTC;SELL=SEND

Hi Justin, I am trying this hotkeys. It it not working. I see the order got placed, but it is not selling at all. Any things else I need to set up?

Share this post


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

Hi Justin, I am trying this hotkeys. It it not working. I see the order got placed, but it is not selling at all. Any things else I need to set up?

Ah I think it's because you're using IB Right? That was for SIM, the routes would need to be changed for IB:

CXL ALLSYMB;Route=SMRTL;Share=Pos*0.10;Price=Bid-0.05;TIF=DAY+;SELL=Send;ROUTE=STOP;StopType=Market;StopPrice=AvgCost;Share=Pos-share;TIF=GTC;SELL=SEND

Share this post


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

Ah I think it's because you're using IB Right? That was for SIM, the routes would need to be changed for IB:

CXL ALLSYMB;Route=SMRTL;Share=Pos*0.10;Price=Bid-0.05;TIF=DAY+;SELL=Send;ROUTE=STOP;StopType=Market;StopPrice=AvgCost;Share=Pos-share;TIF=GTC;SELL=SEND

This thing is a game changer. Thank you!

  • Like 1

Share this post


Link to post
Share on other sites
jpBlue

@Justin Thank you so much for the code. Works like a charm! I had to do some mods in my case:

ROUTE=STOP;StopType=Market;StopPrice=AvgCost/1.01;Share=Pos-share;TIF=DAY+;SELL=SEND

- Removed the red part. I don't know why I was not working that way.

- And I prefer the order to be DAY+. Otherwise, If I have more stops at like 2%, 3% and I want to modify them in the fly, GTC doesn't let you modify it with another button unless you cancel it manually.

So at the end my scripts look like this:

For a 1% stop of the Avg Price:

CXL ALLSYMB;Share=Pos;ROUTE=STOP;StopType=Market;StopPrice=AvgCost/1.01;TIF=DAY+;SELL=SEND;

 

 

For a 1.5% stop of the Avg Price:

CXL ALLSYMB;Share=Pos;ROUTE=STOP;StopType=Market;StopPrice=AvgCost/1.015;TIF=DAY+;SELL=SEND;

 

 

For a 2% stop of the Avg Price:

CXL ALLSYMB;Share=Pos;ROUTE=STOP;StopType=Market;StopPrice=AvgCost/1.02;TIF=DAY+;SELL=SEND;

 

Thanks again for your help. This is game changer on my side too!

 

  • Like 1

Share this post


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

Thanks again for your help. This is game changer on my side too!

Not a promlem! That's great 🙂

Share this post


Link to post
Share on other sites

[[Template core/front/global/mobileNavigation is throwing an error. This theme may be out of date. Run the support tool in the AdminCP to restore the default theme.]]

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.