Sometimes the unpredicted is happening, and we need to act before we understand what is going on. In those cases, many traders want to close all the positions quickly.
Regular Hours
For regular hours there is one simple command, which is called PANIC. Its usage is simple
PANIC;
It can be a hotkey, a hot button, a window button, or a conditional script call.
By default this command often comes pre-configured in the default DAS Trader Pro installation on a hotkey shortcut Shift+Escape.
However, the command does not work in pre-market and after-market trading hours. It is made to use market orders. For extended hours trading, but honestly for any time of day trading, we can use a script to close all the positions at once in a very similar way.
Both extended hours and regular hours
For extended hours trading, we need a bit more complicated script, but it is universal for anyone. I call it the true panic hotkey, as it fills in the missing space of the simple PANIC hotkey.
To use this script, you need:
- A recent version of DAS Trader Pro (version 5.8.1.6 at least).
- Advanced Hotkeys enabled in your settings and a named montage window as described in this blog.
How It Works
Once called, the command performs the following steps automatically:
- Scans for all open positions
It checks all symbols you have traded today (up to a limit of 9999 positions for DAS Trader Pro version 5.8.2.5 or newer). - Identifies shares
It cycles through each symbol and checks your current position size. - Determines the trade direction
It detects whether you are LONG or SHORT for the position. - Clears the orders
It cancels all open orders for those symbols. - Adjusts rounding
For stocks trading under $1, it automatically rounds the price to four decimal places. - Exits the positions
It triggers an exit for every position using your preferred route.
Here is the True panic hotkey
// name your montage window and set it here
$montage=getwindowobj("Montage1");
// set your exit route
$MYROUTE="LIMIT";
$IROW=0;
$TOTAL=GetAccountObj($montage.account).getallpositions().total+1;
while($IROW<$TOTAL)
{
if(isobj(GetAccountObj($montage.account).getallpositions().get($IROW)))
{
$montage.symbol=GetAccountObj($montage.account).getallpositions().get($IROW).SYMBOL;
$MYPOS=GetAccountObj($montage.account).getposition($MONTAGE.Symbol).share;
if ($MYPOS==0)
{}
else
{
$MONTAGE.CXL ALLSYMB;
if ($MYPOS>0)
{
$Montage.price=$montage.last*0.98;
}
else
{
$Montage.price=$montage.last*1.02;
}
if ($MONTAGE.price>=1)
{
$MONTAGE.Price=Round($Montage.price,2);
}
else
{
$MONTAGE.Price=Round($Montage.price,4);
}
$MONTAGE.ROUTE=$MYROUTE;
$MONTAGE.Share=$MONTAGE.POS;
$MONTAGE.Send=Reverse;
}
}
$IROW=$IROW+1;
}You can set this up as a Hotkey, a Hot Button, or a Window Button. The script is also flexible - you can easily modify it to use different routing options based on the time of day or other specific needs in the $MYROUTE line. This hotkey uses a limit order to exit with a price offset of 2% up or down from the current price. This can be adapted in the $montage.price lines.
For more advanced scripting, you can visit my Substack - Peter's Substack where I elaborate on the newest features, ideas and do custom solutions for specific needs.
Author: PeterB
Disclosure Statement 1. Hotkey scripts should always be thoroughly tested in a paper trading environment prior to any live deployment. Guardian Trading assumes no responsibility for errors, malfunctions, or financial losses arising from the use, misuse, or modification of custom hotkey configurations. Traders are solely responsible for the creation, testing, and implementation of their own scripts.This guide is provided for informational and educational purposes only and does not constitute trading advice or an endorsement of any specific configuration. The examples herein are illustrative in nature and should not be copied, replicated, or relied upon without independent verification and testing. Use of this material constitutes acknowledgment and acceptance of these terms.
2. No information provided by Velocity Clearing, LLC (“Velocity” or the “Firm”), directly or indirectly, should be considered a recommendation or solicitation to adopt any particular trading or investment strategy or to invest in, or liquidate, a particular security or type of security. Information provided by Velocity on its Twitter, Facebook or Blog pages is for informational and educational purposes only and is not intended as a recommendation of any particular security, transaction or strategy. Commentary and opinions expressed are those of the author/speaker and not necessarily those of the Firm. Velocity does not guarantee the accuracy of, or endorse, the statements of any third party, including guest speakers or authors of commentary or news articles. All information regarding the likelihood of potential future investment outcomes are hypothetical. Future results are never guaranteed. Any examples that discuss potential trading profits or losses may not take into account trading commissions or fees, which means that potential profits could be lower and potential losses could be greater than illustrated in any example. Users are solely responsible for making their own, independent decisions about whether to use any of the research, tools or information provided, and for determining their own trading and investment strategies.

