DAS Trader Advanced Hotkeys part 31
Alerts as OCO orders working in extended hours trading
The current version of DAS Trader Pro as of writing is 5.8.0.6, so I recommend you to try it with that version at least.
I will be referring to the previous articles with some hotkeys created there, so please read those as well for deeper explanation on how those hotkeys work.
Many traders use OCO (One Cancels Other) range orders for trading. Being a stop order type traditionally, it does not work in pre-market and after-market hours session.
The goal is to have a range order capability in extended hours trading.
It is a very simple 3-step process in general
The stop and target definition we have already from the previous post
CXL ALLSYMB;
$buyprice=Ask;
$risk=20;
$mystop=price;
$pricetostop=$buyprice-$mystop;
$target=3*$pricetostop+Ask;
$amount=$risk/$pricetostop;
Share=$amount;
TogSShare;
ROUTE="SMRTL";
Price=$buyprice;
Price=ROUND2;
TIF=DAY+;
BUY=Send;
TriggerOrder=RT:STOP STOPTYPE:RANGEMKT LowPrice:$mystop HighPrice:$target ACT:SELL QTY:POS TIF:DAY+;
Now we need to replace the trigger order line with 2 alerts that will execute on the price reached scenario and cancel the other alert.
The alerts in manual mode
Let’s say we opened a Long position on AAPL with an average price of $228, and we want the stop loss to be at $227 and our target is $230.
Assuming we have our montage variable object named $montage and our hotkey to exit a position is named Sell100, the simple alerts to sell our shares of AAPL at the price above $230 or below $227 looks like this
The alert deletes itself on trigger with the Auto Delete checkbox, also with the AlrtDelAll hotkey, the other alert is deleted.
Automatic alert creation hotkey
Now, to automate the process of creating these alerts, we need a hotkey that will create them. We can do one universal hotkey for both long and short positions because there is no difference in the execution, we just need to call different hotkey for exit. We do this by checking if the target is above the stop or below.
Keep reading with a 7-day free trial
Subscribe to Peter’s Substack to keep reading this post and get 7 days of free access to the full post archives.