StockFetcher Forums · General Discussion · Fibonacci screener << 1 2 3 >>Post Follow-up
 freedom_trader7777 postsmsg #149298- Ignore freedom_trader777 10/6/2019 7:04:04 PMHey everyone, I'm trying to write a screen that finds stocks that came within 3% of a Fib-level, previous day close, then pulled back. Can someone help out me with the phrasing if it's possible?
xarlor
246 posts
msg #149299
Ignore xarlor
modified
10/6/2019 9:26:39 PM

Not exactly what you asked for, but I made a filter that shows a bounce off a 52-week Fibonacci line.

Fetcher[
average volume(30) > 1234567
chart-time is 1 year
/* Set the Fib values at 23.6%, 38.2%, 50%, and 61.8%*/

set{Hi,high 1-year high}
set{Lo,low 1-year low}
set{Vdiff,Hi - Lo}
set{x1,Vdiff * .236}
set{x2,Vdiff * .382}
set{x3,Vdiff * .50}
set{x4,Vdiff * .618}
set{x5,Vdiff * .786}
set{Fib1, Hi - x1}
set{Fib2, Hi - x2}
set{Fib3, Hi - x3}
set{Fib4, Hi - x4}
set{Fib5, Hi - x5}

/* Check if price touched any of the Fib lines 1 day ago while that candle's body is above the Fib line */

set{touch1a,count(low 1 day ago <= Fib1,1)}
set{touch1b,count(close 1 day ago > fib1,1)}
set{touch1c,count(open 1 day ago > fib1,1)}
set{touch1d,touch1a * touch1b}
set{Touch1,touch1c * touch1d}

set{touch2a,count(low 1 day ago <= Fib2,1)}
set{touch2b,count(close 1 day ago > fib2,1)}
set{touch2c,count(open 1 day ago > fib2,1)}
set{touch2d,touch2a * touch2b}
set{Touch2,touch2c * touch2d}

set{touch3a,count(low 1 day ago <= Fib3,1)}
set{touch3b,count(close 1 day ago > fib3,1)}
set{touch3c,count(open 1 day ago > fib3,1)}
set{touch3d,touch3a * touch3b}
set{Touch3,touch3c * touch3d}

set{touch4a,count(low 1 day ago <= Fib4,1)}
set{touch4b,count(close 1 day ago > fib4,1)}
set{touch4c,count(open 1 day ago > fib4,1)}
set{touch4d,touch4a * touch4b}
set{Touch4,touch4c * touch4d}

set{touch5a,count(low 1 day ago <= Fib5,1)}
set{touch5b,count(close 1 day ago > fib5,1)}
set{touch5c,count(open 1 day ago > fib5,1)}
set{touch5d,touch5a * touch5b}
set{Touch5,touch5c * touch5d}

set{z1,Touch1 + Touch2}
set{z2,z1 + Touch3}
set{z3,z2 + Touch4}
set{Trigger,z3 + Touch5}
Trigger > 0

/* The bounce: Green day following a 3-day declining close */
close > high 1 day ago
close 1 day ago < close 2 days ago for last 3 days

draw price line at hi
draw price line at Fib1
draw price line at Fib2
draw price line at Fib3
draw price line at Fib4
draw price line at Fib5
draw price line at lo

do not draw Trigger

/* Debugging

add column close 1 day ago
*/
]

ron22
172 posts
msg #149307
Ignore ron22
10/7/2019 11:40:49 AM

xarlor, Great filter. What do you recommend for entry trigger and exit trigger? Thanks a lot.

sandjco
549 posts
msg #149308
Ignore sandjco
10/7/2019 12:19:06 PM

I think SF has FIB as well...

Fetcher[etf
Average Volume(30) > 100000

Fibonacci Down(89,13) is below 0.24 within the last 5 days
]

for sure, I have zero coding skills...so, pardon the suggestion. Maybe it helps.

xarlor
246 posts
msg #149309
Ignore xarlor
10/7/2019 2:38:36 PM

@ron22
Rules are pretty mechanical:

Enter at the close.
Initial stop loss set 0.06 below the Fib line it just bounced off of.
Profit target is next Fib line above. Note this is also your next resistance point, so may have to exit and take profits if it looks like it's bouncing off without clearing.
If you're feeling frisky, you can let a winner run beyond that Fib line and try for the next Fib line.

I haven't backtested it. Maybe something for nibor to do during Monday Night Football? :D

@sandjco
I did see the SF Fibonacci filters, but they were too vague/loose for my likes. It's a good starting point, like all the indicators on SF, but I needed something more granular.

sandjco
549 posts
msg #149311
Ignore sandjco
10/7/2019 3:12:26 PM

@xarlor
no worries; guys like you who can code SF well are gems for the community!

hope you didn't take my comment the wrong way.

Cheese
641 posts
msg #149312
Ignore Cheese
10/7/2019 4:41:11 PM

xarlor and everyone,
Since you guys are pretty good at this stuff,
any suggestions to better guess bull traps, bear traps, head fakes,
to get to safer entries and exits?
Thanks,

ron22
172 posts
msg #149315
Ignore ron22
10/7/2019 11:10:12 PM

xarlor, Thank you for the filter and for the trigger ideas. ron

nibor100
473 posts
msg #149675
Ignore nibor100
11/24/2019 1:54:48 PM

@xarlor,

In my efforts to make your Fibonacci screener filter backtest I've had to do some changes to your filter to remove complexity so the my backtest will execute.

One of your filter lines that is causing complexity issues is the following:

close 1 day ago < close 2 days ago for last 3 days

When I try to simplify it to the following 3 lines:

close 1 day ago < close 2 days ago
close 2 days ago < close 3 days ago
close 3 days ago < close 4 days ago

I get slightly different results, a few more hits with my simplified 3 line version but missing some of the results from your original version, yet looking at the graphs all stocks returned by either version seem to meet the criteria.

Here is my test filter:

Fetcher[
average volume(30) > 1234567

close > high 1 day ago
close 1 day ago < close 2 days ago /*for last 3 days*/
close 2 days ago < close 3 days ago
close 3 days ago < close 4 days ago
]

Any ideas?
Ed S.

xarlor
246 posts
msg #149676
Ignore xarlor
11/24/2019 5:44:54 PM

@nibor, it appears to be some wonkiness with SF. Most of the extra tickers your filter displays have candle bodies of less than 0.01. Most of these are obviously penny and micro stocks, but not all of them. In this sense your filter is more accurate than mine.

Still if you want to match my filter as closely as possible, you can eliminate these. It still does not mirror the filters perfectly but it's a lot closer. Plus, it gets rid of micro stocks too.

Fetcher[

average volume(30) > 1234567

close 1 day ago < close 2 days ago
close 2 days ago < close 3 days ago
close 3 days ago < close 4 days ago

set{Body1,open - close}
set{Body,abs(Body1)}

Body 2 days ago > 0.01
Body 3 days ago > 0.01

]

 StockFetcher Forums · General Discussion · Fibonacci screener << 1 2 3 >>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.