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

Re: [amibroker] Re: Heikin-Ashi code modification as per e-signal help needed:



PureBytes Links

Trading Reference Links

>From what i see HaOpen calculated in e-signal uses (open+close)/2
>previous bar and afl formula does it with close only/2??? I am not
>afl programmer,

No. It is perfectly the same.
 
It uses:
 
HAOpen = prev(Haclose)/2 + prev(HAOpen)/2;
 
This is the way how AMA function works
 
 
AMA function works so it implements recursive algorithm.
 
output = AMA( input, factor )
 
is equivalent to the following looping code:
 
for( i = 1; i < BarCount; i++ )
{
   output[ i ] = factor[ i ] * input[ i ] + ( 1 - factor[ i ] ) * output[ i - 1 ];
}
 
In Heikin-Ashi code you see this:
 
HaOpen = AMA( Ref( HaClose, -1 ), 0.5 );
 
So, now replace input with YesterdayHAClose, factor with 0.5 and output with HAOpen and you will
get:
 
for( i = 1; i < BarCount; i++ )
{
   HaOpen[ i ] = 0.5 * YesterdayHAClose[ i ] + ( 1 - 0.5 ) * HaOpen[ i - 1 ];
}
 
Where HAOpen[ i ] is current bar value of HAOpen, and HAOpen[ i - 1 ] is PREVIOUS bar value of HAOpen.
 
So it is exactly equivalent to:
 
HAOpen = AMA( YesterdayHAClose, 0.5 );
 
And since YEsterdayHAClose is Ref( HAClose, -1 ) we can write:
 
HaOpen = AMA( Ref( HaClose, -1 ), 0.5 );
 
Quod erat demonstrandum.

Best regards,
Tomasz Janeczko
amibroker.com

Hi Tomasz,
Thanks for a reply, woodie from cci club uses e-signal formula quite
well and we both had IB data with different results using Heikin
Ashi today.
>From what i see HaOpen calculated in e-signal uses (open+close)/2
previous bar and afl formula does it with close only/2??? I am not
afl programmer,
and i don't doubt that afl language is shorter... but could there be
still difference in results cause of HaOpen calculations in both?
tia, Ben






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





SPONSORED LINKS
Investment management software Real estate investment software Investment property software
Software support Real estate investment analysis software Investment software


YAHOO! GROUPS LINKS