A request that was addressed to ProRealTime:
I have a function ConnorsRSI in AmiBroker and would like to convert to ProRealCode
Can you help me?
Suggestion for an anwser:
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
PeriodRSI= 3
PeriodUpdownlength= 2
PeriodROC= 100
Once UpLenght= 0
Once DownLenght= 0
Once updownDays= 0
MyRSI= RSI [ PeriodRSI] (close )
MyROC= ROC [ PeriodROC] (close )
if barindex > 0 then
if close > close [ 1 ] then
upDay= 1
downDay= 0
elsif close < close [ 1 ] then
downDay= 1
upDay= 0
else
downDay= 0
upDay= 0
endif
if upDay <> 0 then
UpLenght= UpLenght[ 1 ] + upDay
else
UpLenght= 0
endif
if downDay <> 0 then
DownLenght= DownLenght[ 1 ] + downDay
else
DownLenght= 0
endif
updownDays = UpLenght + DownLenght
endif
MyRSILenght= RSI [ PeriodUpdownlength] (updownDays)
ConnorsRSI= (MyRSI+ MyROC+ MyRSILenght )/ 3
return ConnorsRSI