I'm using
DailySMA("length" = 3)[1]/DailySMA("length" = 3)
in a strategy for spy on a 5min chart. It works all week except from Friday at 8pm till Monday about 1am it results in "n/a" which crashes my script.
I have tried multiple things but not sure what I'm doing, for example
CompoundValue(1,if !IsNaN(DailySMA("length" = 3)[1]/DailySMA("length" = 3)) then DailySMA("length" = 3)[1]/DailySMA("length" = 3) else 2,1)
Which still gives me "n/a" but for some reason when my curser is off the chart gives me "2"
I just need to figure out how when it gives me a "n/a" to change it to a number, like "1".
Thanks for any help.
DailySMA("length" = 3)[1]/DailySMA("length" = 3)
in a strategy for spy on a 5min chart. It works all week except from Friday at 8pm till Monday about 1am it results in "n/a" which crashes my script.
I have tried multiple things but not sure what I'm doing, for example
CompoundValue(1,if !IsNaN(DailySMA("length" = 3)[1]/DailySMA("length" = 3)) then DailySMA("length" = 3)[1]/DailySMA("length" = 3) else 2,1)
Which still gives me "n/a" but for some reason when my curser is off the chart gives me "2"
I just need to figure out how when it gives me a "n/a" to change it to a number, like "1".
Thanks for any help.