smartguy 47 posts msg #149933 - Ignore smartguy |
12/19/2019 6:00:32 PM
How would I code this condition- "SPY has closed BELOW its 10-day simple
moving average for at least 10 days". Thanks in advance for any help with this.
|
Village Elder 231 posts msg #149934 - Ignore Village Elder |
12/19/2019 6:28:10 PM
Out of the last x days?
Try this:
This will trigger when the SPY close has been below the MA(10) last each of the last 10 days
Or maybe you want something like this:
In this case, all that is required is that the SPY close below its MA(10) on at least 10 of the last 20 days, with no requirement as to when or in any order. Hope this helps.
|
smartguy 47 posts msg #149935 - Ignore smartguy |
12/19/2019 6:34:35 PM
That was very helpful, and thank you for such a fast response. One more followup question. Instead of SPY, say I wanted a list of ETF's.This is actually only one line of what I am trying to accomplish, and I would like to be able to apply to all ETF's, or at least a list of actively traded ones. How would I change what you shared? Thanks again.
|
push5280 201 posts msg #149936 - Ignore push5280 modified |
12/19/2019 6:48:25 PM
|
smartguy 47 posts msg #149937 - Ignore smartguy modified |
12/19/2019 6:56:14 PM
yes, but I want the ETF to be the one tracked,not always the SPY. Meaning I want each ETF that closed BELOW its 10-day simple moving average for at least 10 days not just in relation to SPY. I want a list of ETF's that satisfy the condition. I used SPY simply as an example of an ETF.
|
xarlor 587 posts msg #149938 - Ignore xarlor |
12/19/2019 7:44:42 PM
Last 10 consecutive daays:
Any 10 out of last 20 days. Or replace 20 with how many days you want to look back:
|
smartguy 47 posts msg #149939 - Ignore smartguy |
12/19/2019 8:54:50 PM
Right on, that's the ticket. Thank you
|