StockFetcher Forums · Filter Exchange · count<< >>Post Follow-up
ludowillems
111 posts
msg #149724
Ignore ludowillems
12/1/2019 12:16:31 PM

Dear members,
I look for candles where :high > ma(180) and low < ma(180).
The low of the day was below the MA and the High above the MA on that same day . That works.
Now I'd like the number of times this happenend in the last n days, and display a column with the results.
How do you formulate this?
Thanks for your time,
ludo


xarlor
587 posts
msg #149725
Ignore xarlor
12/1/2019 12:36:05 PM

Note: count limit is 100.

Fetcher[
close > 1

set{hi,count(high > ma(180),1)}
set{lo,count(low < ma(180),1)}
set{trigger,hi * lo}
trigger > 0

set{hits,count(trigger > 0,100)}

add column hits
draw ma(180)
sort column 5 descending
]



arenas
14 posts
msg #149728
Ignore arenas
12/1/2019 4:52:27 PM

Hello, Here is another scan when after a down trend a doji candlestick appears in an oversold Stochastic and the next day is a gap up. def down = if high[1] < low[1] and high[2] < low and high[3] < low [3] < 3 and high[4] < low and high[5] < low [5] then 1 else 0; def doji = if open[1] == close[1] then 1 else0; def stoch = if StochasticFast().OverSold[1] is true then 1 else 0; def gap = open > high[1] plot scan = if down and doji and stoch and gap then 1 else 0;

ludowillems
111 posts
msg #149737
Ignore ludowillems
modified
12/2/2019 5:34:33 AM

Thanks xarlor and arenas for your time.
I added my trigger conditions to the filter (found this code here on the forum). The final decision to enter could be the slope of the MA(180).
All I want is a green day after the trigger day !
I wonder if there is a way to backtest this ?
Fetcher[

show stocks where CCI(20) crossed above 0
and CCI(20) 2 days ago was below -100
and show stocks where volume above 500000
show stocks where average volume(30) is more than 500000
and show stocks where close above $5
close > ma(180)
open < ma(180)

set{hi,count(close > ma(180),1)}
set{lo,count(open < ma(180),1)}
set{trigger,hi * lo}
trigger > 0

set{hits,count(trigger > 0,220)}
add column hits
sort column 5 descending
]



PS: the filter works also with 220 days !?

ludowillems
111 posts
msg #149738
Ignore ludowillems
12/2/2019 7:57:13 AM

adding " 5 day slope of ma(180) > 0" eliminates some false signals.

Fetcher[


show stocks where CCI(20) crossed above 0
and CCI(20) 2 days ago was below -100
and show stocks where volume above 500000
show stocks where average volume(30) is more than 500000
and show stocks where close above $5
close > ma(180)
open < ma(180)
5 day slope of ma(180) > 0

set{hi,count(close > ma(180),1)}
set{lo,count(open < ma(180),1)}
set{trigger,hi * lo}
trigger > 0

set{hits,count(trigger > 0,220)}
add column hits
sort column 5 descending
]



xarlor
587 posts
msg #149749
Ignore xarlor
12/2/2019 12:02:23 PM

You're right, count limit is 252 (1 year in trading days). Change it to 253 or higher and it breaks.

Fetcher[
symlist(SPY)
set{var1,count(close > 1,100)}
set{var2,count(close > 1,101)}
set{var3,count(close > 1,252)}

add column var1
add column var2
add column var3
]



StockFetcher Forums · Filter Exchange · count<< >>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.