{"id":1100,"date":"2015-01-28T13:57:01","date_gmt":"2015-01-28T18:57:01","guid":{"rendered":"http:\/\/www.amibroker.com\/kb\/?p=1100"},"modified":"2015-02-12T14:05:08","modified_gmt":"2015-02-12T19:05:08","slug":"why-analysis-results-and-chart-output-may-differ","status":"publish","type":"post","link":"https:\/\/www.amibroker.com\/wordpress\/kb\/2015\/01\/28\/why-analysis-results-and-chart-output-may-differ\/","title":{"rendered":"Why Analysis results and Chart output may differ"},"content":{"rendered":"

In general AFL functions return identical results when the input data and settings are the same, no matter if they are called from the chart formula or from Analysis window.<\/p>

Therefore, when we observe differences in results obtained in the chart vs results in Analysis window out of the same code, we should check the following settings to make sure we indeed provide identical input to our formula.<\/p>

First thing to check is the data interval used in the chart and in Analysis window – it needs to be identical<\/p>

Chart:<\/strong>
\"Chart<\/p>

Analysis:<\/strong>
\"Analysis<\/p>

Second thing to check, is that if we use Param() function in the code – we need to remember that parameters are separate for Analysis window (Analysis module has ChartID equal to 0). Therefore – it is necessary to keep the parameter settings in sync:<\/p>

\"Parameters<\/p>

Third thing to check is the Pad and align data to reference symbol<\/strong> option that may affect input data for Analysis window calculations if there are differences in quotes or timestamps between the analysed ticker and the reference symbol, so unchecking this option may be required:<\/p>

\"Pad<\/p>

Last thing, is that if we calculate our indicators recursively in loops or use functions such as Cum() where results may depend on the number of loaded bars, then we also need to verify if e.g. chart zoom range makes any difference for our results in the chart.<\/p>

AmiBroker uses its QuickAFL feature to optimize loaded data-range for best performance, however if our code is sensitive to a number of loaded bars, we may need to e.g. force loading certain number of historical bars with SetBarsRequired<\/strong>() function.<\/p>

More information about QuickAFL can be found in the following KB article:
http:\/\/www.amibroker.com\/kb\/2008\/07\/03\/quickafl\/<\/a><\/p>","protected":false},"excerpt":{"rendered":"

In general AFL functions return identical results when the input data and settings are the same, no matter if they are called from the chart formula or from Analysis window.Therefore, when we observe differences in results obtained in the chart vs results in Analysis window out of the same code, we should check the following […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[57],"tags":[],"_links":{"self":[{"href":"https:\/\/www.amibroker.com\/wordpress\/kb\/wp-json\/wp\/v2\/posts\/1100"}],"collection":[{"href":"https:\/\/www.amibroker.com\/wordpress\/kb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.amibroker.com\/wordpress\/kb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.amibroker.com\/wordpress\/kb\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.amibroker.com\/wordpress\/kb\/wp-json\/wp\/v2\/comments?post=1100"}],"version-history":[{"count":2,"href":"https:\/\/www.amibroker.com\/wordpress\/kb\/wp-json\/wp\/v2\/posts\/1100\/revisions"}],"predecessor-version":[{"id":1106,"href":"https:\/\/www.amibroker.com\/wordpress\/kb\/wp-json\/wp\/v2\/posts\/1100\/revisions\/1106"}],"wp:attachment":[{"href":"https:\/\/www.amibroker.com\/wordpress\/kb\/wp-json\/wp\/v2\/media?parent=1100"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.amibroker.com\/wordpress\/kb\/wp-json\/wp\/v2\/categories?post=1100"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.amibroker.com\/wordpress\/kb\/wp-json\/wp\/v2\/tags?post=1100"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}