StockFetcher Forums · General Discussion · Help a newbie out with a DeMarker II Filter? << >>Post Follow-up
jfehrman
3 posts
msg #107388
Ignore jfehrman
8/6/2012 2:24:54 PM

Looking to make a DeMarker II filter. It is a variation on the DeMarker filter. Very new to the syntax used on StockFetcher, so any help would be greatly appreciated!

Formula goes like this:

The numerator is the 5 day sum of DeMax 1 + DeMax 2 values, where:

DeMax 1 value= High - Close 1 day ago*
*If yesterday's close is greater than today's high, DeMax 1 should equal 0 i.e. DeMax 1 may not be negative

DeMax 2 value= Close - Low

The denominator is the numerator plus the 5 day sum of DeMin 1 + DeMin 2 values, where:

DeMin 1 value = Close 1 day ago - Low*
*If low is greater than yesterday's close, DeMin 1 should equal 0 i.e. DeMin 1 may not be negative

DeMin 2 value= High - Close

So far I have:
set{demax,high - close 1 day ago}
set{demax_2,close - low}
set{demin,close 1 day ago - low}
set{demin_2,high - close}

set{num, max(demax,0)} <--- not sure how to return a 0 value for demax if the yesterday's close is greater than today's high?

Cheese
891 posts
msg #107400
Ignore Cheese
8/6/2012 6:51:54 PM

Here you go. Good luck.

Fetcher[

/* Vancouver, Beautiful British Columbia */

symlist(spy)

set{close1,close 1 day ago}

/* ********************************** NUMERATOR */
set{DeMax1_temp,high - close1}
set{DeMax1_count_abovezero,count(DeMax1_temp above 0,1)}
set{DeMax1,DeMax1_count_abovezero * DeMax1_temp}
/* draw DeMax1 */

set{DeMax2,close - low}
/* draw DeMax2 */

set{numer_temp,DeMax1 + DeMax2}
set{numer,sum(numer_temp,5)}

/* draw numer */

/* ********************************** DENOMINATOR */

set{DeMin1_temp, close1 - low}
set{DeMin1_count_abovezero,count(DeMin1_temp above 0,1)}
set{DeMin1,DeMin1_count_abovezero * DeMin1_temp}
/* draw DeMin1 */

set{DeMin2,high-close}
/* draw DeMin2 */

set{denom_temp,DeMin1 + DeMin2}
set{denom_sum,sum(denom_temp,5)}

set{denom,numer+denom_sum}
/* draw denom */

/* ********************************** DEMARKER II */

set{demarker2,numer/denom}
draw demarker2

]

Kevin_in_GA
4,599 posts
msg #107411
Ignore Kevin_in_GA
8/7/2012 7:44:15 AM

Nice first post, Cheese.

Maybe it's just me, but your coding style on this looks very familiar.

Cheese
891 posts
msg #107412
Ignore Cheese
8/7/2012 8:44:29 AM

Kevin_in_GA, thank you for all the great ideas that you've provided in this forum and on your website.
My coding style may look familiar because I've been learning from you and other people in this forum.
Cheers.

Kevin_in_GA
4,599 posts
msg #107413
Ignore Kevin_in_GA
8/7/2012 8:57:11 AM

What drew my attention in your code was the first line - if you are not familiar with some of the work done by Chetron here in these forums (someone from whom I learned most of what I know about SF coding) then you should review some of his work.

Chet used to add a specific descriptor at the start of many of his filters, so that he could quickly search and find them if needed. He was also Canadian.

jfehrman
3 posts
msg #107415
Ignore jfehrman
8/7/2012 9:03:43 AM

Thank you very much! Unfortunately the indicator values returned do not match the proprietary values I recieve from Bloomberg. Most likely a problem with my interpretation of the formula, DeMark is regretably obtuse in his description of the indicator. Will keep working on hammering out the formula, but I very much appreciate the code! Learned a lot. Ultimate goal is creation of a TD Alignment indicator which is an amalgamation of 5 DeMark indicators. Will share upon completion.

 mystiq650 postsmsg #107464- Ignore mystiq 8/8/2012 11:29:24 AM Kevin_in_GA 8/7/2012 8:57:11 AM What drew my attention in your code was the first line - if you are not familiar with some of the work done by *Chetron* here in these forums (someone from whom I learned most of what I know about SF coding) then you should review some of his work. *Chet* used to add a specific descriptor at the start of many of his filters, so that he could quickly search and find them if needed. He was also Canadian ---->was about to sign off...but if true: welcome back :-)
Cheese
891 posts
msg #107471
Ignore Cheese
8/8/2012 3:27:19 PM

Sorry to disappoint you but I am not Chet. I did learn a lot of Chet and I missed his contributions,
especially how Chet weaseled filters for the "cheap seats".

Kevin_in_GA
4,599 posts
msg #107472
Ignore Kevin_in_GA
8/8/2012 3:47:18 PM

No disappointment for me in having another competent coder here in the forums. Welcome.

 StockFetcher Forums · General Discussion · Help a newbie out with a DeMarker II 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.