StockFetcher Forums · Filter Exchange · ANGLE BETWEEN INDICATORS<< 1 2 3 4 >>Post Follow-up
snappyfrog
721 posts
msg #154261
Ignore snappyfrog
10/10/2020 12:24:06 PM

Of course I have to try it with my longer Stochastic (40,40,4) for swing trades of 5 days or longer.

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*/

/*Changed Stochastic (20,20,2) to the longer (40,40,4) for longer trades/*


/*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(40,40,4)}/*set here*/
set{indicator2, Stochastic %D(40,40,4)}/*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
]



snappyfrog
721 posts
msg #154262
Ignore snappyfrog
modified
10/10/2020 12:33:42 PM

Try with my PVI swing trade setup.


Fetcher[

/*Original Code by GRAFTONIAN*/

/*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 and removed indicator2 < 50*/

/*Adapted to my PVI and CMA(PVI,10) - PVI crossing said 10 day moving average. PVI is positive volume index or retail traders.*/


/*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, pvi}/*set here*/
set{indicator2, CMA(pvi,10)}/*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

]



snappyfrog
721 posts
msg #154263
Ignore snappyfrog
10/10/2020 12:37:33 PM

Graf,

I'm glad you brought up this subject as I have looked at angles before and wondered the same thing as you, I just was at a loss as to how to try to express it in code.

Awesome job!

VirginTrader
73 posts
msg #154266
Ignore VirginTrader
10/10/2020 1:51:23 PM

Ah...when good SF posters share!

Had to try it with RSI

Fetcher[
/* ANGLE BETWEEN INDICATORS 10/7/2020 by graftonian */
chart-time is 120 days

sp500

add column Average Day Range(30) > 5
sort column 5 descending
do not draw Average Day Range(30)

draw ema(13)
draw ema(34)

draw rsi(2) line at 20

/*angle of MA slopes, or your choice of indicator 1 and 2*/
set{indicator1, rsi(5)}/*set here*/
set{indicator2, rsi(14)}/*and here*/
/* draw indicator1 on plot price
draw indicator2 on plot price */

set{slopeind1, 5 day slope of indicator1}
set{slopeind2, 5 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*/

set{x1, count(indicator1 crossed above indicator2,1) }
set{x2, count(close < ema(13),5) * count(close > ema(34),1)}
set{x3, x1 * x2}
x3 > 0
]



snappyfrog
721 posts
msg #154269
Ignore snappyfrog
10/10/2020 4:04:20 PM

VirginTrader, thanks. Another good one.

sat_stocks
24 posts
msg #154270
Ignore sat_stocks
modified
10/10/2020 4:14:26 PM

Hi graftonian,

Thanks and appreciated your response, am new using this filter am trying to understand how to use this simple manner...!

@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.

When i ran tie script , could see couple of ticker`s in the list which one need to buy/short without looking at chart ?(also i see number in each Colum H10,angind , not sure what is use of those number ...so on.. how i will know MA10/50 cross without looking charts..

Thanks in advance ..!


Thanks
sat

snappyfrog
721 posts
msg #154283
Ignore snappyfrog
10/11/2020 11:31:01 AM

How about with Displaced Moving Averages?

Fetcher[

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

/*Adapted for DMA as in hypothesis, the sharper the angle the stronger the move*/


/*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, cma(DMA(7,-5),1)}/*set here*/
set{indicator2, cma(DMA(7,-5),7)}/*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 #154285
Ignore VirginTrader
10/11/2020 12:25:05 PM

thanks snappy; gotta love puzzles.

guess we could use a variety of 2 indicators (or more)...I am trying to figure out how to leverage graft's angle work to make the signals robust.

graftonian
1,089 posts
msg #154288
Ignore graftonian
10/11/2020 2:36:36 PM

The more indicator pairs we try, the better. I thought about crossing my net worth and the net worth of my ex-wives, but---well, never mind.
I have trimmed my code down to bare bones for ease of reading and tinkering,
Have fun,
Graf

Fetcher[
/*momentum angle*/
chart-time is 1 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)}

/*H10*/
set{slow1A, cwma(close, 5)}
set{slow2A, 2 * slow1A}
set{slow3A, cwma(close, 10)}
set{valslowA, slow2A - slow3A}
set{H10, cwma(valslowA, 3)}
/*angle of MA slopes, or your choice of indicator 1 and 2*/
set{indicator1, H10} /********CHANGE INDICATOR1 HERE**************/
set{indicator2, H50} /********CHANGE INDICATOR2 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}
set{CrossingAngle, angledegind1 - angledegind2}
/*sum the crossing angle and angledeg10ma*/
set{MomentumAngle, CrossingAngle + angledegind1}
add column MomentumAngle
add column separator

/*bells and whistles*/
draw momentumangle
draw momentumangle line at 0

/*filter*/
NOT OTCBB
CLOSE BETWEEN 1 AND 20
AVERAGE VOLUME(10) > 1000000
AVERAGE VOLUME(10) > AVERAGE VOLUME(10) 1 day ago
close > close 1 day ago
close > open
sort on column 5 descending/*momentumangle*/
H10 crossed above H50 within the last 3 days
STC crossed above 25
AngleDegInd2 > 0
momentumangle > momentumangle 1 day ago
/********************DO NOT DRAW******************/
do not draw angleDegind2
do not draw H10 d0 not draw H50
]



VirginTrader
73 posts
msg #154290
Ignore VirginTrader
modified
10/11/2020 3:25:09 PM

thanks graf; thanks xarlor.

@graf ..how many ex's u got? next time, lease!

wish there was a way to back test the best 2 combos...

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.