It has been a while since I posted the popular basic hotkeys in part 2 and this post should be a full replacement of that post, solving some of the problems the previous solutions carry with them.
DAS Trader pro has gone a long way since then, and I believe that the old syntax has become obsolete for use in 2025. The very old syntax for dynamic hotkeys using montage fields for calculations has been obsolete since the introduction of custom variables in version 5.7.6.8 in 2023.
You do not have to change it, but I encourage you to do so sooner or later, as it will allow you to use the new features.
Why the old syntax is obsolete
Simply, the old syntax is not compatible with the new features. The main difference is that now we can call hotkeys or click on hot buttons while the montage window is not in focus. That used to be a requirement before, and there was a helper function FocusWindow that could resolve problems like drawing lines to specific charts or creating alerts, but is not ideal.
The new functions allow us to treat the windows, buttons, trend lines or alerts as objects, so we can address the specific windows in the scripts, making the scripts universal to be called from any window, as a hotkey, or hot button attached to any window, which is the new function if you missed that see below
Requirements for the new syntax
Best practice is to name the windows we need to work with, so we can create the window objects by calling their names. Typically, this is a montage window (or every montage window if you use more than just one) and the chart windows.
Example of the newer and better syntax
The old syntax for static risk hotkey with automatic stop loss order attached.
CXL ALLSYMB;
$buyprice=Ask;
$risk=20;
$mystop=price;
$pricetostop=$buyprice-$mystop;
$amount=$risk/$pricetostop;
SShare=$amount;
Share=$amount;
TogSShare;
ROUTE="LIMIT";
Price=$buyprice*1.005;
Price=ROUND2;
TIF=DAY+;
BUY=Send;
TriggerOrder=RT:STOP STOPTYPE:MARKET PX:$mystop ACT:SELL STOPPRICE:$mystop QTY:Pos TIF:DAY+;
Rewritten into the newer syntax
$MONTAGE=GetWindowObj("MONTAGE1");
$MONTAGE.CXL ALLSYMB;
$buyprice=$MONTAGE.Ask;
$risk=20;
$mystop=$MONTAGE.price;
$pricetostop=$buyprice-$mystop;
$amount=$risk/$pricetostop;
$MONTAGE.share=$amount;
$MONTAGE.ROUTE="LIMIT";
$MONTAGE.Price=Round($buyprice*1.005,2);
$MONTAGE.TIF=DAY+;
$MONTAGE.Send;
$MONTAGE.TriggerOrder=RT:STOP STOPTYPE:MARKET PX:$mystop ACT:SELL STOPPRICE:$mystop QTY:Pos TIF:DAY+;
As you can see it is not much difference in text length but is more readable and most important it is universally working whenever it is called from.
Entry hotkeys
Static risk with $20 and attached range (OCO) orders of 3R target
Future/stop order entries with static risk of $20 and attached range (OCO) orders of 3R target
Exit hotkeys
Add-up hotkeys
Change stop loss hotkeys for existing positions
Entry hotkeys
Static risk of $20 with automatic stop loss order attached
Long
$MONTAGE=GetWindowObj("MONTAGE1");
$MONTAGE.CXL ALLSYMB;
$buyprice=$MONTAGE.Ask;
$risk=20;
$mystop=$MONTAGE.price;
$pricetostop=$buyprice-$mystop;
$amount=$risk/$pricetostop;
$MONTAGE.share=$amount;
$MONTAGE.ROUTE="LIMIT";
$MONTAGE.Price=Round($buyprice*1.005,2);
$MONTAGE.TIF=DAY+;
$MONTAGE.Buy;
$MONTAGE.TriggerOrder=RT:STOP STOPTYPE:MARKET PX:$mystop ACT:SELL STOPPRICE:$mystop QTY:Pos TIF:DAY+;
Short
$MONTAGE=GetWindowObj("MONTAGE1");
$MONTAGE.CXL ALLSYMB;
$sellprice=$MONTAGE.bid;
$risk=20;
$mystop=$MONTAGE.price;
$pricetostop=$mystop-$sellprice;
$amount=$risk/$pricetostop;
$MONTAGE.share=$amount;
$MONTAGE.ROUTE="LIMIT";
$MONTAGE.Price=Round($sellprice*0.995,2);
$MONTAGE.TIF=DAY+;
$MONTAGE.Sell;
$MONTAGE.TriggerOrder=RT:STOP STOPTYPE:MARKET PX:$mystop ACT:BUY STOPPRICE:$mystop QTY:Pos TIF:DAY+;
Static risk with $20 and attached range (OCO) orders of 3R target
Long
$MONTAGE=GetWindowObj("MONTAGE1");
$MONTAGE.CXL ALLSYMB;
$buyprice=$MONTAGE.Ask;
$risk=20;
$mystop=$MONTAGE.price;
$pricetostop=$buyprice-$mystop;
$target=3*$pricetostop+Ask;
$amount=$risk/$pricetostop;
$MONTAGE.Share=$amount;
$MONTAGE.ROUTE="LIMIT";
$MONTAGE.Price=Round($buyprice,2);
$MONTAGE.TIF=DAY+;
$MONTAGE.BUY;
$MONTAGE.TriggerOrder=RT:STOP STOPTYPE:RANGEMKT LowPrice:$mystop HighPrice:$target ACT:SELL QTY:POS TIF:DAY+;
Short
$MONTAGE=GetWindowObj("MONTAGE1");
$MONTAGE.CXL ALLSYMB;
$sellprice=$MONTAGE.Bid;
$risk=20;
$mystop=$MONTAGE.price;
$pricetostop=$mystop-$sellprice;
$target=Bid-$pricetostop-$pricetostop-$pricetostop;
$amount=$risk/$pricetostop;
$MONTAGE.Share=$amount;
$MONTAGE.ROUTE="LIMIT";
$MONTAGE.Price=Round($sellprice,2);
$MONTAGE.TIF=DAY+;
$MONTAGE.SELL;
$MONTAGE.TriggerOrder=RT:STOP STOPTYPE:RANGEMKT LowPrice:$target HighPrice:$mystop ACT:BUY QTY:POS TIF:DAY+;
To set the risk to 1 % of your account equity instead of the $20 in the above hotkeys, just replace the
$risk=20;
with
$RISK=GetAccountObj($montage.account).Equity/100;
Future/stop order entries with static risk of $20 and attached range (OCO) orders of 3R target
To set the desired stop, I use a MYSTOP variable to store the price. Double-click on the chart, then press/call the hotkey:
$MONTAGE=GetWindowObj("MONTAGE1");
$MYSTOP=$MONTAGE.Price;
To set the desired entry point of a LONG position, double-click on the chart and press the hotkey:
$MONTAGE=GetWindowObj("MONTAGE1");
$MONTAGE.CXL ALLSYMB;
$MYRISK=$MONTAGE.Price-$MYSTOP;
$MYTARGET=$MONTAGE.Price+$MYRISK+$MYRISK+$MYRISK;
$MYSHARES=20/$MYRISK;
$MONTAGE.Share=$MYSHARES;
$MONTAGE.StopPrice=Price;
$MONTAGETIF=DAY+;
$MONTAGE.Route="STOP";
$MONTAGE.StopType="Limit";
$MONTAGE.Price=Price+0.05;
$MONTAGE.Buy;
$MONTAGE.TriggerOrder=RT:STOP STOPTYPE:RANGEMKT LowPrice:$MYSTOP HighPrice:$MYTARGET ACT:SELL QTY:POS TIF:DAY+;
To set the desired entry point of a SHORT position, double-click on the chart and press the hotkey:
$MONTAGE=GetWindowObj("MONTAGE1");
$MONTAGE.CXL ALLSYMB;
$MYRISK=$MYSTOP-$MONTAGE.Price;
$MYTARGET=$MONTAGE.Price-$MYRISK-$MYRISK-$MYRISK;
$MYSHARES=20/$MYRISK;
$MONTAGE.Share=$MYSHARES;
$MONTAGE.StopPrice=Price;
$MONTAGE.TIF=DAY+;
$MONTAGE.Route="STOP";
$MONTAGE.StopType="Limit";
$MONTAGE.Price=Price-0.05;
$MONTAGE.Sell;
$MONTAGE.TriggerOrder=RT:STOP STOPTYPE:RANGEMKT LowPrice:$MYTARGET HighPrice:$MYSTOP ACT:BUY QTY:POS TIF:DAY+;
Exit hotkeys
Partially exit 50% of a position and set the stop loss to break-even
For a long position, press the hotkey:
$MONTAGE=GetWindowObj("MONTAGE1");
$MONTAGE.CXL ALLSYMB;
$MONTAGE.ROUTE="SMRTL";
$MONTAGE.Price=Round($MONTAGE.BID-0.05,2);
$MONTAGE.Share=$MONTAGE.Pos*0.50;
$MONTAGE.TIF=DAY;
$MONTAGE.SELL;
$MONTAGE.ROUTE="STOP";
$MONTAGE.StopType="Market";
$MONTAGE.StopPrice=$MONTAGE.AvgCost;
$MONTAGE.Share=$MONTAGE.Pos-$MONTAGE.share;
$MONTAGE.TIF=DAY+;
$MONTAGE.SELL;
For a short position, press the hotkey:
$MONTAGE=GetWindowObj("MONTAGE1");
$MONTAGE.CXL ALLSYMB;
$MONTAGE.ROUTE="SMRTL";
$MONTAGE.Price=Round($MONTAGE.ASK+0.05,2);
$MONTAGE.Share=$MONTAGE.Pos*0.50;
$MONTAGE.TIF=DAY+;
$MONTAGE.BUY;
$MONTAGE.ROUTE="STOP";
$MONTAGE.StopType="Market";
$MONTAGE.StopPrice=$MONTAGE.AvgCost;
$MONTAGE.Share=$MONTAGE.Pos-$MONTAGE.share;
$MONTAGE.TIF=DAY+;
$MONTAGE.BUY;
Exit the whole position now
To exit the whole long position, use the hotkey:
$MONTAGE=GetWindowObj("MONTAGE1");
$MONTAGE.CXL ALLSYMB;
$MONTAGE.Route="SMRTL";
$MONTAGE.Share=$MONTAGE.Pos;
$MONTAGE.Price=round($MONTAGE.Bid*0.997,2);
$MONTAGE.TIF=DAY;
$MONTAGE.SELL;
To exit the whole short position, use the hotkey:
$MONTAGE=GetWindowObj("MONTAGE1");
$MONTAGE.CXL ALLSYMB;
$MONTAGE.Route="SMRTL";
$MONTAGE.Share=$MONTAGE.Pos;
$MONTAGE.Price=round($MONTAGE.Ask*1.003,2);
$MONTAGE.TIF=DAY+;
$MONTAGE.BUY;
Add-up hotkeys
Free roll hotkey universal for both long and short
$MONTAGE=getwindowobj("MONTAGE1");
$MONTAGE.CXL ALLSYMB;
if ($MONTAGE.PRICE>$MONTAGE.LAST)
{
$C=$MONTAGE.Bid;
$N=$MONTAGE.Pos;
$A=$MONTAGE.Price;
$S=$MONTAGE.AvgCost;
$AN=$A*$N;
$NS=$N*$S;
$ANmNS=$AN-$NS;
$CmA=$A-$C;
$X=$ANmNS/$CmA;
$MONTAGE.SHARE=$X;
$MONTAGE.Price=round($montage.Bid*0.997,2);
$MONTAGE.TIF=DAY+;
$MONTAGE.ROUTE="LIMIT";
$MONTAGE.SELL;
$MONTAGE.TriggerOrder=RT:STOP STOPTYPE:MARKET PX:$A ACT:BUY STOPPRICE:$A QTY:Pos TIF:DAY+ PREF:FLSH;
}
else
{
$C=$MONTAGE.Ask;
$N=$MONTAGE.Pos;
$A=$MONTAGE.Price;
$P=$MONTAGE.AvgCost;
$AN=$A*$N;
$NP=$N*$P;
$ANmNP=$AN-$NP;
$CmA=$C-$A;
$X=$ANmNP/$Cma;
$MONTAGE.SHARE=$X;
$MONTAGE.Price=round($MONTAGE.Ask*1.003,2);
$MONTAGE.TIF=DAY+;
$MONTAGE.ROUTE="LIMIT";
$MONTAGE.BUY;
$MONTAGE.TriggerOrder=RT:STOP STOPTYPE:MARKET PX:$A ACT:SELL STOPPRICE:$A QTY:Pos TIF:DAY+ PREF:FLSH;
}
Please update the ROUTE and PREF parameters according to your broker needs. The above example is valid for Ocean One Securities broker.
Hotkey to add up into a position while keeping the risk the same
This has been published recently as a separate post below
Change stop loss hotkeys for existing positions
Here we are limited by a non-existing reverse command with the new syntax, which will hopefully get into DAS Trader Pro soon. We need to determine the position direction first. Here is the current way to do it.
EDIT 11 April 2025: it looks like the reverse command exists after all, so below are the stops with the reverse command too.
Set stop to break-even point
To set the stop loss order to your average price (break-even point) press the hotkey:
$MYACCOUNT="YOUR ACCOUNT NAME"
$MY1MINWINDOW=GetWindowObj("MY1MIN");
$MYSYMB=$MY1MINWINDOW.SYMBOL;
$MYPOS=GetAccountObj($MYACCOUNT).getposition($MYSYMB).share;
$MONTAGE=getwindowobj("MONTAGE1");
$MONTAGE.CXL ALLSYMB;
$MONTAGE.Route="Stop";
$MONTAGE.Price=$MONTAGE.AvgCost;
$MONTAGE.StopType="MARKET";
$MONTAGE.STOPPRICE=Round($MONTAGE.AvgCost,2);
$MONTAGE.Share=$MONTAGE.Pos;
$MONTAGE.TIF=DAY;
if ($MYPOS>0)
{
$MONTAGE.SELL;
}
if ($MYPOS<0)
{
$MONTAGE.BUY;
}
with the use of Reverse command, it is more simple
$MONTAGE=getwindowobj("MONTAGE1");
$MONTAGE.CXL ALLSYMB;
$MONTAGE.Route="Stop";
$MONTAGE.Price=$MONTAGE.AvgCost;
$MONTAGE.StopType="MARKET";
$MONTAGE.STOPPRICE=Round($MONTAGE.AvgCost,2);
$MONTAGE.Share=$MONTAGE.Pos;
$MONTAGE.TIF=DAY;
$MONTAGE.SEND=Reverse;
Set stop to desired price
This is a two-step process. 1st, double-click on the price where you want your stop to be set in the chart. Then press the following hotkey:
$MYACCOUNT="YOUR ACCOUNT NAME"
$MY1MINWINDOW=GetWindowObj("MY1MIN");
$MYSYMB=$MY1MINWINDOW.SYMBOL;
$MYPOS=GetAccountObj($MYACCOUNT).getposition($MYSYMB).share;
$MONTAGE=getwindowobj("MONTAGE1");
$MONTAGE.CXL ALLSYMB;
$MONTAGE.Route="Stop";
$MONTAGE.StopType="MARKET";
$MONTAGE.STOPPRICE=Round($MONTAGE.Price,2);
$MONTAGE.Share=$MONTAGE.Pos;
$MONTAGE.TIF=DAY;
if ($MYPOS>0)
{
$MONTAGE.SELL;
}
if ($MYPOS<0)
{
$MONTAGE.BUY;
}
with the use of reverse command, it is more simple
$MONTAGE=getwindowobj("MONTAGE1");
$MONTAGE.CXL ALLSYMB;
$MONTAGE.Route="Stop";
$MONTAGE.StopType="MARKET";
$MONTAGE.STOPPRICE=Round($MONTAGE.Price,2);
$MONTAGE.Share=$MONTAGE.Pos;
$MONTAGE.TIF=DAY;
$MONTAGE.Send=Reverse;
Set a position flip order
This is the same as above, just the position is doubled, effectively flipping the position. After the order is triggered, you will have to set the new stop in any of the previously mentioned ways.
$MYACCOUNT="YOUR ACCOUNT NAME"
$MY1MINWINDOW=GetWindowObj("MY1MIN");
$MYSYMB=$MY1MINWINDOW.SYMBOL;
$MYPOS=GetAccountObj($MYACCOUNT).getposition($MYSYMB).share;
$MONTAGE=getwindowobj("MONTAGE1");
$MONTAGE.CXL ALLSYMB;
$MONTAGE.Route="Stop";
$MONTAGE.StopType="MARKET";
$MONTAGE.STOPPRICE=Round($MONTAGE.Price,2);
$MONTAGE.Share=$MONTAGE.Pos*2;
$MONTAGE.TIF=DAY;
if ($MYPOS>0)
{
$MONTAGE.SELL;
}
if ($MYPOS<0)
{
$MONTAGE.BUY;
}
with the use of reverse command, it is more simple
$MONTAGE=getwindowobj("MONTAGE1");
$MONTAGE.CXL ALLSYMB;
$MONTAGE.Route="Stop";
$MONTAGE.StopType="MARKET";
$MONTAGE.STOPPRICE=Round($MONTAGE.Price,2);
$MONTAGE.Share=$MONTAGE.Pos*2;
$MONTAGE.TIF=DAY;
$MONTAGE.Send=Reverse;
So do we have to rewrite our old scripts or will they still work and if so for how long?
Thanks Peter, this is great. Do you have a hot key script for a static risk in terms of R (%) instead of dollars? Currently trying this from Kyle's original hotkey scripts but it doesnt seem to work:
StopPrice=Price-0.01;
DefShare=BP*0.97;
Share=DefShare*0.167*Price*0.01;
Price=Ask-Price+0.01;SShare=Share/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.03 ACT:SELL STOPPRICE:StopPrice QTY:Pos TIF:DAY+;