forked from hwrdprkns/ThinkOrSwim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStochasticTrendSTUDY.ts
47 lines (39 loc) · 1.36 KB
/
StochasticTrendSTUDY.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
# STOCHASTICTREND
# DREWGRIFFITH15 (C) 2014
DECLARE UPPER;
DEF PAINTBARS = YES;
INPUT KPERIOD = 40;
INPUT DPERIOD = 3;
INPUT SMA = 10;
INPUT OVER_BOUGHT = 85;
INPUT OVER_SOLD = 15;
DEF FASTLINE = STOCHASTICSLOW("D PERIOD" = DPERIOD, "K PERIOD" = KPERIOD);
DEF STOCHASTIC_SMA = SIMPLEMOVINGAVG(FASTLINE,SMA);
# TEST
DEF GREENPRICE = FASTLINE > STOCHASTIC_SMA AND FASTLINE > OVER_SOLD;
DEF REDPRICE = FASTLINE < STOCHASTIC_SMA AND FASTLINE < OVER_BOUGHT;
PLOT BULLISH = GREENPRICE;
PLOT NEUTRAL = !GREENPRICE AND !REDPRICE;
PLOT BEARISH = REDPRICE;
PLOT RATING =
IF GREENPRICE THEN 1
ELSE IF REDPRICE THEN -1
ELSE 0;
BULLISH.SETDEFAULTCOLOR(COLOR.UPTICK);
BULLISH.SETPAINTINGSTRATEGY(PAINTINGSTRATEGY.BOOLEAN_POINTS);
BULLISH.SETLINEWEIGHT(3);
BULLISH.HIDE();
NEUTRAL.SETDEFAULTCOLOR(COLOR.GRAY);
NEUTRAL.SETPAINTINGSTRATEGY(PAINTINGSTRATEGY.BOOLEAN_POINTS);
NEUTRAL.SETLINEWEIGHT(3);
NEUTRAL.HIDE();
BEARISH.SETDEFAULTCOLOR(COLOR.DOWNTICK);
BEARISH.SETPAINTINGSTRATEGY(PAINTINGSTRATEGY.BOOLEAN_POINTS);
BEARISH.SETLINEWEIGHT(3);
BEARISH.HIDE();
RATING.Hide();
RATING.HideBubble();
DEFINEGLOBALCOLOR("BULLISH", COLOR.UPTICK);
DEFINEGLOBALCOLOR("NEUTRAL", COLOR.GRAY);
DEFINEGLOBALCOLOR("BEARISH", COLOR.DOWNTICK);
ASSIGNPRICECOLOR(IF !PAINTBARS THEN COLOR.CURRENT ELSE IF GREENPRICE THEN GLOBALCOLOR("BULLISH") ELSE IF REDPRICE THEN GLOBALCOLOR("BEARISH") ELSE GLOBALCOLOR("NEUTRAL"));