StockFetcher Forums · General Discussion · A challenge to TomB and the Stockfetcher Crew<< 1 2 3 >>Post Follow-up
Kevin_in_GA
4,599 posts
msg #95123
Ignore Kevin_in_GA
7/27/2010 9:08:16 AM

Guys:

Really appreciate the work you have been doing recently on the Watchlists.

I'd like to see if you can divert some of your resources to adding new functionality to the SF code. Specifically, writing a function to determine divergences between any two indicators.

Example: I want to find stocks where there is a divergence between a specific MA and the MACD - let's say each needs to have moved X% in the last Y days, but in opposite directions. It would be great to have a function that looks like this:

divergence(indicator1, indicator2, X, Y)

The function would return either a 1 (divergence exists and is positive - that is ind1 is increasing while ind2 is decreasing), a -1 (negative divergence), or a 0 (either they did not each move by X5 during the last Y days, or they moved in the same direction).

As it stands, this is what I have to write if I want to see if a divergence exists between MA(3) - representing price - and the MACD(12,26). Both must have moved by more than 3% in the last 10 days.

Fetcher[

/*CODING FOR DIVERGENCES*/

SET{MACD_UP, COUNT(MACD(12,26,1) GAINED MORE THAN 3% OVER THE LAST 10 DAYS,1)}
SET{MACD_DN, COUNT(MACD(12,26,1) DROPPED MORE THAN 3% OVER THE LAST 10 DAYS,1)}

SET{MA3_UP, COUNT(MA(3) GAINED MORE THAN 3% OVER THE LAST 10 DAYS,1)}
SET{MA3_DN, COUNT(MA(3) DROPPED MORE THAN 3% OVER THE LAST 10 DAYS,1)}

SET{POS_DIV, MACD_UP * MA3_DN}
SET{NEG_DIV, MACD_DN * MA3_UP}

ADD COLUMN POS_DIV
ADD COLUMN NEG_DIV

]



Then I need to add a line saying "POS_DIV above 0.5" if I want to find positive divergences. It would be much easier to simply write

divergence(macd(12,26),MA(3),3,10) above 0.5



Challenge made ...

Kevin_in_GA
4,599 posts
msg #95125
Ignore Kevin_in_GA
7/27/2010 9:19:34 AM

Two separate functions would also work

posdiv(indicator1, indicator2, X, Y) would return a "1" if these conditions are met and a positive divergence is seen, and a 0 if they are not met.

negdiv(indicator1, indicator2, X, Y) would return a "1" if these conditions are met and a negative divergence is seen, and a 0 if they are not met.

mystiq
650 posts
msg #95151
Ignore mystiq
7/28/2010 5:38:03 AM

:0 nice challenge...looking forward to any replies

stockfetcher
980 posts
msg #95152
7/28/2010 7:44:07 AM

Thank you for the feedback and feature suggestion. We will definitely look into the measure that you mention. If we have any questions or need further information, we'll be sure to post a follow-up. Additionally, if we are able to implement this new functionality, we will let you know.

Thank you again,

StockFetcher.com Support


Kevin_in_GA
4,599 posts
msg #95158
Ignore Kevin_in_GA
7/28/2010 10:10:14 AM

Thank you for the feedback and feature suggestion. We will definitely look into the measure that you mention. If we have any questions or need further information, we'll be sure to post a follow-up. Additionally, if we are able to implement this new functionality, we will let you know.

Thank you again,

StockFetcher.com Support
+++++++

Thanks. Given the importance of identifying divergences between indicators (e.g., price and volume, price and momentum, etc), and that the coding is straightforward, it should be easy for you gurus to implement.

It would also be nice to see some new functionality in SF code - this is what really differentiates SF from other sites, and is why most of us are members. Also, there have not been any new indicators developed for SF in quite a while, so new functions like this would be really useful.

stockfetcher
980 posts
msg #95164
7/28/2010 10:45:57 AM

Please be sure to let us know what indicators we are missing that you would find useful.

Provided we support the appropriate data and the formula is documented and in the public domain, we would be more than happy to look into implementing new measures!

StockFetcher.com Support


Kevin_in_GA
4,599 posts
msg #95173
Ignore Kevin_in_GA
7/28/2010 5:36:22 PM

Please be sure to let us know what indicators we are missing that you would find useful.

Provided we support the appropriate data and the formula is documented and in the public domain, we would be more than happy to look into implementing new measures!

++++++++++++++++

Careful - you might be opening a door here ...

One specific function which would be VERY useful for me would be to be able to see the correlation between any two stocks or indices over a user-defined period of time.

Example - find stocks that are highly correlated over a longer time frame, but are deviating from this correlation over a shorter time frame. Trade with the expectation that the relationship will revert to the mean. I do this now by looking at the ratio of the two stocks and treating this as a single stock, and use Bollinger Bands on it to see short-term movements, but this is time consuming to do across multiple timeframes.

Function could look something like

correlation(stock1, stock2, time period), the output of which would be a number between 1.00 and -1.00.

Eman93
4,750 posts
msg #95176
Ignore Eman93
modified
7/28/2010 7:03:02 PM

in back testing I would love to see an entry filter to trigger your main filter.... just like you have for the exit filter criteria ... just add a box for the entry filter...

currently I don't think you can have that kind of condition in a regular filter.


example for a bullish filter SPY ma10 > MA30 or any other bullish signal you want for the spy.. then it would trigger your main bullish filter. would help weed out trying to trade long in a down trend in the back test........


AND 60min 30min 15min and 5 min charts....... 15min delayed data is fine for me... I realize this would require a lot more storage and computing power... maybe just use nyse and nasdq only for sub daily calcs... only hold sub daily bars for 1 or 2 years....

Kevin_in_GA
4,599 posts
msg #95178
Ignore Kevin_in_GA
7/28/2010 7:39:17 PM

in back testing I would love to see an entry filter to trigger your main filter.... just like you have for the exit filter criteria ... just add a box for the entry filter...

currently I don't think you can have that kind of condition in a regular filter.


example for a bullish filter SPY ma10 > MA30 or any other bullish signal you want for the spy.. then it would trigger your main bullish filter. would help weed out trying to trade long in a down trend in the back test........
++++++++++

You can do this now. Just add the following lines to your existing filter:

set{SPY, ind(spy, close)}
set{SPYMA10, cma(spy,10)}
set{SPYMA30, cma(spy, 30)}

SPYMA10 above SPYMA30


The filter will now only return trades if the above condition is met.

Eman93
4,750 posts
msg #95179
Ignore Eman93
7/28/2010 7:49:52 PM

Thanks Kevin!!!!!


StockFetcher Forums · General Discussion · A challenge to TomB and the Stockfetcher Crew<< 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.


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.