So I have a script that I saved as a setup scan, which simply does the following (the original script is a bit more complex, but for the sake of the example, I used just this portion which is still not working):
If I create an indicator with the same code that prints a "1" or a "0" if the condition is met, I sometimes see unexpected results.
So the indicator does the following:
which clearly just prints a "1" if the current candle's low is lower than the previous candle's low, otherwise "0".
If I use the scan with Daily timeframe (extra hours unchecked), it works... ie: for all stocks returned, the last candle's low is lower than the previous low, and I will see a "1" on the chart as expected(extra hours turned off on the chart).
But if I switch to 1 hour timeframe on the scanner (extra hours still unchecked), sometimes it doesn't work on the 1hour chart (extra hours turned off), meaning that for some stocks, the low of the last candle isn't lower than the low[1], and the label in consequence shows a "0" as expected. But the scanner still returns it, why?
How can that be?
Code:
plot a = low < low[1];
If I create an indicator with the same code that prints a "1" or a "0" if the condition is met, I sometimes see unexpected results.
So the indicator does the following:
Code:
addLabel(1, low < low[1]);
which clearly just prints a "1" if the current candle's low is lower than the previous candle's low, otherwise "0".
If I use the scan with Daily timeframe (extra hours unchecked), it works... ie: for all stocks returned, the last candle's low is lower than the previous low, and I will see a "1" on the chart as expected(extra hours turned off on the chart).
But if I switch to 1 hour timeframe on the scanner (extra hours still unchecked), sometimes it doesn't work on the 1hour chart (extra hours turned off), meaning that for some stocks, the low of the last candle isn't lower than the low[1], and the label in consequence shows a "0" as expected. But the scanner still returns it, why?
How can that be?
Last edited: