|
Query: Summarize Results of a LET |
|
Notes:
#
# this query will summarize occurrences across let iterations
#
#
INITIALIZE
#
# initialize these variables so they will be persistant over all LET iterations
#
numEvents = 0
AND
sumMoves = 0
AND
numPosEvents = 0
AND
sumPosEvents = 0
AND
numNegEvents = 0
AND
sumNegEvents = 0
#
# This will show the summary numbers
#
FINAL SHOW
numEvents: numEvents
avgMove: sumMoves / numEvents
pctPos: numPosEvents / numEvents * 100
pctNeg: numNegEvents / numEvents * 100
numPos: numPosEvents
avgPos: sumPosEvents / numPosEvents
numNeg: numNegEvents
avgNeg: sumNegEvents /
numNegEvents
#
# 1: set theSym with the list of symbols over which to iterate
#
LET
theSym = Index_SP500
DO
numEvents = numEvents + 1
AND
#
# 2: set theAttr with the attribute that is to be summarized
#
theAttr = percent_move from today to 1 month later of Close of theSym
#
#
AND
IF
theAttr is DEFINED
THEN
sumMoves = sumMoves + theMove
AND
IF
theAttr is more than 0
THEN
numPosEvents = numPosEvents + 1
AND
sumPosEvents = sumPosEvents + theMove
ENDIF
AND
IF
theAttr is less than 0
THEN
numNegEvents = numNegEvents + 1
AND
sumNegEvents = sumNegEvents - theMove
ENDIF
ENDIF
#
# 3: replace the statement below with your when condition
#
WHEN
1 day percent_move of theSym is more than 10
|