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.
How do I program a scan to ask for comparative closing values of the immediately prior day??????????
I see no way to ask for values of the prior day (or any series of prior days) in any of the scan component boxes. How then, would I program the following????
(For the daily charts) Where I want to see instances of an INCREASE in the difference between(today's closing PPO Signal Line Value - today's
closing PPO line value) and (yesterday's closing PPO Signal Line Value - yesterday's PPO Line Value)???????
(Also for the daily chats) Where I want to see instances of an INCREASE in the difference between(today's closing Minus DI - today's closing Plus DI)
and (yesterday's closing Minus DI - yesterday's closing plus DI) ??????
0
Answers
So for your first comparison, I think you can use PPO Hist. PPO Hist (Hist short for histogram - the bars extending above and below the 0 line on the indicator panel) is the difference between Line and Signal (same as MACD Hist).
So, you would test for today's Hist > yesterday's Hist.
PPO is explained here (if you need it):
https://school.stockcharts.com/doku.php?id=technical_indicators:price_oscillators_ppo
The PPO and PPO Hist syntax is here (about 2/3 down the page):
https://support.stockcharts.com/doku.php?id=scans:indicators
So it would be
[PPO Hist(12,26,9) > yesterday's PPO Hist(12,26,9)]
and [AbsVal(Minus DI(14)-Plus DI(14)) > AbsVal(yesterday's Minus DI(14)- yesterday's Plus DI(14))]
If you don't use absolute value, and you get negative numbers for the operation "DI- minus DI+", then the greater than operator ">" could give you unintended results. For instance, if yesterday's difference was +2 and today's difference is -5, that should be a hit because the distance between DI- and DI+ is greater today. But, on the number scale, +2 is greater than -5, so the scan would skip it, unless you use absval( ).
All the scan engine's functions (like AbsVal, min, max, etc.) are documented here:
https://support.stockcharts.com/doku.php?id=scans:functions
https://support.stockcharts.com/doku.php?id=scans:advanced_scan_syntax
https://school.stockcharts.com/doku.php
About half way down that page is the Scanning Resources box with links to Scanning Documentation, Scanning Tutorials and the Advanced Scan Library.
https://support.stockcharts.com/doku.php?id=scans
https://support.stockcharts.com/doku.php?id=scans:tutorials
https://support.stockcharts.com/doku.php?id=scans:library
I think it's probably most helpful to look through the sample scans first - especially the "pre-defined" scans to look for syntax you might want to use.
As for your specific question, I can't find where time offsets are documented, either. So here's how it works:
The basic format is "x time units ago" placed in front of the indicator or price, e.g. "2 days ago MACD Hist(12,26,9)".
Time units available are: days, weeks or months.
The "x" in "x time units ago" has to be a digit or digits, NOT the number spelled out, e.g. "3 days ago close ", not "three day ago close".
The exception to the digits only rule is, in the daily time frame you can say "today's" or "yesterday's". You can also say "1 day ago". But you cannot say "last month" or "this week".
ALSO if the time unit is weeks or months, you have to add a corresponding modifier before the indicator or price, e.g. "6 weeks ago weekly close", or "1 month ago monthly RSI(14)". If there is no modifier in front of the indicator or price, the scan engine ASSUMES you mean daily (so a phrase like "6 weeks ago close" may pass syntax but will give unpredictable results - it has to be "6 weeks ago weekly close". -- if you wanted the daily close from 6 weeks ago you would say "30 days ago close" - 6 weeks x 5 trading days in a week = 30 )
So here are some examples:
Monthly
and [1 month ago monthly MACD Line(12,26,9) > 2 months ago monthly MACD Line(12,26,9)]
Weekly
and [1 week ago weekly MACD Line(12,26,9) > 2 weeks ago weekly MACD Line(12,26,9)]
Daily
and [1 day ago MACD Line(12,26,9) > 2 days ago MACD Line(12,26,9)]
NOTE: The counting method for "units ago" assumes the current bar (e.g. today) is bar 0, the preceding bar is 1 bar ago (meaning 1 day ago, 1 week ago, 1 month ago) etc. Note that the "current" bar refers to the most recent final close if the markets are closed, OR, the most recent INTRADAY update if the markets are open (but, if you are running your scan when the markets are open, you can use the drop down above the scan window to specify whether to use the last close or the most recent update from the session in progress for the "current" bar).
NOTE: If you run a weekly scan on say, Wednesday, the scan engine will use the most recent update (or last daily close, if you specified that in the drop down) as the CLOSING value for the current week - even though the week is not over yet. And, the scan engine will use the most recent completed week's closing values (i.e from the preceding Friday's close) for "1 week ago weekly close" or "1 week ago weekly RSI(14)". So current week in progress is bar 0, most recent completed week is 1 bar ago. The same idea applies to monthly scans.
The consequence of this is, if you use a weekly or monthly scan as a trigger ( a signal to enter or close a position), and you run it mid week or mid month, you may get hits, but by the end of the week or month, those hits might go away as values change.
NOTE: A little off topic, but related: for some functions, like ema( ), sma( ), max( ), min( ), in addition to the modifier preceding the function, you also need to add a time frame modifier to some parameter values. For instance:
and [weekly ema(5, weekly close) x weekly ema(21, weekly close)]
...
and [weekly max(10, weekly RS(14)) > 80]