StockFetcher Forums · Filter Exchange · ANGLE BETWEEN INDICATORS<< 1 2 3 4 >>Post Follow-up
graftonian
1,089 posts
msg #154229
Ignore graftonian
modified
10/8/2020 11:08:53 AM

No one has posted a filter for a while, and, I've been tinkering with the question "does the difference in slope of two indicators make a difference?". The slope of a line (its tangent) offered little going forward, and the conversion to angle (in degrees) proved to be a ton of code. Thanks to some early work by SF and friends, here are the results/
Graf
Fetcher[
/*ANGLE BETWEEN INDICATORS 10/7/2020*/
NOT OTCBB
CLOSE BETWEEN 1 AND 10
AVERAGE VOLUME(10) > 1000000
/*angle of MA slopes, or your choice of indicator 1 and 2*/
set{indicator1, ema(13)}/*set here*/
set{indicator2, ema(50)}/*and here*/
draw indicator1 on plot price
draw indicator2 on plot price
set{slopeind1, 2 day slope of indicator1}
set{slopeind2, 2 day slope of indicator2}
set{radiansind1, slopeind1}
set{radiansind2, slopeind2}
set{atanind1, atan(radiansind1)}
set{atanind2, atan(radiansind2)}
set{hcircle, 180 / 3.14159}
set{angledegind1, atanind1 * hcircle}
set{angledegind2, atanind2 * hcircle}
add column angledegind1
add column angledegind2
set{CrossingAngle, angledegind1 - angledegind2}
add column CrossingAngle
/*add the crossing angle and angledeg10ma*/
set{MomentumAngle, CrossingAngle + angledegind1}
add column MomentumAngle
/*filter and sort*/
indicator1 crossed above indicator2
sort on column 8 descending
/*bells and whistles*/
set{xxx, close}
draw price line at xxx
]



VirginTrader
73 posts
msg #154239
Ignore VirginTrader
10/8/2020 7:42:46 PM

Thanks for sharing graftonian! Were you able to find an optimal value on the crossangle value?

graftonian
1,089 posts
msg #154247
Ignore graftonian
10/9/2020 10:00:07 AM

@virgintrader,
I haven't got that far. I wrote the script so that any two indicators could be used, hoping that people would test it with their favorites. I am currently testing this code with my favorites, the 10 and 50 Hull MAs. An angle over approx. 100 degrees results in large Gap-ups.
Graf

Cheese
1,374 posts
msg #154248
Ignore Cheese
10/9/2020 11:31:03 AM

Thank you, Graf for generoulsy donating this intellectually labor intensive creation.

I've been a fan of your pioneer work in this area since the earlier years.

I think of your filter above as a dual-purpose tool.

You've mentioned the first purpose, which is to identify breakouts for your trading.

I don't have the same philosophy and level of trading skills, so I edited your tool
for my voodoo stock analyses.

Fetcher[




/* ORIGINAL CODE by GRAFTONIAN */
/* https://www.stockfetcher.com/forums/Filter-Exchange/ANGLE-BETWEEN-INDICATORS/154229 */



/* ADAPTED FOR POSSIBLE STOCK ANALYSES --- MY ANALYSIS is VOODOO STUFF, FOR ILLUSTRATION and ENTERTAINMENT ONLY */



/* tech stocks at various stages in their product and service cycle */

SYMLIST(ZM,ORCL,CSCO) /* ZM possibly in merging and growth stage, ORCL and CSCO possibly in maturing stage */

CHART-TIME 24 MONTHS



/*ANGLE BETWEEN INDICATORS 10/7/2020*/
NOT OTCBB
/*CLOSE BETWEEN 1 AND 10 */ /* COMMENTED OUT */


AVERAGE VOLUME(10) > 1000000

/*angle of MA slopes, or your choice of indicator 1 and 2*/
set{indicator1, ema(13)}/*set here*/
set{indicator2, ema(50)}/*and here*/
draw indicator1 on plot price
draw indicator2 on plot price
set{slopeind1, 2 day slope of indicator1}
set{slopeind2, 2 day slope of indicator2}
set{radiansind1, slopeind1}
set{radiansind2, slopeind2}
set{atanind1, atan(radiansind1)}
set{atanind2, atan(radiansind2)}
set{hcircle, 180 / 3.14159}
set{angledegind1, atanind1 * hcircle}
set{angledegind2, atanind2 * hcircle}
add column angledegind1
add column angledegind2
set{CrossingAngle, angledegind1 - angledegind2}
add column CrossingAngle
/*add the crossing angle and angledeg10ma*/
set{MomentumAngle, CrossingAngle + angledegind1}
add column MomentumAngle

/*filter and sort*/
/*indicator1 crossed above indicator2 */ /* COMMENTED OUT */
sort on column 8 descending

/*bells and whistles*/
set{xxx, close}
draw price line at xxx


DRAW angledegind1 LINE AT 20 /* angledegind1 for maturing tech stocks likely not above 20 ? */
DRAW angledegind1 LINE AT -20
]




