- Topics: 29
- Replies: 1,472
- Posts: 1,501
It’s a little hard without all the information on the other plot. You are comparing this to a plot which we do not have the script for so we can not see why one would be going negative and the other not. Unless I am not understanding why you are highlighting the two plots.
One thing I did notice is that both your and Trevor’s scripts will go to 0. The issue is that a nested IF gives you three states but you only want two. Also you have “>=” for both tests in your if statements.
Using a switch is a much better way to achieve what you are looking for and using a crosses is also better as we want a “switch” condition rather than a “state” condition.
Var4 = SWITCH(Var3 CrossesAbove 0.3, Var3 CrossesBelow -0.3);
All the best
- This reply was modified 1 week, 3 days ago by Mathew. Reason: Changed to crosses