Hello,
I was reviewing my trades for the week and noticed that my scanner missed a REALLY good pick that should theoretically have been caught.
I have a scanner that looks for all moving average breaks on the 50, 100, and 200 moving averages.
However, it seemed to have missed $RIVN specifically on July 6th.
My code:
# Moving average break bullish
open[2] is less than SimpleMovingAvg("length" = 50)."SMA" and close[2] is greater than SimpleMovingAvg("length" = 50)."SMA"
or open[2] is less than SimpleMovingAvg("length" = 100)."SMA" and close[2] is greater than SimpleMovingAvg("length" = 100)."SMA"
or open[2] is less than SimpleMovingAvg("length" = 200)."SMA" and close[2] is greater than SimpleMovingAvg("length" = 200)."SMA"
Scanner results with above code ($RIVN is missing):
Updated code by removing 200-day and 100-day conditions:
# Moving average break bullish
open[2] is less than SimpleMovingAvg("length" = 50)."SMA" and close[2] is greater than SimpleMovingAvg("length" = 50)."SMA"
Scanner results with above code ($RIVN is present):
I believe the root cause of the issue is that $RIVN has not traded for 200 days and therefore does not have a 200-day moving average. I think this may be causing the search to fail?
But that begs the question, Is there a way for me to properly account for those kind of scenarios and still show the correct results?
I don't want to have to make 6 different scanners to account for the 3 moving averages for bullish and bearish scenarios...
I was reviewing my trades for the week and noticed that my scanner missed a REALLY good pick that should theoretically have been caught.
I have a scanner that looks for all moving average breaks on the 50, 100, and 200 moving averages.
However, it seemed to have missed $RIVN specifically on July 6th.
My code:
# Moving average break bullish
open[2] is less than SimpleMovingAvg("length" = 50)."SMA" and close[2] is greater than SimpleMovingAvg("length" = 50)."SMA"
or open[2] is less than SimpleMovingAvg("length" = 100)."SMA" and close[2] is greater than SimpleMovingAvg("length" = 100)."SMA"
or open[2] is less than SimpleMovingAvg("length" = 200)."SMA" and close[2] is greater than SimpleMovingAvg("length" = 200)."SMA"
Scanner results with above code ($RIVN is missing):
Updated code by removing 200-day and 100-day conditions:
# Moving average break bullish
open[2] is less than SimpleMovingAvg("length" = 50)."SMA" and close[2] is greater than SimpleMovingAvg("length" = 50)."SMA"
Scanner results with above code ($RIVN is present):
I believe the root cause of the issue is that $RIVN has not traded for 200 days and therefore does not have a 200-day moving average. I think this may be causing the search to fail?
But that begs the question, Is there a way for me to properly account for those kind of scenarios and still show the correct results?
I don't want to have to make 6 different scanners to account for the 3 moving averages for bullish and bearish scenarios...