Hello,
I'm having an issue getting the correct signal from my indicator.
Previously the line of code stated ( if x > 1) and it signalled correctly
now i want it to signal if x is between 1 and 2, but the back test seem erratic, I'm using the code below
if (x > 1 && x < 2)
it seems as though it'll trigger at any level above 1 and not be capped by level 2
is there a better way of coding this, if so could anyone help please?
Many thanks
what else is in that part of the code ?
Hello,
I'm having an issue getting the correct signal from my indicator.
Previously the line of code stated ( if x > 1) and it signalled correctly
now i want it to signal if x is between 1 and 2, but the back test seem erratic, I'm using the code below
if (x > 1 && x < 2)
it seems as though it'll trigger at any level above 1 and not be capped by level 2
is there a better way of coding this, if so could anyone help please?
Many thanks
Hello,
I'm having an issue getting the correct signal from my indicator.
Previously the line of code stated ( if x > 1) and it signalled correctly
now i want it to signal if x is between 1 and 2, but the back test seem erratic, I'm using the code below
if (x > 1 && x < 2)
it seems as though it'll trigger at any level above 1 and not be capped by level 2
is there a better way of coding this, if so could anyone help please?
Many thanks
if (x > 1 && x < 2) is correct. Check how x is calculated — maybe it's not updating or has floating-point issues. Use Print(x) for debugging.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello,
I'm having an issue getting the correct signal from my indicator.
Previously the line of code stated ( if x > 1) and it signalled correctly
now i want it to signal if x is between 1 and 2, but the back test seem erratic, I'm using the code below
if (x > 1 && x < 2)
it seems as though it'll trigger at any level above 1 and not be capped by level 2
is there a better way of coding this, if so could anyone help please?
Many thanks