StockFetcher Forums · Filter Exchange · Days below or above Weekly 10 EMA<< >>Post Follow-up
Honey31
8 posts
msg #161113
Ignore Honey31
modified
5/30/2024 6:03:58 PM

Hi Gurus,

I am trying to use below code but it is giving wrong results for NVDA

set{UpTrend, days ( close > Weekly EMA(10) ,250)}
set{DownTrend, days( close < weekly EMA(10) ,250)}
set{AboveorBelow4EMA, DownTrend -UpTrend } and add column AboveorBelow4EMA{AboveorBelow4EMA}


Also how to calculate how much stock moved after crossing weekly EMA(10)


xarlor
587 posts
msg #161114
Ignore xarlor
5/31/2024 8:46:04 AM

It looks like you're trying to determine how many times NVDA was above EMA(4) in the past 250 days. If that is the case, you need to use "count" not "days" ("days" returns how many days since the last occurence).

Fetcher[
symlist(NVDA)
set{UpTrend, count( close > EMA(4) ,250)}
set{DownTrend, count( close < EMA(4) ,250)}
add column separator
add column uptrend
add column downtrend
set{AboveorBelow4EMA, UpTrend - downtrend} and add column AboveorBelow4EMA{AboveorBelow4EMA}

/* Extra candy */
set{up,count(close > EMA(4),1)}
set{down,count(close < EMA(4),1)}
up > -1
down > -1
draw ema(4)
]



As for calculating how much a stock moved after a specific event, there is no way to do so with the current tools. We would need to find out when the stock crossed the EMA (can do), and then use that value to find out how much stock moved (cannot do since we cannot assign a static value to a variable).

Honey31
8 posts
msg #161115
Ignore Honey31
modified
5/31/2024 9:07:24 AM

Hi Xalor,

Apologies for wrong code. I am looking for days a stock is greater than Weekly EMA(10) bu t

below code is not working


symlist(NVDA,AMD,TSLA)
set{UpTrend, count( close > weekly EMA(10) ,250)}
set{DownTrend, count( close < weekly EMA(10) ,250)}
add column separator
add column uptrend
add column downtrend
set{AboveorBelow4EMA, UpTrend - downtrend} and add column AboveorBelow4EMA{AboveorBelow4EMA}

/* Extra candy */
set{up,count(close > weekly EMA(10),1)}
set{down,count(close < weekly EMA(10),1)}
up > -1
down > -1
draw weekly ema(10)

xarlor
587 posts
msg #161116
Ignore xarlor
5/31/2024 9:23:18 AM

Warning: trying to use weekly charts on SF will often result in incorrect data. However, in this case, it seems to behave.

Instead of specifying "weekly" within the filter, use the command "chart-display weekly". This changes every indicator within the filter to its weekly value instead of the daily value.

Fetcher[
chart-display weekly
chart-time 1 year

symlist(NVDA,AMD,TSLA)
set{UpTrend, count( close > EMA(10) ,250)}
set{DownTrend, count( close < EMA(10) ,250)}
add column separator
add column uptrend
add column downtrend
set{AboveorBelow4EMA, UpTrend - downtrend} and add column AboveorBelow4EMA{AboveorBelow4EMA}

/* Extra candy */
set{up,count(close > EMA(10),1)}
set{down,count(close < EMA(10),1)}
up > -1
down > -1
draw ema(10)
]



Honey31
8 posts
msg #161117
Ignore Honey31
modified
5/31/2024 10:09:40 AM

For tesla it is showing it is below weekly EMA 10 = -7 days where has it is above weekly 10 EMA

xarlor
587 posts
msg #161120
Ignore xarlor
5/31/2024 2:35:01 PM

Not sure what it looked like when you posted this, but right now, weekly EMA(10) is 175.4 and current weekly close is 175.7. So still in uptrend as of this post.

nibor100
1,043 posts
msg #161121
Ignore nibor100
5/31/2024 5:45:57 PM

The little known/used SF VarOffset function might do what you want in regards to, the move since crossing the 10 ema, see example below.
Ed S.

Fetcher[
set{var_ago, days(price crossed ema(10),30)} add column var_ago
and add column VarOffset(close,var_ago)
set{var1, VarOffset(close,var_ago)} add column var1
and draw price line at VarOffset(close,var_ago)
and var_ago > -1
add column close 3 days ago
symlist(tsla)
set{var2,close - var1} add column var2
set{var3,var2/var1}
set{%changeSinceCross,var3*100} add column %changeSinceCross
]



StockFetcher Forums · Filter Exchange · Days below or above Weekly 10 EMA<< >>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.