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.

connor

Hotkey Question - Execute Order with Simultaneous Bracket Order

Recommended Posts

connor

Hello Everyone,

I was curious how to make a hotkey script to do the following:

Enter a Buy or Sell order and at the same time have a bracket order entered.

Example.... I buy the stock and there is a 1:1 risk/reward of +-$0.20. If it goes up 20 cents it exits me out for profit. if it goes down 20 cents it stops me out for a loss. 

I have searched the forums, internet, and tried it myself without avail. 

I am in the Das simulator and was not sure if this is the issue but I would like to see how people set this script up either way. 

Thank you for any help.

 

 

Share this post


Link to post
Share on other sites
KyleK29

There are a few completed scripts that do just that. You might find the following thread useful in terms of getting started, in the Excel there's a few Range Order examples that may fit the bill.

DAS - Dynamically Calculate Shares on %Risk or $Risk - Hot Key + Configuration, Updated 9/10/19, v2.1 - DAS Trader Pro Tips and Tricks - Bear Bull Traders Forums


---------------------------------------------------------
Profile / Project Pages (Dynamic Hotkeys, StreamDeck Files, and other contributions are located here)

Share this post


Link to post
Share on other sites
Korey R. Snead
On 5/10/2021 at 7:05 PM, connor said:

Hello Everyone,

I was curious how to make a hotkey script to do the following:

Enter a Buy or Sell order and at the same time have a bracket order entered.

Example.... I buy the stock and there is a 1:1 risk/reward of +-$0.20. If it goes up 20 cents it exits me out for profit. if it goes down 20 cents it stops me out for a loss. 

I have searched the forums, internet, and tried it myself without avail. 

I am in the Das simulator and was not sure if this is the issue but I would like to see how people set this script up either way. 

Thank you for any help.

 

 

Kyle has a hotkey to enter a range after with an additional key, but are you want to know if it's possible to have your entry order key trigger a range order?

 

Share this post


Link to post
Share on other sites
Dogu

Setting up DAS hotkeys, including sending a buy order that automatically triggers a stop loss with or without a profit target

Here's a DAS Trader doc on how to set up some basic hotkeys, including one that sends a buy order that automatically triggers an OCO bracket order w a stop loss and a target: (Need to make sure that if a stop loss order is triggered but not yet executed, and then we sell manually instead, the stop order is automatically cancelled. Otherwise it could end up triggering a short position that we didn't want. Anyone happen to know if this is the case?)

I've put them into a user-friendly format below, and annotated a little, but you can refer to  the original here: https://dastrader.com/docs/how-do-i-use-hotkeys/

Buy Limit Order

‘ROUTE=LIMIT;Price=Ask-0.5;Share=100;ACCOUNT=ACCTNUMBER;TIF=DAY+;BUY=Send’

Sell Market Order

‘ROUTE=MARKET;Share=Pos;ACCOUNT=ACCTNUMBER;TIF=DAY+;SELL=Send’

OTO (One Triggers Other) and OCO (One Cancels Other) Orders

(OTO) Limit order triggering a Stop Limit Order. This script will send a limit order to buy 100 shares at Ask+0.10. When the limit (primary) order is filled, it will trigger a Stop Limit Order for 20 cents below entry (Note: The trigger price decides when the stop limit order will be active, and limit price decides what price the order will be filled.)

‘ROUTE=SMRTL;Price=Ask+0.10; Share=100;TIF=DAY+; BUY=Send;TriggerOrder=RT:STOP STOPTYPE:LIMIT STOPPRICE:AvgCost2-.20 PX:AvgCost2-.20 ACT:SELL QTY:POS TIF:DAY+’

(OTO) Limit Order triggering a Stop Market Order. This script will send a limit order to buy 100 shares at Ask+0.10. When the limit (primary) order is filled, it will trigger a Stop Market Order with the trigger/stop price at 20 cents below entry.

‘ROUTE=SMRTL;Price=Ask+0.10; Share=100;TIF=DAY+; BUY=Send;TriggerOrder=RT:STOP STOPTYPE:MARKET STOPPRICE:AvgCost2-.20 ACT:SELL QTY:POS TIF:DAY’

(OTO, OCO) Limit Order triggering a Stop Range Order. This script will send a limit order to buy 100 shares at Ask+0.10. When the limit (primary) order is filled, it will trigger a Stop Range Order. (Note: If it is a SELL Range Order, when the order is triggered by LowPrice, it will become a Market Order; if it is triggered by HighPrice, it will become a Limit Order. If it is a BUY Range Order, when the order is triggered by LowPrice, it will become a Limit Order; if it is triggered by HighPrice, it will become a Market Order.)

‘ROUTE=SMRTL;Price=Ask+0.10; Share=100;TIF=DAY+; BUY=Send;TriggerOrder=RT:STOP STOPTYPE:RANGE LowPrice:AvgCost2-.10 HighPrice:AvgCost2+.20 ACT:SELL QTY:POS TIF:DAY+’

(OTO) Limit Order triggering a Stop Trailing Order. This script will send a limit order to buy 100 shares at Ask+0.10. When the limit (primary) order is filled, it will trigger a Stop Trailing Order with 10 cents trailing on it (as the price goes up, the trailing stop will follow it up staying 10 cents under it (but staying in place whenever the price goes down).

‘ROUTE=SMRTL;Price=Ask+0.10; Share=100;TIF=DAY+; BUY=Send;TriggerOrder=RT:STOP STOPTYPE:TRAILING STOPPRICE:0.10 ACT:SELL QTY:POS TIF:DAY+’

(OTO) Limit Order triggering a Limit Order above. This script will send a limit order to buy 100 shares at Ask+0.10. When the limit (primary) order is filled, it will trigger a Limit Order for 20 cents above entry.

‘ROUTE=SMRTL;Price=Ask+0.10; Share=100;TIF=DAY+; BUY=Send;TriggerOrder=RT:LIMIT PX:AvgCost2+0.20 ACT:SELL QTY:POS TIF:DAY+’

(OTO) Limit Order triggering an immediate Market Order (I don't know when this would be used unless you see something popping and want to get in and out in microseconds to guarantee a profit however small -- i.e., beat the market maker bots at their own game). This script will send a limit order to buy 100 shares. When the limit (primary) order is filled, it will trigger a Market Order.

‘ROUTE=SMRTL;Price=Ask+0.10;Share=100;TIF=DAY+; BUY=Send;TriggerOrder=RT:MARKET ACT:SELL QTY:POS TIF:DAY+’

As cautioned in the original document, we should try these first in simulation and use at our own risk (and reward 🙂)

 

 

Edited by Dogu
another typo

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.