All I need is a simple code to screen for when the price crosses the 200 day moving average – either bullish or bearish. I haven’t a clue.
Try this one:
x = 0
Avg200 = Average[200](close)
IF (close CROSSES OVER Avg200) OR (close CROSSES UNDER Avg200) THEN
x = 1
ENDIF
SCREENER [x] (x AS "criterium")
Roberto
Thanks Roberto. I added a volume screen to it. Not sure it’s the right one but it’s a start. Looking for breakouts bullish or bearish from just above the 100 day moving average or 200 day. Preferably when these moving averages are “flat” against the price on the charts.
x = 0
Avg100 = Average[100](close)
IF (close CROSSES OVER Avg100) OR (close CROSSES UNDER Avg100) THEN
x = 1
ENDIF
SCREENER [x] (x AS “criterium”)
v = volume
count = 0
for i = 1 to 75 do
if v>volume[i] then
count=count+1
endif
next
condition = count/75>0.9
screener [condition] (count/75 as “percentage”)
You cannot use the keyword SCREENEDR more than once, so you have to combune your condition to make only one screener and, unfortunately, you can only use one sortinfg criterium:
x = 0
Avg100 = Average[100](close)
IF (close CROSSES OVER Avg100) OR (close CROSSES UNDER Avg100) THEN
x = 1
ENDIF
v = volume
count = 0
for i = 1 to 75 do
if v>volume[i] then
count=count+1
endif
next
condition = count/75>0.9
//SCREENER [x] (x AS “criterium”)
screener [x AND condition] (count/75 as “percentage”) //you may use OR, instead but only x OR condition as criterium