StockFetcher Forums · General Discussion · Rookie here<< >>Post Follow-up
2 posts
msg #155899
Ignore pawloskijr
2/21/2021 10:53:51 AM

Hey guys I have been tinkering around with stock fetcher but I just really suck at coding. I was wondering if anyone on a Sunday would be willing to try and assist me in writing a code that I wanna try for trading this week that basically does something like this.....

trading above 180 SMA (i think this is just price is above MA(180))

Has a candle that closed above the MA 9 3-4 days ago (I don't know how to code this)

shows crossover of MACD line over signal line (no idea how to code this either)

If anyone is willing to help me I would appreciate it!

938 posts
msg #155902
Ignore nibor100
2/21/2021 11:20:22 AM

Your first 2 lines are not that far off; and all of the coding info you want for this filter is easily spotted in the various code snippets shown under the Examples tab at the top of the SF web page.

Just a couple of hints:

In SF, SMA (simple moving average) is expressed as MA() for close prices and CMA() (Custom Moving Avg) for all other indicators/variables.

The closing price of any candle is the same as the close of the day, so you don't really have to worry about coding candles, though I believe the SF user manual does show how to do that.

If you still can't get it to work, post what you have come up with and I'm sure someone will edit a solution for you.

Ed S.

2 posts
msg #155903
Ignore pawloskijr
2/21/2021 11:24:58 AM

Thank you. I'm basically trying to find a way to detect a stock that has MACD over signal line, and has 1-3 days worth of closing prices over a MA(9). Basically I'm trying to catch that price crossing over the MA9 early (within 1-3 days). I know how to set up charts for these indicators and read them but I'd like to make a screener to do it for me haha. I was using FinViz but their 20/50/200 MA just doesn't cut it for me.

119 posts
msg #155916
Ignore olathegolf
2/21/2021 11:39:09 PM

I agree with nibor, you will learn fastest if you give coding a try yourself using the many SF examples and other filters posted by members. If you hit a wall, post your code and there are many here that will assist. .
That said, here's one interpretation.

close above 1
average volume(30) above 200000
/*trading above 180 SMA*/
close above ma(180)
/*Has a candle that closed above the MA 9 3-4 days ago */
/*Assume you're looking for crossover at 3-4 days. If not, remove "crossed"*/
set{close1,count(close 3 days ago crossed above ma(9) 3 days ago,1)}
set{close2,count(close 4 days ago crossed above ma(9) 4 days ago,1)}
/*addition acts as an OR function*/
close3 above 0
/*MACD Crossover*/
set{macd_xover,count(MACD Fast Line(12,26,9) crossed above MACD Slow Line(12,26,9),1)}
macd_xover equals 1
draw ma(9)
draw close3
draw macd_xover
draw macd(12,26,9)

31 posts
msg #156073
Ignore lis
3/9/2021 10:34:35 AM

It can be a bit intimidating at first, for sure!

Here's a link to the user guide PDF. That might help you learn as well! It's pretty easy to read and search.

StockFetcher Forums · General Discussion · Rookie here<< >>Post Follow-up

*** Disclaimer *** 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. does not recommend particular securities., 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.