snappyfrog
651 posts
msg #154254
Ignore snappyfrog
modified
10/10/2020 7:08:39 AM

Thank you Graf

I am applying it here with my short term (2 -5 day) style of swing trading using the Stochastic (20,20,2).

Impressive to say the least!

Fetcher[
/*Original Code by GRAFTONIAN*/

/*Adapted to my code for short term swing trades using the Stochastic %K(20,20,2)*/

/*ANGLE BETWEEN INDICATORS 10/7/2020*/
NOT OTCBB
CLOSE BETWEEN 5 and 20
AVERAGE VOLUME(10) > 1000000
optionable
market is not otcbb
market is not etf
/*angle of MA slopes, or your choice of indicator 1 and 2*/
set{indicator1, Stochastic %K(20,20,2)}/*set here*/
set{indicator2, Stochastic %D(20,20,2)}/*and here*/
/*draw indicator1 on plot price
draw indicator2 on plot price*/
set{slopeind1, 2 day slope of indicator1}
set{slopeind2, 2 day slope of indicator2}
set{radiansind1, slopeind1}
set{radiansind2, slopeind2}
set{atanind1, atan(radiansind1)}
set{atanind2, atan(radiansind2)}
set{hcircle, 180 / 3.14159}
set{angledegind1, atanind1 * hcircle}
set{angledegind2, atanind2 * hcircle}
add column separator
add column angledegind1
add column angledegind2
set{CrossingAngle, angledegind1 - angledegind2}
add column separator
add column CrossingAngle
/*add the crossing angle and angledeg10ma*/
set{MomentumAngle, CrossingAngle + angledegind1}
add column MomentumAngle
/*filter and sort*/
indicator1 crossed above indicator2
sort on column 10 descending
/*bells and whistles*/
set{xxx, close}
draw price line at xxx
]



xarlor
561 posts
msg #154255
Ignore xarlor
modified
10/10/2020 10:25:42 AM

Expanding on this awesome filter and the collaborations. Simple entry and exit rules for lots of quick wins.

Enter when indicator1 crosses above indicator2 and during a TTM Squeeze.
Exit either when close crosses above Upper BB or below Lower BB.

