StockFetcher Forums · Filter Exchange · Help with this filter<< 1 2 >>Post Follow-up
graftonian
1,089 posts
msg #154407
Ignore graftonian
10/22/2020 2:58:21 PM

All you coding geniuses, I need some help. I want to show all occurrences of "Trigger = 3", however, I'd like those stocks with the first occurence of "Trigger = 3" to be displayed first. I believe my problems lie in the last two sections of the code.
Please and Thanx, Graf

Fetcher[
/*Hull Moving average cross/ Schaff Trend Cycle/ Volume increase
****************************Basic Criteria*********************/
not OTCBB
average volume(30) greater than 50000
close between .50 and 200
close greater than close 1 day ago
sort on column 5 descending
/**********************The Rules*****************
Buy on the first current occurance of Trigger = 3
Sell on Price cross below H50 or Price below 3 day "count back line",
whichever is higher.
/*****************************HULL50MA***********************/
set{slow1, cwma(close, 25)}
set{slow2, 2 * slow1}
set{slow3, cwma(close, 50)}
set{valslow, slow2 - slow3}
set{H50, cwma(valslow, 7)}
DRAW H50 ON PLOT PRICE
/******************************HULL10MA**********************/
set{slow1A, cwma(close, 5)}
set{slow2A, 2 * slow1A}
set{slow3A, cwma(close, 10)}
set{valslowA, slow2A - slow3A}
set{H10, cwma(valslowA, 3)}
DRAW H10 ON PLOT PRICE
/*********************SCHAFF TREND CYCLE**********************/
set{range, MACD (23,50,9) 10 day high - MACD (23,50,9) 10 day low}
set{var2, MACD (23,50,9) - MACD (23,50,9) 10 day low}
set{var3, var2 / range}
set{var6, cema(var3, 3) 10 day high}
set{var5, cema(var3, 3) 10 day low}
set{var7, cema(var3, 3) - var5}
set{var8, var6 - var5}
set{var9, var7 / var8}
set{var10, cema(var9, 3)}
set{STC, 100 * var10}
draw STC
draw STC line at 25
draw STC line at 75
/******************Volume % above 30 day average**************/
set{VolX, volume / CWMA(volume, 21)}
draw CWMA(volume, 21)

/*********HullMA cross count*****/
set{HullCrossCount, count(H10 above H50, 1)}
draw HullCrossCount
/******STC crossed 25 count******/
set{STCcrosscount, count(STC above 25, 1)}
draw STCcrosscount
/**********Volume % count********/
set{VolCount, count(VolX greater than 1.2, 1)}
draw VolCount
/************Sum the count calculations (trigger)**************/
set{trig1, HullCrossCount + STCcrosscount}
set{trigger, trig1 + VolCount}
/******Display results********/
add column trigger
trigger equals 3
do not draw trigger
]




nibor100
1,010 posts
msg #154409
Ignore nibor100
10/22/2020 4:40:18 PM

The 2 simple lines I was adding to solve your issue apparently makes your filter too complex to run on my Advanced subscription, so I'll wait a bit and see if anyone else solves it before I start reconstructing your posted filter to make it less complex so I can add those 2 lines and have it run.

Ed S.

graftonian
1,089 posts
msg #154411
Ignore graftonian
10/22/2020 5:43:40 PM

@Ed, I only have the $8.95 monthly subscription, and I've come this far; too far to turn back now.
Thanx, Graf

nibor100
1,010 posts
msg #154415
Ignore nibor100
10/23/2020 2:10:02 AM

@ graftonian,

Since you have a magical basic subscription that allows you to run filters that are too complex for any other basic subscribers to run, here are the 2 statements I would add for you to go ahead and try:

add column trigger 1 day ago
sort column 6 ascending

By the way, I just checked on another computer and the filter you posted in this thread actually requires the advanced subscription to run. So I am curious, did you ever try the advanced subscription and then go back to the basic?

Thanks,
Ed S.

graftonian
1,089 posts
msg #154416
Ignore graftonian
10/23/2020 9:19:48 AM

@Ed

Thanx for the reply. I have tried the route you suggested to no avail. Also tried creating additional variables,
SF does not tolerate any time shifting of the trigger variable. I have also created additional nonsense code
after the problem area, and SF will run that, so sheer size is not the problem.
Thanx again,
Graf

xarlor
561 posts
msg #154417
Ignore xarlor
10/23/2020 9:25:02 AM

It's weird. Any time I try to add a statement that contains "trigger 1 day ago" the filter breaks. As in it doesn't return any results. Take the line away and results come back.

I've tried the following:


trigger 1 day ago equals 0

add column trigger 1 day ago

count(trigger 1 day ago < 1,1) equals 1


They all break. Yours works nibor100?

graftonian
1,089 posts
msg #154419
Ignore graftonian
10/23/2020 10:24:56 AM

@Xarlor

I appreciate your attempts to help on this problem.

Graf

graftonian
1,089 posts
msg #154420
Ignore graftonian
10/23/2020 7:32:25 PM

Found another "glitch''

In the following code:

/*********HullMA cross count*****/
set{HullCrossCount, count(H10 above H50, 1)}
draw HullCrossCount

"H10 above H50" can be replaced by "H10 crossed above H50", however,

/******STC crossed 25 count******/
set{STCcrosscount, count(STC above 25, 1)}
draw STCcrosscount

"STC above 25" cannot be replaced with "STC crossed above 25"

nibor100
1,010 posts
msg #154425
Ignore nibor100
10/24/2020 7:36:10 PM

I don't have a working solution yet, as the centerpiece of the problem is how many levels of nesting are in the Schaff Trend Cycle (STC) portion of the filter. But I do enjoy a puzzle!

Seems like once past 10 levels of nest, complexity issues start to arise....

Ed S.



Mactheriverrat
3,132 posts
msg #154426
Ignore Mactheriverrat
modified
10/24/2020 11:30:36 PM

Let me throw a little code out here from my box of code's. Now this is just code to play with.
If you want to change anything , change ema(23) - ema(50) to different averages.

/*SCHAFF TREND CYCLE INDICATOR*/

set{var1, ema(23) - ema(50)}
set{highest, var1 20 day high}
set{lowest, var1 20 day low}
set{range, highest - lowest}
set{var2, var1 - lowest}
set{var3, var2 / range}
set{var4, var3 * 100}
set{stclong2350, cema(var4, 5)}

add column STClong2350
add column STClong2350 one day ago
add column STClong2350 two day ago

draw stclong2350 line at 80
draw stclong2350 line at 25
draw stclong2350 line at 20
draw stclong2350 line at 10


/*BUY WHEN STC CROSSES ABOVE 20 or 10 */
/*SHORT WHEN STC CROSSES BELOW 80*/

StockFetcher Forums · Filter Exchange · Help with this filter<< 1 2 >>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.