Menu

Auto-Draw Intraday 200 EMA

Topics covered:

• Creating a dedicated Daily chart for scripting
• Adding and configuring the Daily 200 EMA
• Reading indicator values from another chart
• Using DAS objects and chart references
• Displaying values in the DAS log for testing
• Drawing custom lines on a 1-minute chart
• Automatically updating chart levels with a timer script
• Building reusable chart automation techniques



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.

onload script
This script is from a previous episode. Changes have been marked in the file so you can follow what was adjusted in this episode.

ExecHotkey("INIT");

INIT
(NEW)
(This script was introduced in this episode)

//INIT (runs only on DAS load desktop layout)
$chart_1m = GetWindowObj("chart1m");
$chart_daily = GetWindowObj("chartd");
ExecHotkey("OBJECT_INIT_TRADE");

OBJECT_INIT_TRADE
(NEW)
(This script was introduced 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 = "";

CHART script
This script is from a previous episode. Changes have been marked in the file so you can follow what was adjusted in this episode.

ExecHotkey("CHART_UPDATE");

CHART_UPDATE
(NEW)
(This script was introduced 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;
}
$TRADE.TIME_ON_TICKER = $TRADE.TIME_ON_TICKER + 1;

timer script
This script is from a previous episode. Changes have been marked in the file so you can follow what was adjusted in this episode.

ExecHotkey("TIMER");

TIMER
(NEW)
(This script was introduced in this episode)

//TIMER
if ($TRADE.TIME_ON_TICKER > 3 && $TRADE.DAILYSMA200 == 0){
    ExecHotkey("EMA200");
}

EMA200
(NEW)
(This script was introduced in this episode)

//EMA200
$TRADE.DAILYEMA200 = $chart_daily.getStudyVal("DailyEMA200");
$TRADE.DAILYSMA200 = $chart_daily.getStudyVal("DailySMA200");
$bar0 = $chart_1m.GetBar(0);

if (IsObj($chart_daily)){
    if ($TRADE.DAILYEMA200_LAST != $TRADE.DAILYEMA200){
        if (IsObj($chart_1m.GetTrendline("EMA_200"))){
            $chart_1m.GetTrendline("EMA_200").Delete();
        }

        $chart_1m.CreateTrendline("HorizLine, Price=" + $TRADE.DAILYEMA200 + ", Name=EMA_200, LineStyle=DotLine, LineWidth=5, Color=#8E7CC3, LabelTextColor=#000000, LabelBGColor=#8E7CC3");

    }

    if ($TRADE.DAILYSMA200_LAST != $TRADE.DAILYSMA200){
        if (IsObj($chart_1m.GetTrendline("SMA_200"))){
            $chart_1m.GetTrendline("SMA_200").Delete();
        }

        $chart_1m.CreateTrendline("HorizLine, Price=" + $TRADE.DAILYSMA200 + ", Name=SMA_200, LineStyle=DotLine, LineWidth=5, Color=#B4A7D6, LabelTextColor=#000000, LabelBGColor=#B4A7D6");

    }

    $TRADE.DAILYEMA200_LAST = $TRADE.DAILYEMA200;
    $TRADE.DAILYSMA200_LAST = $TRADE.DAILYSMA200;
}



//EMA200 - update button
if (IsObj($chart_1m.getCustButObj("EMA_200"))){
    if ($bar0.Close < ($TRADE.DAILYEMA200 - 0.50)){
        $chart_1m.getCustButObj("EMA_200").BkColor = Color("Green");
    } else if ($bar0.Close > ($TRADE.DAILYEMA200 - 0.25) && $bar0.Close < ($TRADE.DAILYEMA200 + 0.01)){
        $chart_1m.getCustButObj("EMA_200").BkColor = Color("Red");
    } else if ($bar0.Close < $TRADE.DAILYEMA200){
        $chart_1m.getCustButObj("EMA_200").BkColor = Color("Yellow");
    } else {
        $chart_1m.getCustButObj("EMA_200").BkColor = Color("Green");
    }
    $chart_1m.getCustButObj("EMA_200").Text = " " + Round($TRADE.DAILYEMA200,2);
}



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.



More Videos

DISCLAIMER

Episode: Auto-Draw Intraday 200 EMA

The DAS Trader Pro scripts, code examples, tools, and information provided on this website are offered solely for educational and informational purposes. Nothing on this website constitutes financial, investment, legal, tax, or trading advice.

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.

No representation or warranty is made regarding the accuracy, completeness, reliability, profitability, or suitability of any script, strategy, indicator, automation, workflow, or method presented on this website.

Execution behavior may vary based on broker, routing, market data, platform configuration, DAS Trader Pro version, account settings, market conditions, and other factors beyond the control of DayTradeCoder.

Past performance, examples, demonstrations, screenshots, or historical results are not indicative of future results and should not be relied upon as a guarantee of performance.

You are solely responsible for reviewing, understanding, testing, validating, and monitoring all code before use. All scripts should be thoroughly tested in a simulator or paper-trading environment prior to any live trading activity.

Viewing Scripts For Episode: Auto-Draw Intraday 200 EMA

You are requesting access to the script associated with this video. This acknowledgment applies only to this script.

USE AT YOUR OWN RISK.

We value your privacy

We use cookies to enhance your browsing experience, serve personalized ads or content, and analyze our traffic. By clicking "Accept All", you consent to our use of cookies.

Customize Consent Preferences

We use cookies to help you navigate efficiently and perform certain functions. Detailed information about cookies is available below.

Required for basic site functionality.