You may find the following article from the Knowledge Base helpful. Be sure to read through to the bottom where the definitions being sought are explained.
http://www.amibroker.com/kb/2008/07/03/quickafl/ Mike --- In [email protected], "donpickdonpick" <donpi...@...> wrote: > > Below is some code which finds buy and sell points based on ATR. I am still > learning afl code. > > My question is regarding the construct: > for( i = 4; i < BarCount; i++ ) > > What is the value of BarCount? Is this examining the 4 most recent > barcounts? > > How many barcounts are being processed? All of them available for a symbol? > > Thank you for your help. > > > for( i = 4; i < BarCount; i++ ) > { > if( L[ i ] >= L[ i-2 ] AND > L[ i-1 ] >= L[ i-2 ] AND > L[ i-3 ] >= L[ i-2 ] AND > L[ i-4 ] >= L[ i-2 ] ) > { > support[ i ] = L[ i - 2]; > } > else > if( L[ i ] > H[ i-1 ] * 1.0013 ) > { > support[ i ] = H[ i-1 ] * 0.9945; > } > else > if( L[ i ] > support[ i-1 ] * 1.1 ) > { > support[ i ] = support[ i-1 ] * 1.05; > } > else > { > support[ i ] = support[ i-1 ]; > } > > if( H[ i ] > trends[ i-1 ] AND > H[ i-1 ] > trends[ i-1 ] ) > { > trends[ i ] = Max( trends[ i-1 ], support[ i ] ); > } > else > if( H[ i ] < trends[ i-1 ] AND > H[ i-1 ] < trends[ i-1 ] ) > { > trends[ i ] = Min( trends[ i-1 ], resistance[ i ] ); > } > else > if( H[ i ] >= trends[ i-1 ] ) > trends[ i ] = support[ i ]; > else > trends[ i ] = resistance[ i ]; > > } > > Plot( trends, "Trends", colorRed ); > Plot ( C, "Price", colorBlack, styleCandle ); > //Plot( C, "Price", colorBlack, styleBar ); - Original > Buy = Cross( C, trends ); > Sell = Cross( trends, H ); >
