StockFetcher Forums · General Discussion · Weekly +di(14) << >>Post Follow-up
volvlov
32 posts
msg #148004
Ignore volvlov
6/1/2019 10:35:38 PM

I am interesting in seeing when the weekly +di moving average starts to move up. The script below works for the day but SF does not like the syntax for the weekly, i.e. "set {x,weekly +di(14)}". I think it hates the + sign. Any thoughts?

set {x,+di(14)}
set {xx,cema(x,15)}
set {y,-di(14)}
set {yy,cema(y,15)}
set {xm1, value of xx 1 day ago}
set {del,xx-xm1}
del crossed above 0
draw del line at 0
draw xx
draw yy on plot xx

KSK8
545 posts
msg #148007
Ignore KSK8
6/2/2019 10:21:27 AM

Should work.

Fetcher[

set{pos,+DI(14)}
set{neg, -DI(14)}

set{x,weekly pos}
set{xx,cema(x,15)}
set{y,weekly neg}
set{yy,cema(y,15)}
set{xm1, value of xx 1 day ago}
set{del,xx-xm1}
del crossed above 0
draw del line at 0
draw xx
draw yy on plot xx

]

volvlov
32 posts
msg #148012
Ignore volvlov
6/2/2019 8:24:55 PM

Thank you for the help!

Mactheriverrat
2,983 posts
msg #148013
Ignore Mactheriverrat
modified
6/2/2019 10:17:34 PM

One question is if your looking at Weekly +di(14). Wouldn't you want to look at it from a weekly chart?

Chart-display is weekly

Village Elder
231 posts
msg #148015
Ignore Village Elder
6/2/2019 10:33:10 PM

The SF syntax here needs to be modified to make sure it works as you want:

"Note:

When using the +DI or -DI inside set statements, you'll want to use PDI (for +DI) and MDI (for -DI)."

use weekly pdi(14) and weekly mdi(14) when referencing these indicators within a user defined function (e.g., the set{} statement).

 bushynose22 postsmsg #148018- Ignore bushynose 6/3/2019 12:59:32 AM Fetcher[ set {x,weekly pdi(14)} set {xx,cema(x,15)} set {y,weekly mdi(14)} set {yy,cema(y,15)} set {xm1, value of xx 1 day ago} set {del,x-xm1} del crossed above 0 draw del line at 0 draw xx draw yy on plot xx draw adx] Fetcher[ set {x,weekly pdi(14)} set {y,weekly mdi(14)} set {xm1, value of x 1 day ago} set {del,x-xm1} del crossed above 0 draw del line at 0 draw x draw y on plot x draw adx]
volvlov
32 posts
msg #148027
Ignore volvlov
6/3/2019 8:41:04 PM

Perfect. Thanks everyone! Yes, I should be looking at weekly here. I will probably end up with daily and weekly elements in the same filter and look at the results side by side in TradingView. I'm still very new here and learning.

 StockFetcher Forums · General Discussion · Weekly +di(14) << >>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.