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 581 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).
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 581 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.
|
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 581 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,031 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.
|