StockFetcher Forums · Filter Exchange · Need help adding counts to my filter<< >>Post Follow-up
ron22
255 posts
msg #158195
Ignore ron22
modified
12/16/2021 12:17:19 AM

Fetcher[MACD fast line(12,26,9) is above MACD slow line(12,26,9)
show stocks where the stochastic %K (14,5,3) is above the stochastic %D (14,5,3)
price is above MA(20)
symlist(spy,sqqq,tqqq,qqq,tna,tza,fas,faz,)
]



Please advise how I can add counts as follows:
1. number of days that MACD fast line is above MACD slow line
2. number of days that MACD fast line is below MACD slow line
3. number of days that stochastic %K is above %D
4. number of days that %K is below %D
5. number of days that closing price is above MA(20)
6. number of days that closing price is below MA(20)

I do not care about the count totals. I just want a red box to print on the chart for each day that each indicator is above or below criteria in items number 1-6.
If you click on a chart from the filter listed below then you can see the type of red boxes that I am referring to.
Fetcher[ apply to symlist(ABEV, AEG, GOL, drip,gush,dgaz,ugaz,dust,nugt,labd,labu,sqqq,tqqq,)
* 49 is number of consecutive days ema(4) above (+)/below(-) previous EMA(9) */
set{49b,days( ema(4) is above EMA(9) ,250)}
set{49a,days( ema(4) is below EMA(9) ,250)}
set{49, 49a - 49b} and add column 49 {49}
do not Draw 49
Set{cnt49,count( eMA(4) > eMA(9) ,1)}
draw cnt49
Set{cnt49b,count( eMA(4)< EMA(9) ,1)}
draw cnt49b
]




Thank you very much for your help in this matter.
Happy Holidays! Ron

Cheese
1,374 posts
msg #158198
Ignore Cheese
modified
12/16/2021 1:55:47 PM

https://www.stockfetcher.com/forums/Filter-Exchange/Need-help-adding-counts-to-my-filter/158195
==============================

@ron22,
Are you looking for something like this?
Good luck and Happy Holidays to you, too.

Fetcher[

/* https://www.stockfetcher.com/forums/Filter-Exchange/Need-help-adding-counts-to-my-filter/158195 */



CHART-TYPE OHLC
CHART-TIME 2 MONTHS



symlist(spy,sqqq,tqqq,qqq,tna,tza,fas,faz,DIA,IWM)


MACD fast line(12,26,9) is above MACD slow line(12,26,9)



draw MACD (12,26,9)

set{MACD_countabove,count(MACD fast line(12,26,9) is above MACD slow line(12,26,9),1)}
set{MACD_daysabove,days(MACD fast line(12,26,9) is above MACD slow line(12,26,9),250)}
draw MACD_countabove


set{MACD_countbelow,count(MACD fast line(12,26,9) is below MACD slow line(12,26,9),1)}
set{MACD_daysbelow,days(MACD fast line(12,26,9) is below MACD slow line(12,26,9),250)}
draw MACD_countbelow




show stocks where the stochastic %K (14,5,3) is above the stochastic %D (14,5,3)

draw stochastic %K (14,5,3)

set{stoch_countabove,count(stochastic %K (14,5,3) is above stochastic %D (14,5,3),1)}
set{stoch_daysabove,days(stochastic %K (14,5,3) is above stochastic %D (14,5,3),250)}
draw stoch_countabove


set{stoch_countbelow,count(stochastic %K (14,5,3) is below stochastic %D (14,5,3),1)}
set{stoch_daysbelow,days(stochastic %K (14,5,3) is below stochastic %D (14,5,3),250)}
draw stoch_countbelow




price is above MA(20)
draw MA(20)
set{ma20,ma(20)}
set{cloz,close}
draw ma20 on plot cloz

set{MA_countabove,count(price is above MA(20),1)}
set{MA_daysabove,days(price is above MA(20),250)}
draw MA_countabove


set{MA_countbelow,count(price is below MA(20),1)}
set{MA_daysbelow,days(price is below MA(20),250)}
draw MA_countbelow


ADD COLUMN MACD_daysabove
ADD COLUMN MACD_daysbelow
ADD COLUMN stoch_daysabove
ADD COLUMN stoch_daysbelow
ADD COLUMN MA_daysabove
ADD COLUMN MA_daysbelow
]




xarlor
562 posts
msg #158199
Ignore xarlor
12/16/2021 2:04:23 PM

Cheese beat me to it. I added another section that shows when all 3 are above and when all 3 are below.

Fetcher[
MACD fast line(12,26,9) is above MACD slow line(12,26,9)
show stocks where the stochastic %K (14,5,3) is above the stochastic %D (14,5,3)
price is above MA(20)
symlist(spy,sqqq,tqqq,qqq,tna,tza,fas,faz,)

set{MACD_above,count(MACD Fast Line(12,26,9) is above MACD Slow Line(12,26,9),1)}
set{MACD_below,count(MACD Fast Line(12,26,9) is below MACD Slow Line(12,26,9),1)}

MACD_above > -1
MACD_below > -1

set{STO_above,count(Stochastic %K(15,5,3) is above Stochastic %D(15,5,3),1)}
set{STO_below,count(Stochastic %K(15,5,3) is below Stochastic %D(15,5,3),1)}

STO_above > -1
STO_below > -1

set{Close_above,count(close above MA(20),1)}
set{Close_below,count(close below MA(20),1)}

Close_above > -1
Close_below > -1

set{All_above1,MACD_above * STO_above}
set{All_above,All_above1 * close_above}
set{All_below1,MACD_below * STO_below}
set{All_below,All_below1 * close_below}

all_above > -1
all_below > -1
]



Cheese
1,374 posts
msg #158200
Ignore Cheese
12/16/2021 2:26:18 PM

https://www.stockfetcher.com/forums/Filter-Exchange/Need-help-adding-counts-to-my-filter/158195
======================

Good idea, xarlor.

BTW, ron
I think xarlor also added value to the great TRENDSUM filter that Kevin_in_GA gifted to you a while ago.

ron22
255 posts
msg #158201
Ignore ron22
modified
12/16/2021 4:17:39 PM

@cheese and xarlor. Thank you both so much! That is exactly what I was looking for. Also, the "all above "

boxes will make back- testing a lot easier. I did not know that that was possible. You are both talented and give freely of your time to help me and so many others on this forum.

StockFetcher Forums · Filter Exchange · Need help adding counts to my filter<< >>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.