forked from hwrdprkns/ThinkOrSwim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStockHackerSCAN.ts
121 lines (121 loc) · 5.91 KB
/
StockHackerSCAN.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
#HTTP://WWW.CANDLESTICKER.COM/BEARISH.ASP
#HTTP://WWW.CANDLESTICKER.COM/BULLISH.ASP
##################################################################
#CANDLESTICKER-BEARISH-HIGH1
#HIGH RELIABILITY
DARKCLOUDCOVER() OR KICKING().BEARISH OR ABANDONEDBABY().BEARISH OR EVENINGSTAR() OR EVENINGDOJISTAR()
##################################################################
#CANDLESTICKER-BEARISH-HIGH2
#HIGH RELIABILITY
THREEBLACKCROWS() OR THREEINSIDEDOWN() OR THREEOUTSIDEDOWN() OR ENGULFING().BEARISH
##################################################################
#CANDLESTICKER-BEARISH-MED3
#MED RELIABILITY
UPSIDEGAPTWOCROWS() OR HARAMICROSS().BEARISH OR ADVANCEBLOCK() OR DELIBERATION()
##################################################################
#CANDLESTICKER-BULLISH-HIGH1
#HIGH RELIABILITY
PIERCINGLINE() OR KICKING().BULLISH OR ABANDONEDBABY() OR MORNINGDOJISTAR() OR MORNINGSTAR()
##################################################################
#CANDLESTICKER-BULLISH-HIGH1
#HIGH RELIABILITY
THREEINSIDEUP() OR THREEOUTSIDEUP() OR THREEWHITESOLDIERS() OR ENGULFING().BULLISH
##################################################################
#CANDLESTICKER-BULLISH-MED3
#MED RELIABILITY
MEETINGLINES().BULLISH OR HARAMICROSS().BULLISH OR HOMINGPIGEON() OR THREESTARSINTHESOUTH()
##################################################################
#BULL-DMISTOCHASTICEXTREME
CROSSES(DMI_STOCHASTICEXTREME("HIGH LOW LENGTH" = 14),10,CROSSINGDIRECTION.ABOVE)
##################################################################
#STOCHASTICCROSSOVER
#STOCHASTICSLOW (WHEN THEY CROSS):
#EX: CROSSES(STOCHASTIC, 80, CROSSINGDIRECTION.ABOVE)
CROSSES(ROUND(SIMPLEMOVINGAVG(100*((CLOSE-LOWEST(LOW,14))/(HIGHEST(HIGH,14)-LOWEST(LOW,14))), LENGTH = 3)),ROUND(SIMPLEMOVINGAVG(SIMPLEMOVINGAVG(100*((CLOSE-LOWEST(LOW,14))/(HIGHEST(HIGH,14)-LOWEST(LOW,14))), LENGTH = 3), LENGTH = 3)), CROSSINGDIRECTION.ABOVE) OR
CROSSES(ROUND(SIMPLEMOVINGAVG(100*((CLOSE-LOWEST(LOW,14))/(HIGHEST(HIGH,14)-LOWEST(LOW,14))), LENGTH = 3)),ROUND(SIMPLEMOVINGAVG(SIMPLEMOVINGAVG(100*((CLOSE-LOWEST(LOW,14))/(HIGHEST(HIGH,14)-LOWEST(LOW,14))), LENGTH = 3), LENGTH = 3)), CROSSINGDIRECTION.BELOW)
##################################################################
# STOCKS GATHERING MOMENTUM
# 3 DAYS UP, PRICE AND VOLUME (BULLISH)
(CLOSE > CLOSE[1] AND
CLOSE [1] > CLOSE [2] AND
VOLUMEAVG(LENGTH = 20) > VOLUMEAVG(LENGTH = 20)[1] AND
VOLUMEAVG(LENGTH = 20)[1] > VOLUMEAVG(LENGTH = 20)[2] AND
OR
# 3 DAYS DOWN IN PRICE, 3 DAYS UP IN VOLUME (BEARISH REVERSAL)
(CLOSE < CLOSE[1] AND
CLOSE [1] < CLOSE [2] AND
VOLUMEAVG(LENGTH = 20) > VOLUMEAVG(LENGTH = 20)[1] AND
VOLUMEAVG(LENGTH = 20)[1] > VOLUMEAVG(LENGTH = 20)[2] AND
OR
# 3 DAYS DOWN IN PRICE, 3 DAYS DOWN IN VOLUME (BULLISH REVERSAL)
(CLOSE < CLOSE[1] AND
CLOSE [1] < CLOSE [2] AND
VOLUMEAVG(LENGTH = 20) > VOLUMEAVG(LENGTH = 20)[1] AND
VOLUMEAVG(LENGTH = 20)[1] > VOLUMEAVG(LENGTH = 20)[2] AND
##################################################################
# CONSOLIDATION BREAKOUT
# SYMMETRICAL CONSOLIDATION
HIGHEST(DATA = CLOSE, LENGTH = 30)[60]>HIGHEST(DATA = CLOSE, LENGTH = 30)[30] AND
HIGHEST(DATA = CLOSE, LENGTH = 30)[30]>HIGHEST(DATA = CLOSE, LENGTH = 30) AND
LOWEST(DATA = CLOSE, LENGTH = 30)[60]<LOWEST(DATA = CLOSE, LENGTH = 30)[30] AND
LOWEST(DATA = CLOSE, LENGTH = 30)[30]<LOWEST(DATA = CLOSE, LENGTH = 30) AND
# DECLINING VOLUME
VOLUMEAVG().VOLAVG[90] > VOLUMEAVG().VOLAVG AND
# HIGHER CLOSE TODAY
CLOSE()>CLOSE()[1] AND
# HEAVY VOLUME TODAY
VOLUMEAVG(LENGTH = 10) > VOLUMEAVG(LENGTH = 50).VOLAVG
##################################################################
# ASCENDING TRIANGLE BREAKOUT
# HIGHS ARE WITHIN 1% OF EACH OTHER
(ABSVALUE(HIGHEST(DATA = CLOSE, LENGTH = 30)[30]-HIGHEST(DATA = CLOSE, LENGTH = 30)[1])/HIGHEST(DATA = CLOSE, LENGTH = 30)[30] < .01 OR
ABSVALUE(HIGHEST(DATA = CLOSE, LENGTH = 30)[60]-HIGHEST(DATA = CLOSE, LENGTH = 30)[1])/HIGHEST(DATA = CLOSE, LENGTH = 30)[60] < .01) AND
# BOTTOM SIDE CONSOLIDATION OVER LAST 90 DAYS
LOWEST(DATA = CLOSE, LENGTH = 30)[60]<LOWEST(DATA = CLOSE, LENGTH = 30)[30] AND
LOWEST(DATA = CLOSE, LENGTH = 30)[30]<LOWEST(DATA = CLOSE, LENGTH = 30) AND
# DECLINING VOLUME OVER LAST 60 DAYS
VOLUMEAVG().VOLAVG[60] > VOLUMEAVG().VOLAVG AND
# NEW 60 DAY HIGH
CLOSE()>HIGHEST(DATA = CLOSE, LENGTH = 60)[1] AND
##################################################################
# DARVAS BOX BREAKOUT
(CLOSE > HIGHEST(DATA = HIGH, LENGTH = 8)[1] OR
CLOSE < LOWEST(DATA = LOW, LENGTH = 8)[1]) AND
VOLUMEAVG(LENGTH = 10) > VOLUMEAVG(LENGTH = 10).VOLAVG
##################################################################
# SWING BREAKOUT
(CLOSE > HIGHEST(DATA = CLOSE, LENGTH = 2)[1]) AND
VOLUMEAVG(LENGTH = 20) > VOLUMEAVG(LENGTH = 20).VOLAVG AND
STOCHASTICSLOW("K PERIOD" = 14, "D PERIOD" = 3) <= 60 AND
TRENDQUALITY("TREND LENGTH" = 3, "NOISE LENGTH" = 90) > 0
# TOO COMPLEX BEYOND THIS POINT DURING MARKET HOURS
#AND STOCHASTICSLOWTREND() > 0
##################################################################
# HEAVY VOLUME/STOCHASTIC BUY AREA
VolumeAvg(LENGTH = 20) > VolumeAvg(LENGTH = 20).VOLAVG and
StochasticSlow("K PERIOD" = 14, "D PERIOD" = 3) <= 50 and
STOCHASTICSLOWTREND() > 0 and
Close>Close[1]
##################################################################
# RSI SUPPORT / RESISTANCE BREAKOUT
reference RSI_SR(rsisr = 20).RSI == RSI_SR(rsisr = 20).RSI_HIGH and RSI_SR(rsisr = 20).RSI_HIGH <= 60
##################################################################
# RSI2 BASED EXIT ALERT
input side = {DEFAULT LONG, SHORT};
input target = 75;
input rsi_length = 2;
input price = close;
# RSI
def NETCHGAVG = WildersAverage(price - price[1], rsi_length);
def TOTCHGAVG = WildersAverage(AbsValue(price - price[1]), rsi_length);
def CHGRATIO = if TOTCHGAVG != 0 then NETCHGAVG / TOTCHGAVG else 0;
def RSI = Round(50 * (CHGRATIO + 1), NUMBEROFDIGITS = 0);
DEF LMT;
SWITCH (SIDE) {
CASE LONG:
LMT = RSI >= TARGET;
CASE SHORT:
LMT = RSI <= TARGET;
}
PLOT EXIT = LMT;
##################################################################