Optuma Forums › Optuma Scripting › How to calculate positive and negative divergences › Reply To: How to calculate positive and negative divergences
- Topics: 2
- Replies: 3
- Posts: 5
I’ve been trying to apply this technique to show divergence between price and the non lag inverse fisher transform of RSX.
I’ve altered the code as follows:
//Negative NLRSX divergence
NL1 = NLRSX(BARS=13, NLBARS=8);
//calculate 10 pivot NLRSX high
P1 = PIVOT(NL1, MIN=10, TYPE=High);
//get value of the NLRSX peak
V1 = VALUEWHEN(NL1, P1 <> 0);
//Is NLRSX high < previous>?
Sig1 = V1 < V1;
//get stock value at NLRSX peak
V2 = VALUEWHEN(Close(), P1 <> 0);
//Is stock price higher than at previous NLRSX peak?
Sig2 = V2 > V2;
//Show when both conditions are true
Sig1 and Sig2
On the attached chart, I’m getting a result for divergences between A and B and also C and D, but not that between B and C.
However when I alter the pivot line to a value of 6, divergence A to B, and B to C is shown, but not C to D.
What do I need to do in order to have divergences A to B, B to C and C to D show up?