Fetcher[

/*Original Code by GRAFTONIAN*/

/*Snappyfrog's adapted code for short term swing trades using the Stochastic %K(20,20,2)*/

/*ANGLE BETWEEN INDICATORS 10/7/2020*/
NOT OTCBB
CLOSE BETWEEN 5 and 20
AVERAGE VOLUME(10) > 1000000
optionable
market is not otcbb
market is not etf
/*angle of MA slopes, or your choice of indicator 1 and 2*/
set{indicator1, Stochastic %K(20,20,2)}/*set here*/
set{indicator2, Stochastic %D(20,20,2)}/*and here*/
/*draw indicator1 on plot price
draw indicator2 on plot price*/
set{slopeind1, 2 day slope of indicator1}
set{slopeind2, 2 day slope of indicator2}
set{radiansind1, slopeind1}
set{radiansind2, slopeind2}
set{atanind1, atan(radiansind1)}
set{atanind2, atan(radiansind2)}
set{hcircle, 180 / 3.14159}
set{angledegind1, atanind1 * hcircle}
set{angledegind2, atanind2 * hcircle}
add column separator
add column angledegind1
add column angledegind2
set{CrossingAngle, angledegind1 - angledegind2}
add column separator
add column CrossingAngle
/*add the crossing angle and angledeg10ma*/
set{MomentumAngle, CrossingAngle + angledegind1}
add column MomentumAngle

/* TTM Squeeze draw */

set{momo,cema(momentum(16),5)}

set{Pchange1,momentum(16)/momentum(16) 1 day ago}
set{Pchange,Pchange1 - 1}

set{sqz1,count(momo > .01,1)}
set{sqz2,count(momo < 0,1)}
set{sqz3,count(Upper Bollinger Band(20,2) < Upper Keltner Band(20,2),1)}
set{sqz4,count(Lower Bollinger Band(20,2) > Lower Keltner Band(20,2),1)}
set{sqz5,sqz3 * sqz4}
set{sqz6,sqz1 + sqz2}
set{TTM_Squeeze,sqz5 * sqz6}

/*filter and sort*/
set{Squeeze_Length,count(TTM_Squeeze > 0,11)}

set{long1,count(indicator1 crossed above indicator2,1)}
set{long2,count(Squeeze_Length < 11,1)}
set{long3,count(TTM_Squeeze > 0,1)}
set{long4,long1 * long2}
set{long,long3 * long4}
long > 0

set{exit1,count(close crossed above Upper Bollinger Band(20,2),1)}
set{exit2,count(close crossed below Lower Bollinger Band(20,2),1)}
set{exit,exit1 + exit2}
exit > -1

add column momo
add column pchange
draw momo
draw TTM_Squeeze
plottype{momo,zerobar}

sort on column 10 descending
/*bells and whistles*/
set{xxx, close}
draw price line at xxx
draw indicator2 on plot indicator1
]



sat_stocks
24 posts
msg #154257
Ignore sat_stocks
10/10/2020 11:43:54 AM

Hi,

How to use this filter? My looking at filter can take long/short without looking charts ? If so, please let me know how to use Colum angind1 ,angind2 ..so on

Thanks
Sat

wcurtis
54 posts
msg #154258
Ignore wcurtis
10/10/2020 12:07:01 PM

Not Bad, graftonian !

Thanks

graftonian
1,089 posts
msg #154259
Ignore graftonian
10/10/2020 12:11:48 PM

Glad to see you folks trying different tacks with this indicator. Some good is bound to come of it.

@sat_stocks,currently I am using momentum angle to sort the results of 1) a Hull MA 10/50 cross, 2) a Schaff Trend Cycle cross above 25, and 3) a favorable Aroon indicator pattern.

