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.

Andrew Aziz

Buy/Sell Hotkeys for Automatic Stop Loss

Recommended Posts

Andrew Aziz

I am asked a lot how to buy and send an automatic STOP Loss order all in one hotkey.

 

Try this:

 

ROUTE=SMRTL;Share=BP*0.25;TIF=DAY+;Price=ASK+0.10;BUY=Send;ROUTE=STOP;StopType=Market;StopPrice=AvgCost-0.30;Share=Pos;TIF=DAY+;SELL=Send;

 

What it does?

 

It buys at 25% of your buying power, and then automatically send a stop loss order at AvgCost -30 cent.

 

You can change it anyway you want!

  • Like 9
  • Thanks 1

Share this post


Link to post
Share on other sites
Sean M

This is really cool Andrew, thanks!

Share this post


Link to post
Share on other sites
Andrew Aziz

Actually, I think it is better to run it in two different hotkeys:

 

For Long positions you can use:

 

1) ROUTE=SMRTL;Share=BP*0.25;TIF=DAY+;Price=ASK+0.10;BUY=Send

 

2) ROUTE=STOP;StopType=Market;StopPrice=AvgCost-0.30;Share=Pos;TIF=DAY+;SELL=Send;

 

In 1) you buy 25% of your buying power at market limit of 10 cents.

In 2) you put a stop loss of your position at AvgCost-30 cent

 

For Short positions you can use:

 

1) ROUTE=SMRTL;Share=BP*0.25;TIF=DAY+;Price=Bid-0.10;SELL=Send

 

2) ROUTE=STOP;StopType=Market;StopPrice=AvgCost+0.30;Share=Pos;TIF=DAY+;BUY=Send;

 

In 1) you sell short 25% of your buying power at market limit minus 10 cents.

In 2) you put a stop loss of your position at AvgCost+30 cent to cover if it hits your stop loss

 

Test in simulator and see how it works.

 

 

 

 

 

 

 

  • Like 3
  • Thanks 1

Share this post


Link to post
Share on other sites
Sean M

I love the idea of a combined buy (or short), and stop feature. The only thing I’m struggling with is that the 30 cent pad may be good for a $25 stock, but on a $2 stock 30 cents is a lot.

 

I guess you could use a LOAD command instead of SEND so you could enter a specific stop value, then hit ENTER.

 

What is more common for experienced traders, a formulaic stop, or something more specific?

Share this post


Link to post
Share on other sites
Sean M

Another idea would be to set the stop value to be a percentage of the price, rather than .30? This way it scales, based on value of the stock. I'm new to all this, so just trying to think it through.

Share this post


Link to post
Share on other sites
Sean M

