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.
This is a two part question. Apologies, but I have not found this info searching through the online doc.
1) What does the UPTREND mean as coded? Peak to trough direction, I hope. which also begs the sidebar, when does it trigger as a broken trend? across what timeframe? Timeframe is hugely important. Hours? Months? How is that controlled in scan parameters?
2) OK, I'm happy to simply with an upward price slope. I want to scan for stocks, for example, that are in a 5 year uptrend and are still in an uptrend for the most recent year, but are now turned down in for some period of time, e.g. 1 month. How can I code for that? I might assume you could diff an average value like an SMA from 5 years ago and the same SMA recently. How do I get the the SMA(50,close) from 1250 days ago?
0
Comments
https://scan.stockcharts.com/discussion/1797/uptrend-is-true#latest
There is no generally accepted definition of "uptrend". It means "generally rising", but there is no official definition for how long or how much prices have to rise to establish an up trend, or how far they have to fall to break the uptrend.
So, that means it's up to you.
I think the time frame and sma/ema length you should be interested in depends on the kind of trading you want to do.
If you are a day trader, you probably want to look at a one minute or five minute chart, and you want to chose an sma or ema length that stays fairly close to prices without getting crossed by lows (in an uptrend), or the highs (in a down trend) until prices actually turn down or turn up. You just have to experiment with that, and it may differ for different stocks and etfs.
If you are a swing trader (you want to catch the middle part of an up leg or down leg), you would use a daily chart with maybe a 20 period ema/sma and maybe a 3 period ema/sma and trade the crossovers.
If you are a position trader (you want to ride an uptrend, holding through the down legs) you might want to use maybe a 50 ema/same and a 10 or 20 ema/sma, trading the crossovers.
If you are an investor (you want to hold a position for the long term), you look at the 50 and 200 ema/smas, buying when the 50 crosses above the 200, and selling on a cross below.
Of course there are lots of variations and refinements of these methods to improve the timing of entries and exits.
As for deciding when an individual ema/sma is turning up or turning down, that too is subjective. For instance, you might decide that an sma/ema has turned down when the current value is below the past ema/sma value from one tenth the length of the ema/sma. So for instance, if the sma200 is lower than the sma200 value from 20 days ago, you would say prices are starting a long term down trend. For the 50, it would be lower than 5 days ago. You could also just use price crossovers, e.g. a close below the rising sma200 would be the start of a long term down trend. But often, sma/emas are support and prices turn back up again soon after crossing the ema/sma.
As for scanning, instructional material is here:
https://stockcharts.com/docs/doku.php?id=scans
It will take some time to pick it up, but its worth it if you have ideas beyond the predefined scans here:
https://stockcharts.com/docs/doku.php?id=reports:predefined-scans:customizing