Basic set of hotkeys for DAS Trader pro

Now that we have our DAS Trader Pro application prepared for advanced scripting, let’s use it for some automated calculations and placing orders.

Entry hotkeys

For simplicity, the following hotkeys use rounding to 2 decimals, which means that they are meant for symbols priced over $1. For sub-dollar symbols, rounding to 4 decimals is needed. They also use the default route LIMIT, so if special routing is needed, it needs to be adjusted in the hotkey or with one of the methods I will be describing in later articles.

Always test your hotkeys in simulator account first. After that, with a small amount/risk with live account.

Although DAS Trader Pro provides a replay mode, the following hotkeys are not meant for replay mode.

The scripts provided below can be used as hotkeys

or as hot buttons

or as window buttons

The provided scripts below can be written in one line or with shorter variable names for space efficiency, but I tried to write them in a human friendly way so it is clear what is going on in each line.

Static risk of $20 with automatic stop loss order attached

These hotkeys require double-clicking into the chart – that defines where the stop loss order will be placed. Then they calculate the number of shares needed for a $20 risk, will enter with a limit order with a threshold of 0.5% for the price. After the order will be filled completely, they will place a stop loss order at the price where we clicked

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+;    

The adjustable parameters are the risk in line 4 or the limit price offset and rounding in line 10.

Static risk with $20 and attached range (OCO) orders of 3R target

Long

Short

$MONTAGE=GetWindowObj("MONTAGE1");
$MONTAGE.CXL ALLSYMB;
$sellprice=$MONTAGE.Bid;
$risk=20;
$mystop=$MONTAGE.price;
$pricetostop=$mystop-$sellprice;
$target=$montage.Bid-$pricetostop-$pricetostop-$pricetostop;
$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:RANGEMKT LowPrice:$target HighPrice:$mystop ACT:BUY QTY:POS TIF:DAY+;

These work the same as the above with the difference that they place a range order (also known as OCO order) for stop loss and profit taking at 3R. The adjustable parameters are the risk in line 4, target in line 7

% of equity risk

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 enter a prepared trade with a defined risk at a certain price, we need to define the stop loss price and the stop entry price. It is a 2-step process, so 2 hotkeys are needed.

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;

This hotkey is universal to both long and short entries.

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=$Montage.Price;
$MONTAGE.TIF="DAY+";
$MONTAGE.Route="STOP";
$MONTAGE.StopType="Limit";
$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=$MONTAGE.price;
$MONTAGE.TIF="DAY+";
$MONTAGE.Route="STOP";
$MONTAGE.StopType="Limit";
$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 an existing long position, press the hotkey:

$MONTAGE=GetWindowObj("MONTAGE1");
$MONTAGE.CXL ALLSYMB;
$MONTAGE.ROUTE="SMRTL";
$MONTAGE.Price=Round($MONTAGE.BID*0.995,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 an existing short position, press the hotkey:

$MONTAGE=GetWindowObj("MONTAGE1");
$MONTAGE.CXL ALLSYMB;
$MONTAGE.ROUTE="SMRTL";
$MONTAGE.Price=Round($MONTAGE.ASK*1.005,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;