Optuma Forums › Optuma Scripting › Valuewhen() › Reply To: Valuewhen()

- Topics: 14
- Replies: 18
- Posts: 32
Thanks Mathew! It works fine on current swing.
As I want to compare the corresponding RSI values at previous swing ends, I used the scripts below but did not work out (As attached, value of R1 in lower panel is the same as R0 in upper one somehow).
I believe I should use the dot notation as recommended in the article for both current scanning and backtesting purposes.
//Gann Swings
//Current Swing
S0 = SWINGEND(GANNSWING(SWINGCOUNT=2, DEFAULT=SwingList, METHOD=Use Next Bar));
//Previous Swings
S1 = OFFSET(S0, OFFSET=1);
S2 = OFFSET(S0, OFFSET=2);
//Swing Ends
SE0 = S0.SWINGEND();
SE1 = S1.SWINGEND();
//Corresponding RSI value of the Swings
R0 = VALUEWHEN(RSI(BARS=14),SE0);
R1 = VALUEWHEN(RSI(BARS=14),SE1);
R1
Attachments:
You must be logged in to access attached files.