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.

Defining an uptrend in a scan

Hi,

I would like to define my uptrend scan in a way that it scans for stocks that have their 20 day ma above the 50 day ma for the entire period of x days (for example 50 days). What would be the best way to scan for this? So what I want is to have the 20 day MA above the 50 day ma the ENTIRE time of the lookback period.

Thanks!

Akroma

Best Answers

  • gordgord admin
    Accepted Answer
    You could use the following code if you need an SMA.

    [type = Stock]
    and [ SMA(20,close) > SMA(50,close) ]
    and [ 1 days ago SMA(20,close) > 1 days ago SMA(50,close) ]
    and [ 2 days ago SMA(20,close) > 2 days ago SMA(50,close) ]
    and [ 3 days ago SMA(20,close) > 3 days ago SMA(50,close) ]
    // ETC ETC

    Or if you can use an EMA then we can use the MACD which calculates the difference between two EMA's. When the MACD line is above zero, the EMA20 is above EMA50. Then just use the min over time function to ensure the lowest value over the lookback period (50 trading days) is greater than zero.

    [type = Stock]
    and [Min (50, MACD Line(20,50,9) ) > 0.0]
  • markdmarkd mod
    edited March 2015 Accepted Answer
    Just a note: PMO is not calculated exactly like the MACD, although it's similar. PPO is exactly analogous.

Answers

  • Thanks using the PMO line will work just as well as MACD I assume?
Sign In or Register to comment.