Fetcher[
/*STC & Hull 10/50 MA cross*/
NOT OTCBB
CLOSE BETWEEN .50 AND 20
AVERAGE VOLUME(10) > 1000000
chart-time is 6 months
/*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
/*H50*/
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
/*H10*/
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
add column H10 add column H50 add column STC
/*OHLC*/
set{OHLC1, open + high}
set{ohlc2, ohlc1 + low}
set{ohlc3, ohlc2 + close}
set{OHLC, ohlc3 / 4}
draw price line at OHLC

/*angle of MA slopes, or your choice of indicator 1 and 2*/
set{indicator1, H10}
set{indicator2, H50}
set{slopeind1, 2 day slope of indicator1}
set{slopeind2, 2 day slope of indicator2}
set{radiansind1, slopeind1}
set{radiansind2, slopeind2}
set{atanind1, atan(radiansind1)}
set{atanind2, atan(radiansind2)}
set{hcircle, 180 / 3.14159}
set{angledegind1, atanind1 * hcircle}
set{angledegind2, atanind2 * hcircle}
add column angledegind1
add column angledegind2
set{CrossingAngle, angledegind1 - angledegind2}
add column CrossingAngle
sort on column 8 descending
/*sum the crossing angle and angledeg10ma*/
set{MomentumAngle, CrossingAngle + angledegind1}
add column MomentumAngle
add column separator
add column OHLC

close > close 1 day ago
close > open
sort on column 11 descending/*momentumangle*/
/*my purchase info*/
set{SharesToBuy1, 100 / OHLC}
set{SharesToBuy, round(SharesToBuy1)}
add column SharesToBuy
set{CashReq, SharesToBuy * OHLC}
add column CashReq
/*bells and whistles*/
draw momentumangle
draw momentumangle line at 0
draw angledegind1 on plot momentumangle
draw angledegind2 on plot momentumangle
draw ind(spy, close)
do not draw OHLC
/* 10% gain and 5% loss lines*/
set{10pctgain, ohlc * 1.1}
set{5pctloss, ohlc * 0.95}
draw price line at 10pctgain
draw price line at 5pctloss
/*filter*/
H10 crossed above H50 within the last 2 days
STC crossed above 25 within the last 2 days
AngleDegInd2 > 0
momentumangle > momentumangle 1 day ago
]



snappyfrog
651 posts
msg #154260
Ignore snappyfrog
10/10/2020 12:12:14 PM

Great work guys!

Took out TTM Squeeze (sorry) and made BB inside Keltner Bands a condition and visual only for those not on Advanced subscription.

I also opened up the price range to anything above 5 and made the condition that Pchange > -2 and indicator2 < 50.

Let me know what you think.



Fetcher[
/*Original Code by GRAFTONIAN*/

/*Snappyfrog's adapted code for short term swing trades using the Stochastic %K(20,20,2)*/

/*Xarlor's adapted code and removing TTM Squeeze, making BB a visual indicator for those not on Advanced Subscription*/

/*Added Pchange > -2 and changed close to close > 5*/

/*ANGLE BETWEEN INDICATORS 10/7/2020*/
NOT OTCBB
CLOSE > 5
AVERAGE VOLUME(10) > 1000000
optionable
market is not otcbb
market is not etf
/*angle of MA slopes, or your choice of indicator 1 and 2*/
set{indicator1, Stochastic %K(20,20,2)}/*set here*/
set{indicator2, Stochastic %D(20,20,2)}/*and here*/
/*draw indicator1 on plot price
draw indicator2 on plot price*/
set{slopeind1, 2 day slope of indicator1}
set{slopeind2, 2 day slope of indicator2}
set{radiansind1, slopeind1}
set{radiansind2, slopeind2}
set{atanind1, atan(radiansind1)}
set{atanind2, atan(radiansind2)}
set{hcircle, 180 / 3.14159}
set{angledegind1, atanind1 * hcircle}
set{angledegind2, atanind2 * hcircle}
add column separator
add column angledegind1
add column angledegind2
set{CrossingAngle, angledegind1 - angledegind2}
add column separator
add column CrossingAngle
/*add the crossing angle and angledeg10ma*/
set{MomentumAngle, CrossingAngle + angledegind1}
add column MomentumAngle

/* TTM Squeeze draw */

set{momo,cema(momentum(16),5)}

set{Pchange1,momentum(16)/momentum(16) 1 day ago}
set{Pchange,Pchange1 - 1}
Pchange > -2

draw Upper Bollinger Band(20,2) < Upper Keltner Band(20,2),1)
draw Lower Bollinger Band(20,2) > Lower Keltner Band(20,2),1)

add column momo
add column pchange
draw momo
plottype{momo,zerobar}

sort on column 12 descending
/*bells and whistles*/
set{xxx, close}
draw price line at xxx
draw indicator2 on plot indicator1
and indicator1 crossed above indicator2
and indicator2 < 50
]



StockFetcher Forums · Filter Exchange · ANGLE BETWEEN INDICATORS<< 1 2 3 4 >>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.