-
Notifications
You must be signed in to change notification settings - Fork 47
/
FibonacciRetracementsSTUDY.ts
40 lines (34 loc) · 1.48 KB
/
FibonacciRetracementsSTUDY.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
# FibonacciRetracements
# DREWGRIFFITH15 (C) 2015
INPUT PERIODS = 90;
INPUT DISPLACE = -1;
INPUT AGGREGATIONPERIOD = AGGREGATIONPERIOD.DAY;
INPUT SHOWONLYLASTPERIOD = YES;
PLOT FR100;
IF SHOWONLYLASTPERIOD AND !ISNAN(High(PERIOD = AGGREGATIONPERIOD)[-1]) { FR100 = DOUBLE.NAN;
} ELSE { FR100 = HIGHEST(High(PERIOD = AGGREGATIONPERIOD)[-DISPLACE], PERIODS);
}
PLOT FR0;
IF SHOWONLYLASTPERIOD AND !ISNAN(Low(PERIOD = AGGREGATIONPERIOD)[-1]) { FR0 = DOUBLE.NAN;
} ELSE { FR0 = LOWEST(Low(PERIOD = AGGREGATIONPERIOD)[-DISPLACE], PERIODS);
}
PLOT FR38 = FR100 - (FR100 - FR0) * 0.382;
PLOT FR50 = FR100 - (FR100 - FR0) * 0.500;
PLOT FR62 = FR100 - (FR100 - FR0) * 0.618;
PLOT FR79 = FR100 - (FR100 - FR0) * 0.786;
PLOT FR24 = FR100 - (FR100 - FR0) * 0.236;
FR0.SETDEFAULTCOLOR(CREATECOLOR(255, 255, 255));
FR0.SETPAINTINGSTRATEGY(PaintingStrategy.DASHES);
FR24.SETDEFAULTCOLOR(CREATECOLOR(255, 255, 255));
FR24.SETPAINTINGSTRATEGY(PaintingStrategy.DASHES);
FR38.SETDEFAULTCOLOR(CREATECOLOR(255, 255, 255));
FR38.SETPAINTINGSTRATEGY(PaintingStrategy.DASHES);
FR50.SETDEFAULTCOLOR(CREATECOLOR(255, 255, 255));
FR50.SETPAINTINGSTRATEGY(PaintingStrategy.DASHES);
FR62.SETDEFAULTCOLOR(CREATECOLOR(255, 255, 255));
FR62.SETPAINTINGSTRATEGY(PaintingStrategy.DASHES);
FR79.SETDEFAULTCOLOR(CREATECOLOR(255, 255, 255));
FR79.SETPAINTINGSTRATEGY(PaintingStrategy.DASHES);
FR100.SETDEFAULTCOLOR(CREATECOLOR(255, 255, 255));
FR100.SETPAINTINGSTRATEGY(PaintingStrategy.DASHES);
##############################################