Click here to Login

                                                   SMA of SMA return NAN sometimes even though there are enough bars


2018-12-12 04:41:30

I have the following code for my chart

xa = stddev(close, 10);
xar = sma(xa, 30) / xa;
ratio=sma(xar, 40);
Plot(xa, "xa", colorBlue);
Plot(xar, "xar", colorGreen);
Plot(ratio, "ratio");

xa, xar are non-zero, but ratio shows NAN for the current bar for some charts even though the chart has more than 4000 data points.
One example is SIVB. Any idea what may be going on?

2018-12-12 06:47:28


The ratio is plotted correctly. It is only NAN for the first 77 bars.
Please check that your data is correct.
If you still see issues, please contact support with a screenshot.

No more messages


No html code. URLs turn into links automatically.

Type in the trading objects you want to include: - Add Objects
To add a trading object in your message, type in the object name, select it and then click on "Add Objects"


Trading Items
5x5 SMA & RSI Forex Strategy
Cross Above 200 SMA on Average Volume Strategy
SMA - ROC mask
Stock Ranking using Rate of Change and SMA Volume
SMA 50-200

How-to Lessons
How to add future bars to plan for market scenarios
How to detect whether price movements are predictable or not
How to add a trading indicator to a chart
How to create a Monte Carlo simulation
How to get stocks for a particular index using the global script

Related Forum Threads
Angle of an SMA line
Are there any plans to use FIX Protocol?
9 period sma added willr indicator
Multiple days under SMA 50
custom field value is function beta sma

Blog Posts
QuantShare Programming Language Tutorial
Reducing risk and increasing return by combining several trading ...
Programming skills are not that important
6 techniques to improve the performance of your stock trading str...
Select the best ETFs combination to maximize your return and redu...

Create an account
Affiliate Program
Contact Us
Trading Forum
How-to Lessons
About Us
Terms of Use

Copyright 2024
Social Media
Follow us on Facebook
Twitter Follow us on Twitter
Follow us on Google+
RSS Trading Items

Trading financial instruments, including foreign exchange on margin, carries a high level of risk and is not suitable for all investors. The high degree of leverage can work against you as well as for you. Before deciding to invest in financial instruments or foreign exchange you should carefully consider your investment objectives, level of experience, and risk appetite. The possibility exists that you could sustain a loss of some or all of your initial investment and therefore you should not invest money that you cannot afford to lose. You should be aware of all the risks associated with trading and seek advice from an independent financial advisor if you have any doubts.