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

[amibroker] Re: Value of BarCount



PureBytes Links

Trading Reference Links

If I add

WriteVal( BeginValue( DateTime() ), formatDateTime );
WriteVal( EndValue( DateTime() ), formatDateTime );

to the code then the calculations are done right. 
But can anybody tell me why?

BTW:
I forgot the "."
the below mentioned wrong values were 159.000 and 217.000

Regards
mmike

--- In amibroker@xxxxxxxxxxxxxxx, "mmike8090" <mmike8090@xxx> wrote:
>
> Hi,
> 
> I had the intention to count all days that are trending according 
to 
> Aroon-Indicator Definitions and write down the result to the 
> interpretation area.
> 
> I made  the following script and to my surprise I get variable 
values 
> of BarCount and all depending calculations. 
> For example if I mark the Chart in the Year 2007 Barcount shows the 
> Ammount of 217000, in the Year 1962 Barcount is 159000. Furthermore 
> the same results (159000 and 217000) occur in in different stocks 
> with different length of hostory.
> 
> I am can´t find the error/reason for that way of calculation.
> I hope that somebody can help me. Thanks a lot!
> 
> MMike
> 
> PS: Heres the script
> 
> // AROON_COUNTER.AFL 
> 
> //
> // INITIALIZATION OF PARAMETERS AND VARIABLES
> //
> P = ParamField( "Price field" );
> Period = Param("Period", 14, 1, 200, 1 );
> TrendDays=0;
> AllDays=0;
> 
> //
> // AROON INDICATORS
> //
> 
> LLVBarsSince = LLVBars(L, Period) + 1;
> HHVBarsSince = HHVBars(H, Period) + 1;
> 
> Aroon_Down = 100 * (Period - LLVBarsSince) / (Period - 1);
> Aroon_Up   = 100 * (Period - HHVBarsSince) / (Period - 1);
> Aroon_Osc  = Aroon_Up - Aroon_Down;
> 
> //
> // COUNT TRENDING DAYS
> //
> 
> for( i = 0; i < BarCount; i++ ) // Loop through all bars
>     { 
>       AllDays++; // Count all days
>       if	(Aroon_Down[i]>=70  AND Aroon_Up[i] <=30 OR
>     		 Aroon_Down[i]<=30 AND Aroon_Up[i] >=70)
>       	{
>     		TrendDays++; // Count Aroon trenddays
>     	}
>     } 
> 
> result = IIf	(((Aroon_Down>=70  AND Aroon_Up<=30) OR 
> 		 (Aroon_Down<=30 AND Aroon_Up>=70)), colorLime, 
> colorBlack);
> 	
> Plot( Close, "Price", result, styleCandle );
> 
> printf("Aroon Down \n");  
> WriteVal( Aroon_Down ); 
> printf("Aroon Up \n");  
> WriteVal( Aroon_Up ); 
> printf("Aroon Osc. \n");  
> WriteVal( Aroon_Osc ); 
> printf("All Days \n");  
> WriteVal( AllDays ); 
> printf("Trend Days \n");  
> WriteVal( TrendDays ); 
> printf("Aroon Trend Days \n");  
> WriteVal( TrendDays/AllDays ); 
> printf("BarCount \n");  
> WriteVal( BarCount ); 
> printf("BarCount-1 \n");  
> WriteVal( BarCount-1 ); 
> 
> 
> //
>



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

Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

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

For other support material please check also:
http://www.amibroker.com/support.html
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/