[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Re: Trying to understand BarCount



PureBytes Links

Trading Reference Links

Plot Barcount, Cum(1) and BarIndex() and you will see it all.
If you see anything you don't understand ask again.

BarIndex() is dynamic in indicators.

Plotting is my debugger.



--- In amibroker@xxxxxxxxxxxxxxx, "donpickdonpick" <donpick1@xxx> 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 );
>




------------------------------------

**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to 
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/