forked from zonquan/TradeStation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsfgf.harami.txt
84 lines (68 loc) · 3.07 KB
/
sfgf.harami.txt
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
[LegacyColorValue = true];
{
Function : sfgf.harami
Description : Identify a Harami Candlestick Pattern
Copyright 2016 Scottfree Gains LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
}
Variables:
RPClose(0.0),
RPOpen(0.0),
RPLimit(0.45),
RRLimit(0.60),
Harami1(False),
Harami2(False),
Harami3(False);
sfgf.harami = 0;
RPClose = sfgf.rangepct(Close, High, Low);
RPOpen = sfgf.rangepct(Open, High, Low);
If Range[1] > 0 and Range[2] > 0 and Range[3] > 0 Then Begin
Condition1 = Low >= Low[1] and High <= High[1];
Condition2 = Close > Open;
Condition3 = RPClose[1] <= RPLimit and RPOpen[1] >= (1 - RPLimit);
Condition4 = (Range / Range[1]) <= RRLimit;
Harami1 = Condition1 and Condition2 and Condition3 and Condition4;
Condition1 = Low >= Low[2] and High <= High[2];
Condition2 = Low[1] >= Low[2] and High[1] <= High[2];
Condition3 = Close > Open;
Condition4 = RPClose[2] <= RPLimit and RPOpen[2] >= (1 - RPLimit);
Condition5 = (Range / Range[2]) <= RRLimit;
Harami2 = Condition1 and Condition2 and Condition3 and Condition4 and Condition5;
Condition1 = Low >= Low[3] and High <= High[3];
Condition2 = Low[1] >= Low[3] and High[1] <= High[3];
Condition3 = Low[2] >= Low[3] and High[2] <= High[3];
Condition4 = Close > Open;
Condition5 = RPClose[3] <= RPLimit and RPOpen[3] >= (1 - RPLimit);
Condition6 = (Range / Range[3]) <= RRLimit;
Harami3 = Condition1 and Condition2 and Condition3 and Condition4 and Condition5 and Condition6;
If Harami1 or Harami2 or Harami3 Then
sfgf.harami = 1;
Condition1 = Low >= Low[1] and High <= High[1];
Condition2 = Close < Open;
Condition3 = RPOpen[1] <= RPLimit and RPClose[1] >= (1 - RPLimit);
Condition4 = (Range / Range[1]) <= RRLimit;
Harami1 = Condition1 and Condition2 and Condition3 and Condition4;
Condition1 = Low >= Low[2] and High <= High[2];
Condition2 = Low[1] >= Low[2] and High[1] <= High[2];
Condition3 = Close < Open;
Condition4 = RPOpen[2] <= RPLimit and RPClose[2] >= (1 - RPLimit);
Condition5 = (Range / Range[2]) <= RRLimit;
Harami2 = Condition1 and Condition2 and Condition3 and Condition4 and Condition5;
Condition1 = Low >= Low[3] and High <= High[3];
Condition2 = Low[1] >= Low[3] and High[1] <= High[3];
Condition3 = Low[2] >= Low[3] and High[2] <= High[3];
Condition4 = Close < Open;
Condition5 = RPOpen[3] <= RPLimit and RPClose[3] >= (1 - RPLimit);
Condition6 = (Range / Range[3]) <= RRLimit;
Harami3 = Condition1 and Condition2 and Condition3 and Condition4 and Condition5 and Condition6;
If Harami1 or Harami2 or Harami3 Then
sfgf.harami = 2;
End;