The recommendation will not produce the desired result.
Independent from vars-Declaration [RSID2_Tick(0) or RSID2_Tick(0, Data2)]
I'm getting with this code ....
Code: Select all
once cleardebug;
vars: RSID2(0, data2), RSID2_Tick(0);
RSID2 = RSI(Close of Data2, 14) of Data2; // org. RSI for Data2 (reference)
RSID2_Tick = RSI(Close of Data2, 14) of Data2; // Reset: RSI2_Tick = RSI for Data2
RSID2_Tick = RSI(Close, 14) of Data2; // Update with Close (Example 1)
if (Date = 1140127) and (Time_s >= 202246) and (time_s < 202328) then begin
Print(FormatDate("dd.MM.yy", el_datetodatetime(Date)) + " " + FormatTime("HH:mm:ss", el_timetodatetime_s (time_s))
+ " BarN2=" + NumToStr(Symbol_CurrentBar of Data2,0) + " BarN1=" + NumToStr(Symbol_CurrentBar,0)
+ " C2=" + NumToStr(Close of Data2, 1) + " C1=" + NumToStr(C,1)
+" RSID2="+NumToStr(RSID2,2) + " RSID2_Tick="+NumToStr(RSID2_Tick,2)
+ " RSI1="+NumToStr(RSI(Close, 14),2));
end;
... the following results:
Test 1: RSID2_Tick = RSI(Close, 14) of Data2 (like in the code above)
27.01.14 20:22:46 BarN2=885 BarN1=45280 C2=9369.0 C1=9365.0 RSID2=69.88 RSID2_Tick=69.88 RSI1=48.49
27.01.14 20:22:46 BarN2=885 BarN1=45281 C2=9369.0 C1=9364.0 RSID2=69.88 RSID2_Tick=69.88 RSI1=42.89
27.01.14 20:23:04 BarN2=885 BarN1=45282 C2=9369.0 C1=9363.0 RSID2=69.88 RSID2_Tick=69.88 RSI1=38.15
27.01.14 20:23:10 BarN2=885 BarN1=45283 C2=9369.0 C1=9362.5 RSID2=69.88 RSID2_Tick=69.88 RSI1=36.00
27.01.14 20:23:14 BarN2=886 BarN1=45284 C2=9361.5 C1=9361.5 RSID2=62.64 RSID2_Tick=62.64 RSI1=32.11
27.01.14 20:23:21 BarN2=886 BarN1=45285 C2=9361.5 C1=9361.0 RSID2=62.64 RSID2_Tick=62.64 RSI1=30.35
27.01.14 20:23:25 BarN2=886 BarN1=45286 C2=9361.5 C1=9360.0 RSID2=62.64 RSID2_Tick=62.64 RSI1=27.14
Result: always RSID2_Tick = RSID2.
(Change of RSID2_Tick only with Bar2-change from 885 to 886)
Test 2: RSID2_Tick = RSI(Close, 14);
27.01.14 20:22:46 BarN2=885 BarN1=45280 C2=9369.0 C1=9365.0 RSID2=69.88 RSID2_Tick=48.49 RSI1=48.49
27.01.14 20:22:46 BarN2=885 BarN1=45281 C2=9369.0 C1=9364.0 RSID2=69.88 RSID2_Tick=42.89 RSI1=42.89
27.01.14 20:23:04 BarN2=885 BarN1=45282 C2=9369.0 C1=9363.0 RSID2=69.88 RSID2_Tick=38.15 RSI1=38.15
27.01.14 20:23:10 BarN2=885 BarN1=45283 C2=9369.0 C1=9362.5 RSID2=69.88 RSID2_Tick=36.00 RSI1=36.00
27.01.14 20:23:14 BarN2=886 BarN1=45284 C2=9361.5 C1=9361.5 RSID2=62.64 RSID2_Tick=32.11 RSI1=32.11
27.01.14 20:23:21 BarN2=886 BarN1=45285 C2=9361.5 C1=9361.0 RSID2=62.64 RSID2_Tick=30.35 RSI1=30.35
27.01.14 20:23:25 BarN2=886 BarN1=45286 C2=9361.5 C1=9360.0 RSID2=62.64 RSID2_Tick=27.14 RSI1=27.14
Result: always RSID2_Tick = RSI1 (= RSI(Close, 14)).
(Desired result must be, only at 20:23:14, with C2 = C1: RSID2_Tick = RSID2 )
Therefore the question is still: how I can update RSI of Data2 with Close of Data1 (between Bar2-changes)
like it happens in the chart?