New Members: Be sure to confirm your email address by clicking on the link that was sent to your email inbox. You will not be able to post messages until you click that link.
Hi everybody,
I'm trying to create a simple Scan. The 21-day moving average was greater than 5% BELOW the 50 day moving average four weeks ago, and, It is Less than 3% Away from it, Today.
Who can write this scan?
*(Would be Ever Better if the four weeks ago part can look for any day of that WEEK and same for the Today part, if anyone is that Skilled.)
my Hope is to make this 'Absolute value'? i.e. I can "flip it, and apply it to bullish scenarios...
0
Comments
When you say "greater than 5% below the 50 day moving average", can the 21 MA be ABOVE the 50 MA? Above the 50 is also greater than 5% below. Or do you want it between (less than) the MA and 5% less than the MA?
"less than 3 per cent away today" - same thing - does that mean 3% below the 50 MA or 3% above the 50 MA, or either, or just below?
Also, when you say four weeks ago, do you mean 20 trading days ago (four weeks x 5 trading days) ?
As far as looking for "any day that week" - you wouldn't really want to code that, since the number of trading days ago for each day in that week would vary depending on the day of the current week that you run the scan. Better to write the scan for one day in the past, then use the scan start date to get results for other days.
Same, it was greatly-Below in mid-to-Late May... then less percentage Below in mid-June.
[group is sp500] // or whatever you want
// MA 50 falling 20 days ago
and [20 days ago sma(50, close) < 30 days ago sma(50, close)]
// 20 days ago, MA 21 more than 5% below MA 50
and [20 days ago sma(21, close) < 20 days ago sma(50,close) * .95]
// MA 50 still falling today
and [sma(50,close) < 10 days ago sma(50, close)]
// today, MA 21 below MA 50
and [sma(21,close) < sma(50,close)]
// today, MA 21 above 3% below MA 50
and [sma(21, close) > sma(50,close) * .97]
One last tweak: Is there any way of saying the 21 day MA can be Either WITHIN 3% Above the 50 day MA -Or- WITHIN 3% Below the 50 day? Like +/- of up to 3%, in each direction?
// today, MA 21 above 3% below MA 50 or less than 3% above
// begin "or" statement
and [
[sma(21, close) > sma(50,close) * .97]
or
sma(21,close) < sma(50,close) * 1.03]
]
// end "or" statement
Distance from a moving average.
Default for filters:
and [DistFromSMA(200) > 0]
and [DistFromEMA(200) > 0]
A positive distance is ABOVE the trendline requested. A negative distance is BELOW the trendline.
You can modify the value of the period and the distance. You can use the indicator in a Rank By as well. Rank By [DistFromSMA(200)]
You can also add modifiers to it [DistFromSMA(200,low) < 0] for example
I've only played a little with this one so don't have a feel for how adding a more complex modifiers actually work or not. But it is a new feature added to the Workbench. They also added the values for several fixed SMA's into the Summary view available columns.
Going to take me a Little while to Digest this, and apply some various variations
I am almost certain that I will use your last post, markd, and apply it to Other indicators.
At any rate, thank you Both, so much!!! What a great Timesaver!