-
Notifications
You must be signed in to change notification settings - Fork 2
/
ARR VWAP Intraday.pine
72 lines (70 loc) · 1.8 KB
/
ARR VWAP Intraday.pine
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
Script Name: ARR VWAP Intraday
Author: ALLURI_RAJU
Description: Intra day VWAP Strategy
Strategy is
Buy when vwap goes up and RSI above 50 (Can be modified) .
Sell wehn vwap goes down and rsi bellow 50 (Can be modified)
Exit all at market close hour specified
PineScript code:
Pine Script™ strategy
ARR VWAP Intraday
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
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © ALLURI_RAJU
//@version=4
strategy("ARR VWAP Intraday", overlay=true)
starHrs = input(11, title="Trade start Hours", type=input.integer)
endHrs = input(15, title="Close all trade @ Hours", type=input.integer)
rsiPreiod = input(14, title="RSI Period", type=input.integer)
rsiBuy = input(50, title="Buy when RSI above", type=input.integer)
rsiSell = input(50, title="Sell when RSI Bellow", type=input.integer)
isReversal = input(true, title="Exit on Wap Reversal", type=input.bool)
plot(vwap,color=color.black)
o=(open[1]+close[1])/2
h=max(high,close,o)
l=min(low,close,o)
c=(open+high+low+close)/4
longCondition = vwap > vwap[1] and rsi(close,rsiPreiod)>rsiBuy and hour>starHrs and hour<endHrs
if (longCondition)
strategy.entry("Buy", strategy.long)
shortCondition = vwap < vwap[1] and rsi(close,rsiPreiod)<rsiSell and hour>starHrs and hour<endHrs
if (shortCondition)
strategy.entry("Sell", strategy.short)
if(isReversal)
strategy.close("Buy", when = vwap < vwap[1] ,comment = "ExitBuy")
strategy.close("Sell", when =vwap > vwap[1], comment = "ExitSell")
strategy.close_all(when = hour == endHrs , comment = "Exit All")
Expand (32 lines)