-
Notifications
You must be signed in to change notification settings - Fork 31
Expand file tree
/
Copy path@@rp_Indicator.pine
More file actions
125 lines (124 loc) · 2.94 KB
/
@@rp_Indicator.pine
File metadata and controls
125 lines (124 loc) · 2.94 KB
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
122
123
124
125
Script Name: @@rp_Indicator
Author: nayak_ani
Description: god for long term investment. follow this for momentum investing.
PineScript code:
Pine Script™ strategy
@@rp_Indicator
Copy code
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
//@version=5
strategy(title='@@rp_Indicator', default_qty_type=strategy.percent_of_equity, default_qty_value=100, commission_type=strategy.commission.percent, commission_value=.0020, pyramiding=0, slippage=3, overlay=true)
//----------//
// MOMENTUM //
//----------//
ema55 = ta.ema(close, 55)
ema100 = ta.ema(close, 100)
ema200 = ta.ema(close, 200)
ema21 = ta.ema(close, 21)
plot(ema55, color=color.new(color.red, 0), style=plot.style_line, title='55', linewidth=1)
plot(ema100, color=color.new(color.blue, 0), style=plot.style_line, title='100', linewidth=1)
plot(ema200, color=color.new(color.yellow, 0), style=plot.style_line, title='200', linewidth=1)
plot(ema21, color=color.new(color.orange, 0), style=plot.style_line, title='21', linewidth=1)
//plot(ema34, color=color.new(color.red, 0), style=plot.style_line, title='34', linewidth=1)
//longEmaCondition = ema8 > ema13 and ema13 > ema21 and ema21 > ema34 and ema34 > ema55
//exitLongEmaCondition = ema13 < ema55
//shortEmaCondition = ema8 < ema13 and ema13 < ema21 and ema21 < ema34 and ema34 < ema55
//exitShortEmaCondition = ema13 > ema55
// ---------- //
// OSCILLATORS //
// ----------- //
//rsi = rsi(close, 14)
//longRsiCondition = rsi < 70 and rsi > 40
//exitLongRsiCondition = rsi > 70
//shortRsiCondition = rsi > 30 and rsi < 60
//exitShortRsiCondition = rsi < 30
// Stochastic
//length = 14, smoothK = 3, smoothD = 3
//kFast = stoch(close, high, low, 14)
//dSlow = sma(kFast, smoothD)
//longStochasticCondition = kFast < 80
//exitLongStochasticCondition = kFast > 95
//shortStochasticCondition = kFast > 20
//exitShortStochasticCondition = kFast < 5
//----------//
// STRATEGY //
//----------//
//longCondition = longEmaCondition and longRsiCondition and longStochasticCondition and strategy.position_size == 0
//exitLongCondition = (exitLongEmaCondition or exitLongRsiCondition or exitLongStochasticCondition) and strategy.position_size > 0
///if (longCondition)
// strategy.entry("LONG", strategy.long)
//if (exitLongCondition)
// strategy.close("LONG")
//
//shortCondition = shortEmaCondition and shortRsiCondition and shortStochasticCondition and strategy.position_size == 0
//exitShortCondition = (exitShortEmaCondition or exitShortRsiCondition or exitShortStochasticCondition) and strategy.position_size < 0
//if (shortCondition)
// strategy.entry("SHORT", strategy.short)
//if (exitShortCondition)
// strategy.close("SHORT")
Expand (66 lines)