I am working on some coding for an indicator. The basic code is as follows:
if (IndicatorA[4].ApproxCompare(20)==0 && IndicatorA[3] !=50)
Do something.
I am finding that "Do something" occurs even when IndicatorA[3] == 50, which is not what I want. What is the problem with my code (I suspect it may be to do with the not equal to statement)?
Also, if I want to do some calculations on bars either side of a swing high, what is the easiest way to identify the swing high and then the barsAgo of the bars either side of it?
Thank you
Comment