forked from hwrdprkns/ThinkOrSwim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TargetsSTUDY.ts
57 lines (47 loc) · 2.07 KB
/
TargetsSTUDY.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
# TARGETS
# DREWGRIFFITH15 (C) 2015
INPUT AGGREGATIONPERIOD = AGGREGATIONPERIOD.DAY;
INPUT TARGET_ONE = 250;
INPUT TARGET_TWO = 20;
INPUT TARGET_THR = 252;
INPUT DISPLACE = -1;
INPUT SHOWONLYLASTPERIOD = YES;
# PLOT HIGH TARGETS
PLOT HIGH_ONE;
IF SHOWONLYLASTPERIOD AND !ISNAN(HIGH(PERIOD = AGGREGATIONPERIOD)[-1]) { HIGH_ONE = DOUBLE.NAN;
} ELSE { HIGH_ONE = HIGHEST(HIGH(PERIOD = AGGREGATIONPERIOD)[-DISPLACE], TARGET_ONE);
}
PLOT HIGH_TWO;
IF SHOWONLYLASTPERIOD AND !ISNAN(HIGH(PERIOD = AGGREGATIONPERIOD)[-1]) { HIGH_TWO = DOUBLE.NAN;
} ELSE { HIGH_TWO = HIGHEST(HIGH(PERIOD = AGGREGATIONPERIOD)[-DISPLACE], TARGET_TWO);
}
PLOT HIGH_THR;
IF SHOWONLYLASTPERIOD AND !ISNAN(HIGH(PERIOD = AGGREGATIONPERIOD)[-1]) { HIGH_THR = DOUBLE.NAN;
} ELSE { HIGH_THR = HIGHEST(HIGH(PERIOD = AGGREGATIONPERIOD)[-DISPLACE], TARGET_THR);
}
# PLOT LOW TARGETS
PLOT LOW_ONE;
IF SHOWONLYLASTPERIOD AND !ISNAN(LOW(PERIOD = AGGREGATIONPERIOD)[-1]) { LOW_ONE = DOUBLE.NAN;
} ELSE { LOW_ONE = LOWEST(LOW(PERIOD = AGGREGATIONPERIOD)[-DISPLACE], TARGET_ONE);
}
PLOT LOW_TWO;
IF SHOWONLYLASTPERIOD AND !ISNAN(LOW(PERIOD = AGGREGATIONPERIOD)[-1]) { LOW_TWO = DOUBLE.NAN;
} ELSE { LOW_TWO = LOWEST(LOW(PERIOD = AGGREGATIONPERIOD)[-DISPLACE], TARGET_TWO);
}
PLOT LOW_THR;
IF SHOWONLYLASTPERIOD AND !ISNAN(LOW(PERIOD = AGGREGATIONPERIOD)[-1]) { LOW_THR = DOUBLE.NAN;
} ELSE { LOW_THR = LOWEST(LOW(PERIOD = AGGREGATIONPERIOD)[-DISPLACE], TARGET_THR);
}
HIGH_ONE.SETDEFAULTCOLOR(CREATECOLOR(255, 0, 0));
HIGH_ONE.SETPAINTINGSTRATEGY(PAINTINGSTRATEGY.POINTS);
HIGH_TWO.SETDEFAULTCOLOR(CREATECOLOR(255, 255, 0));
HIGH_TWO.SETPAINTINGSTRATEGY(PAINTINGSTRATEGY.POINTS);
HIGH_THR.SETDEFAULTCOLOR(CREATECOLOR(255, 255, 255));
HIGH_THR.SETPAINTINGSTRATEGY(PAINTINGSTRATEGY.POINTS);
LOW_ONE.SETDEFAULTCOLOR(CREATECOLOR(0, 255, 0));
LOW_ONE.SETPAINTINGSTRATEGY(PAINTINGSTRATEGY.POINTS);
LOW_TWO.SETDEFAULTCOLOR(CREATECOLOR(255, 255, 0));
LOW_TWO.SETPAINTINGSTRATEGY(PAINTINGSTRATEGY.POINTS);
LOW_THR.SETDEFAULTCOLOR(CREATECOLOR(255, 255, 255));
LOW_THR.SETPAINTINGSTRATEGY(PAINTINGSTRATEGY.POINTS);
##############################################