No Average Down
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;
$TRADE.BUY_AT_TARGET = 0;
$TRADE.BUY_SPREAD = 0.10;
$TRADE.ALLOW_AVERAGE_DOWN = 0;//+ ADDED THIS LINE
BUY_BY_RULES
This script is from a previous episode. Changes have been marked in the file so you can follow what was adjusted in this episode.
//BUY_BY_RULES
$TRADE.OK_TO_BUY_THIS = 1;
$TRADE.STICK_TO_PLAN_TEXT = "";
//3 losses check
$tmp_var_name = "$loss" + $chart_1m.SYMBOL;
if (GetVar($tmp_var_name)==0) SetVar($tmp_var_name, 0);
$this_symbol_loss = GetVar($tmp_var_name);
if ($this_symbol_loss >= 3){
$TRADE.OK_TO_BUY_THIS = 0;
$TRADE.STICK_TO_PLAN_TEXT = $TRADE.STICK_TO_PLAN_TEXT + "," + $chart_1m.SYMBOL + " Losses 3";//+ ADDED/ADJUSTED THIS LINE
}
//+ ADDED THE FOLLOWING 9 LINES
//dont average down
if ($TRADE.ALLOW_AVERAGE_DOWN == 0){
if ($montage_window.POS > 0){
if ($montage_window.AVGCost > $montage_window.ASK){
$TRADE.OK_TO_BUY_THIS = 0;
$TRADE.STICK_TO_PLAN_TEXT = $TRADE.STICK_TO_PLAN_TEXT + "," + " No Average Down";
}
}
}
if ($TRADE.OK_TO_BUY_THIS == 1){
//your buy script here
ExecHotkey("BUY_ASK");
} else {
Speak("Stick to Rules");//+ ADDED/ADJUSTED THIS LINE
}
if ($TRADE.STICK_TO_PLAN_TEXT != ""){//+ ADDED/ADJUSTED THIS LINE
MsgLog($TRADE.STICK_TO_PLAN_TEXT);
}//+ ADDED/ADJUSTED THIS LINE
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.