Hi, I have a 5 minute chart setup and is there any particular reason that when I call getInterval(), it returns NaN? Thanks.
Announcement
Collapse
No announcement yet.
getInterval() returning NaN
Collapse
X
-
Ok, it is a little bizaare. It does return 5 on my friend's chart, but on mine, it returns "5MIN"
Any reason for this discrepancy? Both are on eSignal 8 and I've tested this on esignal 7.9 also. It seems like it only happens on mine.
Originally posted by Alexis C. Montenegro
mazachan
As far as I know it should return 5 if you are running the script on a 5 minute chart.
You may want to post the code that you are using and that is returning NaN
Alex
Comment
-
mazachan
I think the reason could be related to how you are loading the interval in the chart.
If you are typing 5min then getInterval() will return 5MIN as that is a valid input in an Advanced Chart (as is 5m). See the enclosed animated gif showing you the intervals returned to the Formula Output Window.
Anyhow for minute based intervals all you need to do is type the number equivalent to the minutes and click OK or press <Enter>
If instead you prefer to input 5m or 5min then you need to isolate the number from the string returned by getInterval(). An easy way to do this is to use for example parseInt(getInterval()) which will return 5 even if you input 5m or 5min as the interval
Alex
Comment
Comment