Ok, so I tried this, and what I did for me (because I'm such a noob), is to set up 3 hotkeys for 25/50/100 shares, like this:

 

LONG

ROUTE=SMRTL;Share=25;TIF=DAY+;Price=ASK+0.02;BUY=Send

 

SHORT

ROUTE=SMRTL;Share=25;TIF=DAY+;Price=BID-0.02;SELL=Send

 

Then, I setup my stop like this, changing the SELL/BUY=Send command to SELL/BUY=Load, so I can hit ENTER if I like the price, or if I need to adjust I can change it and hit ENTER.

 

SELL STOP

ROUTE=STOP;StopType=Market;StopPrice=AvgCost-0.30;Share=Pos;TIF=DAY+;SELL=Load;

 

BUY STOP

ROUTE=STOP;StopType=Market;StopPrice=AvgCost+0.30;Share=Pos;TIF=DAY+;BUY=Load;

 

I'm going to run with them, and see how it goes.

  • Like 1

Share this post


Link to post
Share on other sites
Robbie Williams

Hi guys,

 

I am getting slightly confused with what my hotkeys are doing! Despite playing around for literally days I still cannot figure it out. I am using the built-in hotkeys on the montage to buy a certain amount of shares and then once I am in the trade I am wanting to add a 20 cent stop loss.

 

My code for the stop loss is : ROUTE=STOP;StopType=Market;StopPrice=AvgCost-0.20;Share=Pos;TIF=DAY+;SELL=Send;

 

However, if the stop loss doesn't get taken out and my trade goes well, I then use the built in montage hotkey to sell my position using the code: ROUTE=Market;Share=Pos;Price=Bid-.05;TIF=DAY+;SELL=Send;

 

What I am finding is that my stoploss is still in place and that if the price of the stock then subsequently goes down after I exit my position, the stop then turns into a short trade!

 

Share this post


Link to post
Share on other sites
Robbie Williams

Actually, I think I have sorted this out.

 

I have added ;CXL ALLSYMB to the end of my "SELL ALL" montage hotkey which in one click, sells your full position and removes the stoploss that was created.

 

I'm going to write a document and i'll post it on here with all the codes for specific buttons etc once i'm done

Share this post


Link to post
Share on other sites
arashid

Here is my setup which I hope you find useful. My buttons consist of 4 for buy and 4 for sell:

 

1YH4Asl.png

 

Notes:

BUY: places a limit order with 1/4 buying power and attaches a stop loss at 99% of last price at time of order. Note, the method suggested by Andrew at the very top didn't work for me and I found out that you couldn't attach a stop loss order with qty = position and price= av.cost as at the time of running the command there is no position to start with. So what I did is send two separate orders with one command, both with 1/4 buying power, one buy limit and one stop market

 

Breakeven: It first cancels any pending orders (i.e the existing stop that went with original order) and then places a stop order at average purchase price

 

Sell Half: Assuming you would do this to cash some profit (i.e you are on the profit side), it cancels any pending order, sells half the position, and then places a stop market for half the position at original purchase price.

 

Close: Sells all and cancels all pending orders

 

Same but opposite positions for the Short commands

 

 

BUY:

ROUTE=LIMIT;Price=Ask+0.05;Share=BP*0.25 ;TIF=DAY+;HANDINST=ANY;SSHARE=0 ;BUY=Send;ROUTE=STOP;StopType=Market;StopPrice=last*0.99;Share=BP*0.25;TIF=DAY+;HANDINST=ANY;SELL=SEND

 

BREAKEVEN:

CXL ALLSYMB;ROUTE=STOP;StopType=Market;StopPrice=AvgCost;Share=Pos;TIF=DAY+;HANDINST=ANY;SELL=Send

 

HALVE:

CXL ALLSYMB;ROUTE=LIMIT;Price=Bid-0.05;Share=Pos*0.5 ;TIF=DAY+;HANDINST=ANY;SSHARE=0 ;SELL=Send;ROUTE=STOP;StopType=Market;StopPrice=AvgCost;Share=Pos*0.5;TIF=DAY+;HANDINST=ANY;SELL=SEND

 

CLOSE:

ROUTE=LIMIT;Price=Bid-0.05;Share=Pos ;TIF=DAY+;HANDINST=ANY;SSHARE=0 ;SELL=Send;CXL ALLSYMB

 

 

SHORT:

ROUTE=LIMIT;Price=Bid-0.05;Share=BP*0.25 ;TIF=DAY+;HANDINST=ANY;SSHARE=0 ;SELL=Send;ROUTE=STOP;StopType=Market;StopPrice=last*1.01;Share=BP*0.25;TIF=DAY+;HANDINST=ANY;BUY=SEND

 

BREAKEVEN:

CXL ALLSYMB;ROUTE=STOP;StopType=Market;StopPrice=AvgCost;Share=Pos;TIF=DAY+;HANDINST=ANY;BUY=Send

 

HALVE:

CXL ALLSYMB;ROUTE=LIMIT;Price=Ask+0.05;Share=Pos*0.5 ;TIF=DAY+;HANDINST=ANY;SSHARE=0 ;BUY=Send;ROUTE=STOP;StopType=Market;StopPrice=AvgCost;Share=Pos*0.5;TIF=DAY+;HANDINST=ANY;BUY=SEND

 

CLOSE:

ROUTE=LIMIT;Price=Ask+0.05;Share=Pos ;TIF=DAY+;HANDINST=ANY;SSHARE=0 ;BUY=Send;CXL ALLSYMB

  • Like 4
  • Thanks 1

Share this post


Link to post
Share on other sites
mlester

All, does anyone know what the "HANDINST=ANY" statement in the above scripts means? Also, where in the manual or hotkey.pdf is that parameter described? I can't seem to find it.

 

Thanks in advance.

 

Mike

Share this post


Link to post
Share on other sites
Robert H

ANY means you're okay with the order partially filled.

 

AON means 'All or None.' In other words, fill the order completely or not at all.

  • Like 1

Share this post


Link to post
Share on other sites
mlester

Thanks for the response, Robert. I see that now after looking at the script builder. I get it. Still scratching my head about what the keyword "HANDINST" represents. Most of the keywords are pretty self explanatory. Must be one of the DAS programmer's way of saying "Partial Fill". The Script Builder also lists an "N Hold" option as well as the "ANY" and "AON" options. Any idea what "N Hold" means?

 

Mike

Share this post


Link to post
Share on other sites
Robert H

It stands for Handle Instruction. My other platform calls it Special Instructions. Not sure if there is an industry term for it.

 

I've never heard of N Hold. Try asking [email protected].

Share this post


Link to post
Share on other sites
U R

Hi Arashid,

 

This seems very helpful. I will try with my Paper account to get used to, or more precisely know how.

 

Thanks  a bunch!

 

 

Share this post


Link to post
Share on other sites
U R

@ ARASHid

 

Just realized that stop order is not 99% of original but it is 0.01 less then 1%. or less then 1% of original price?

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.