Buy the Breakout
The script(s) featured in this episode are provided below for educational and reference purposes. Trading stocks, options, futures, and other financial instruments involves substantial risk of loss and is not suitable for all investors. You may lose some or all of your invested capital. Always review and thoroughly test any code in a simulator before using it in a live trading environment.
This video is provided by YouTube. It is blocked until you accept functional cookies.
Important!
Some of these scripts may also rely on scripts created in previous episodes. Any
updates to scripts will be shown below, but any scripts left unchanged would need to
be sourced from the episode they were featured in. It is recommended to watch all
videos in this series in order, that way you can piece together a working system
with a good understanding of all the connected parts.
OBJECT_INIT_TRADE
This script is from a previous episode. Changes have been marked in the file so you can follow what was adjusted in this episode.
//OBJECT_INIT_TRADE
if (GetVar("$TRADE")==0) $TICKER=0;
if (!IsObj($TRADE)) $TRADE = newUserObj();
$TRADE.DAILYEMA200 = 0;
$TRADE.DAILYEMA200_LAST = 0;
$TRADE.DAILYSMA200 = 0;
$TRADE.DAILYSMA200_LAST = 0;
$TRADE.TIME_ON_TICKER = 0;
$TRADE.CHART_LAST_SYMB = "";
$TRADE.LAST_PL = 1234;
$TRADE.LAST_SHARES = 0;
$TRADE.LAST_GAIN_LOSS = 0;
$TRADE.LAST_AVERAGE = 0;
$TRADE.LAST_PER_SHARE = 0;
//+ ADDED THE FOLLOWING LINES
$TRADE.BUY_AT_TARGET = 0;
$TRADE.BUY_SPREAD = 0.10;
OBJECT_LOAD_TIME (NEW) (This script was introduced in this episode)
//OBJECT_LOAD_TIME
if (GetVar("$TIME")==0) $TIME=0;
if (!IsObj($TIME)) $TIME = newUserObj();
$TIME.SECONDS = GetSecond();
$TIME.TIME_MINUTES_SECONDS = $TIME.SECONDS / 60;
$TIME.TIME_MINUTES = Round($TIME.TIME_MINUTES_SECONDS,0);
$TIME.ONLY_SECONDS = $TIME.SECONDS - (($TIME.TIME_MINUTES - 1) * 60);
$TIME.TIME_HOURS=$TIME.SECONDS/3600;
if ($TIME.TIME_HOURS > 9.5 && $TIME.TIME_HOURS < 16) {
$TIME.REGULAR_HOURS=1;
} else {
$TIME.REGULAR_HOURS=0;
}
BUY_AT_TARGET_SET (NEW) (This script was introduced in this episode)
//BUY_AT_TARGET_SET
if ($TRADE.BUY_AT_TARGET == 0 || $TRADE.BUY_AT_TARGET != $montage_window.price){
$TRADE.BUY_AT_TARGET = $montage_window.price;
} else {
$TRADE.BUY_AT_TARGET = 0;
}
CHART_UPDATE
This script is from a previous episode. Changes have been marked in the file so you can follow what was adjusted in this episode.
//CHART_UPDATE (runs every time chart object updates data)
if ($TRADE.CHART_LAST_SYMB != $chart_1m.SYMBOL){
$TRADE.CHART_LAST_SYMB = $chart_1m.SYMBOL;
$TRADE.TIME_ON_TICKER = 0;
$TRADE.DAILYSMA200 = 0;
$TRADE.DAILYEMA200 = 0;
MsgLog("Changed Ticker: " + $chart_1m.SYMBOL);
ExecHotkey("DETECT_STOCK_COUNTRY");
$TRADE.BUY_AT_TARGET = 0;
}
$TRADE.TIME_ON_TICKER = $TRADE.TIME_ON_TICKER + 1;
CHART_TIMER_DRAW_BUY_TARGET
This script is from a previous episode. Changes have been marked in the file so you can follow what was adjusted in this episode.
//CHART_TIMER_DRAW_BUY_TARGET
if (IsObj($chart_1m.GetTrendline("ChartTimerBuyTargetLine" + $chart_1m.SYMBOL))){
$chart_1m.GetTrendline("ChartTimerBuyTargetLine" + $chart_1m.SYMBOL).Delete();
}
if ($TRADE.BUY_AT_TARGET != 0){
$chart_1m.CreateTrendline("HorizLine, Price=" + $TRADE.BUY_AT_TARGET + ", Name=ChartTimerBuyTargetLine" + $chart_1m.SYMBOL + ", LineStyle=DashDotLine, LineWidth=5, Color=#81B5E3, LabelTextColor=#000000, LabelBGColor=#81B5E3");
}
if (IsObj($DASHBOARD.getCustButObj("BuyAtValue"))){
$DASHBOARD.getCustButObj("BuyAtValue").Text = $TRADE.BUY_AT_TARGET;
}
if (IsObj($DASHBOARD.getCustButObj("BUY"))){
if ($TRADE.BUY_AT_TARGET == 0){
$DASHBOARD.getCustButObj("BUY").Text = " BUY @ Ask";
} else {
$DASHBOARD.getCustButObj("BUY").Text = " BUY @ Target";
}
}
TIMER_BUY_TARGET
This script is from a previous episode. Changes have been marked in the file so you can follow what was adjusted in this episode.
//CHART_UPDATE (runs every time chart object updates data)
if ($TRADE.CHART_LAST_SYMB != $chart_1m.SYMBOL){
$TRADE.CHART_LAST_SYMB = $chart_1m.SYMBOL;
$TRADE.TIME_ON_TICKER = 0;
$TRADE.DAILYSMA200 = 0;
$TRADE.DAILYEMA200 = 0;
MsgLog("Changed Ticker: " + $chart_1m.SYMBOL);
ExecHotkey("DETECT_STOCK_COUNTRY");
$TRADE.BUY_AT_TARGET = 0;//+ ADDED THIS LINE
}
$TRADE.TIME_ON_TICKER = $TRADE.TIME_ON_TICKER + 1;
TIMER
This script is from a previous episode. Changes have been marked in the file so you can follow what was adjusted in this episode.
//TIMER
ExecHotkey("OBJECT_LOAD_TIME");
if ($TRADE.TIME_ON_TICKER > 2 && $TRADE.DAILYEMA200 == 0){
//EMA200 comes from daily chart
ExecHotkey("EMA200");
}
$bar0 = $chart_1m.GetBar(0);
ExecHotkey("ANALYZE_MACD");
ExecHotkey("DASHBOARD");
ExecHotkey("TIMER_PL_UPDATE");
ExecHotkey("TIMER_BUY_TARGET");//+ ADDED THIS LINE
ExecHotkey("CHART_TIMER_DRAW_BUY_TARGET");//+ ADDED THIS LINE
BUY_ASK (REWRITTEN) This script was changed considerably from it's previous version.
//BUY_ASK
$shares_to_buy = Round($DASHBOARD.getCustButObj("SHARES").Text,0);
$montage_window.Share=$shares_to_buy;
if ($TRADE.BUY_AT_TARGET > 0){
if ($TRADE.BUY_AT_TARGET >= $montage_window.ASK){
$montage_window.Price=$TRADE.BUY_AT_TARGET + $TRADE.BUY_SPREAD;
} else {
$montage_window.Price=$TRADE.BUY_AT_TARGET;
}
$montage_window.StopPrice=$TRADE.BUY_AT_TARGET;
$montage_window.Route="STOP";
if ($TIME.REGULAR_HOURS == 1){
$montage_window.StopType="Limit";
} else {
$montage_window.StopType="LimitP";
}
} else {
$montage_window.Route="Limit";
$montage_window.Price=$montage_window.ASK;
}
$montage_window.ACCOUNT=$ACCOUNT_NUMBER;
$montage_window.TIF=DAY+;
$montage_window.BUY=SEND;
$TRADE.BUY_AT_TARGET = 0;
Disclaimer:
This is an independent project and is not affiliated with or endorsed by DASTrader.com.
The tool is currently under development and intended for educational and experimental purposes only,
including improving the experience of working with DAS hotkey scripting (e.g., code validation,
highlighting, and structure).
It does not execute trades, provide trading signals, or offer financial advice. Any scripts created or used
with DAS Trader remain the sole responsibility of the user.
Trading involves significant risk. You are fully responsible for verifying all scripts, commands, and
behavior before using them in a live trading environment.
This tool is provided “as-is” with no guarantees of accuracy, completeness, or reliability. Use at your own
risk. Always test thoroughly in a simulator before live trading.