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.
Scan to Hit off Multiple Timeframes
Hi -Is there a way for a single scan to hit off multiple time frames? Ex: Looking for certain criteria on a weekly but then also need other filled on a daily?
0
Comments
You would have to keep in mind that (as far as I know) a scan run mid-week with weekly timeframe conditions will consider that day the end of the current week.
So, you have to be clear in your own mind what what you are asking for, and how to interpret the results as a valid hit, and whether it is what you asked for.
A way to keep it simple would be to run a scan for weekly conditions, but those conditions in a list, then run a daily scan against the list.
1. Rising 26 week EMA (26 period EMA close 0 weeks ago > 26 period EMA close 1 week ago).
2. Falling 13 week EMA and falling MACD histogram 12,26,9 (looking to exclude this condition?)
3. Price is currently between or below two moving averages, a 13 day EMA and 26 day EMA specifically.
4. 13 day EMA is falling and MACD histogram rising or 13 day EMA rising and MACD histogram falling
5. Two day force below zero
I'd be surprised if you could do it at all on the standard bench.
I would recommend you work out the or logic first before writing any code. You could do that by setting up the brackets, then writing the conditions in plain english (meaning in pseudo code).
So for price between or below the emas it might start like this:
// begin example
....
and
[ // open btwn-blw
// btwn
or
// blw
] // close btwn-blw
...
// end example
Then work out between.
// begin example
...
[ // open btwn-blw
// btwn
[ // open btwn
[ price blw ema 1]
and [price above ema 2]
] // close btwn
or
// blw
] // close btwn-blw
...
// end example
And so on.
If you need help with syntax, here's a link to a previous answer with my quick and dirty summary of the rules:
http://scan.stockcharts.com/discussion/comment/4308#Comment_4308
If you get lost, post what you have and we'll work on it.
and [[today's close is <= daily EMA(13, daily close) and today's close >= daily EMA (26, daily close) or today's close is <= daily EMA (26, daily close)]]
I think my second "and" condition inside the brackets is throwing off the results, but I'm not sure how to fix it. Would be curious to get your thoughts on this?
I think this is what you want:
and
[
[
[today's close is <= daily EMA(13, daily close)]
and [today's close >= daily EMA (26, daily close)]
]
or
[ today's close is <= daily EMA (26, daily close)]
]
You have to put brackets around each condition - a condition means "term 1 - operator - term 2".
Your formulation has several conditions inside one pair of brackets.
Also, if you want two or more conditions to be evaluated together, you have to put an extra pair of brackets around them. In this case, your "between" statement requires that two conditions are both true, so they get an "extra" pair of brackets around them.