StockFetcher Forums · General Discussion · Looking for code showing number of days a MA or EMA is up or down<< >>Post Follow-up
Mactheriverrat
3,153 posts
msg #123803
Ignore Mactheriverrat
5/18/2015 4:24:38 AM

Looking for code that I can add in as a column using say a moving average is up day 1 from the day before



four
5,087 posts
msg #123811
Ignore four
modified
5/18/2015 5:35:28 PM

Looking for code that I can add in as a column using say a moving average is up day 1 from the day before

set{up, count(ma(3) > ma(3) 1 day ago,1)}
add column up > 0
draw ma(3)

Mactheriverrat
3,153 posts
msg #123816
Ignore Mactheriverrat
5/19/2015 5:16:01 AM

Thanks Four!

four
5,087 posts
msg #123818
Ignore four
5/19/2015 1:04:36 PM

:)

Mactheriverrat
3,153 posts
msg #123820
Ignore Mactheriverrat
5/19/2015 1:43:35 PM

I went back to some code for tracking how many up days or down days a stock has been up or down. I used the EMA(4) as a example as a price may close red but the EMA(4) will still be in a uptrend.
here is the code

CxC is number of consecutive days ema(4) above (+)/below(-) previous ema(4) and set{CCb,days(ema(4) is above ema(4) 1 day ago,100)}
set{CCa,days(ema(4) is below ema(4) 1 day ago,100)} set{CxC, CCa - CCb} and add column CxC {C_x_C}

do not draw CxC

StockFetcher Forums · General Discussion · Looking for code showing number of days a MA or EMA is up or down<< >>Post Follow-up

*** Disclaimer *** StockFetcher.com does not endorse or suggest any of the securities which are returned in any of the searches or filters. They are provided purely for informational and research purposes. StockFetcher.com does not recommend particular securities. StockFetcher.com, Vestyl Software, L.L.C. and involved content providers shall not be liable for any errors or delays in the content, or for any actions taken based on the content.


Copyright 2022 - Vestyl Software L.L.C.Terms of Service | License | Questions or comments? Contact Us
EOD Data sources: DDFPlus & CSI Data Quotes delayed during active market hours. Delay times are at least 15 mins for NASDAQ, 20 mins for NYSE and Amex. Delayed intraday data provided by DDFPlus


This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.