Author Topic: Absurd behavior or not?  (Read 3333 times)

siligard

  • Newbie
  • *
  • Posts: 2
    • View Profile
Absurd behavior or not?
« on: April 28, 2012, 02:45:11 pm »
I am evaluating Amibroker and experienced absurd things.
Maybe someone can help.

Consider the following simple formula:


Code: [Select]
_SECTION_BEGIN("TEST");
for( i = 0; i < BarCount; i++ )
   {
   Equity01[i]=C[i]/C[0];
   }
Plot(Equity01, "Equity01", colorRed, styleLine, Null, Null, 0 );
Plot(1, "reference level", colorBlack, styleLine, Null, Null, 0 );
_SECTION_END();


When plotted in a chart it shows a horizontal reference line at level 1 and quotients of adjacent closing prices (equity01).
The problem becomes clearly apparent when scrolling the chart. The Equity01 line may be above 1 for a bar and then after a simple
scroll it may fall below 1 for the same bar. Am I missing something?

Thanks
Giorgos

 


siligard

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Absurd behavior or not?
« Reply #1 on: April 28, 2012, 07:11:17 pm »
Never mind.
I found the solution in Amibroker Knowledge Base (http://www.amibroker.com/kb/).

The function:
 
Code: [Select]
SetBarsRequired( sbrAll, sbrAll );
must be put in the beginning of the code to instruct Amibroker to use all loaded data in calculations
(not only the data from the visible part of the chart).

Giorgos