FennEdge Learn · Programming

DAS Trader Advanced Hotkey Script Course

Understand the code. Inspect the state. Verify the outcome. A detailed path through Advanced Script: language, data structures, order objects, event workflows and complete practice projects.

Plan about 1046 minutes including reading, worked examples, and each lesson exercise; actual time varies.

36Lessons≈1046Est. minutes—Sign in to save progress
25
Lesson 25 of 36 · About 30 min

DAS Composite Alerts and Variable-Driven Conditions

Separate condition evaluation, trigger policy and callback effects.

Three layers in an alert system

Prerequisite: Alert basics, timers and state machines. A composite alert needs a condition calculation, a trigger policy and a callback. Writing two AddItem calls does not, by itself, document AND/OR grouping or evaluation timing in every build. Inspect the saved Alert settings and test the truth table. For a clearly defined conjunction, calculate a global predicate in a short observation script and configure an Alert against that variable.

Compute a conjunction explicitly

Advanced Script · hypothetical inputs and local variables only. This example means value>10 AND count>=3. feComposite is the published condition; initialize it before installing any Alert that observes it.

Predicate code

$feValue = 11;
$feCountForAlert = 3;
$feComposite = 0;
if ($feValue > 10) {
    if ($feCountForAlert >= 3) {
        $feComposite = 1;
    }
}
MsgBox($feComposite);

Connect the predicate to the Alert UI

In Alerts & Triggers, select the configured global-variable condition and compare the published value with 1. The guide establishes variable-driven conditions but does not supply a portable AddItem field token for arbitrary global names, so this connection is configured in the UI. Put only a message body in the Script field at first. Record repeat, automatic removal and enable settings. Do not confuse code after Save with the callback body.

Callback body and observation policy

MsgBox("FE composite condition became eligible");

Truth table and intermediate states

value count Published predicate
9 3 0
11 2 0
10 3 0
11 3 1

This implementation briefly writes zero before recomputing one. A variable observer could see intermediate writes depending on runtime scheduling. For repeat-sensitive logic, use the explicit edge-state callback in the next project and verify scheduling in the client. Do not claim atomic publication from sequential assignments.

Exercise and worked answer

Change the condition to value>10 OR count>=3 without using an undocumented boolean operator. Answer: initialize the result to zero; set it to one in each of two independent if statements. Then test all four truth-table combinations. Keep creation, observation and cleanup as separate scripts. Use Reset followed by Save only on the practice Alert whose reference you still own.