PureBytes Links
Trading Reference Links
|
The original H-A algorithm has so little smoothing that it is often
modified - usually adding more smoothing.
Here is another modified H-A indicator from a TASC article a few years
ago. Note that while the framework is AB Formula Language, the actual
calculations are done in JavaScript which can be invoked from within *.afl
(The JavaScript language is embedded in the Windows operating system.)
********************************
// Modified Heikin-Ashi Translated from EasyLanguage code
// Ed Hoopes
// July 2005
EnableScript( "jscript");
haClose = (Open+High+Low+Close)/4;
haOpen[0] = Open[0];
for (e = 1; e < BarCount; e++)
{
haOpen[e] = (Open[e - 1] + haClose[e - 1]) / 2;
}
<% // JavaScript now;
JShaClose = VBArray( AFL( "haClose" ) ).toArray();
JShaOpen = VBArray( AFL( "haOpen" ) ).toArray();
JSHigh = VBArray( AFL( "High" ) ).toArray();
JSLow = VBArray( AFL( "Low" ) ).toArray();
haHigh = new Array();
haLow = new Array();
haColor = new Array();
// Load the haHigh and haLow arrays and assign a color to each bar;
for (f = 0; f < JShaClose.length; f++)
{
haHigh[f] = Math.max( JSHigh[f], JShaOpen[f], JShaClose[f] );
haLow[f] = Math.min( JSLow[f], JShaOpen[f], JShaClose[f] );
if(JShaClose[f] > JShaOpen[f]) haColor[f] = 1.00; else haColor[f] =
0.00;
}
for (g = 7; g < JShaClose.length; g++)
{
for(k = -6; k < 0; k++ )
{
if(
( JShaOpen[g] <= Math.max( JShaOpen[g + k], JShaClose[g + k] )) &&
( JShaOpen[g] >= Math.min( JShaOpen[g + k], JShaClose[g + k] )) &&
(JShaClose[g] <= Math.max( JShaOpen[g + k], JShaClose[g + k] )) &&
(JShaClose[g] >= Math.min( JShaOpen[g + k], JShaClose[g + k] )) )
haColor[g] = haColor[g + k];
}
}
AFL( "haHigh" ) = haHigh;
AFL( "haLow" ) = haLow;
AFL( "haColor" ) = haColor;
%> //End of JavaScript;
PlotOHLC( HaOpen, HaHigh, HaLow, HaClose, "H-A Mod" + Name(),
IIf(haColor == 0, colorRed, colorLime), styleCandle );
*********************************
--- In equismetastock@xxxxxxxxxxxxxxx, "Ed Hoopes" <reefbreak_sd@xxx>
wrote:
>
> I'm glad to hear that MS users have access to the H-A indicators.
>
> On the general topic of smoothing - here are two other smoothers that
> I have found useful:
>
> 1. Kalman filters - often used to smooth noisy data in electronics
> work well.
> 2. statistical smoothing which aggregate the data over many stocks to
> produce an indicator - has produced my best results. I have not seen
> these covered in any TA book. Sometimes they are called 'difussion
> indicators' without any further discussion.
>
> ReefBreak
>
>
> --- In equismetastock@xxxxxxxxxxxxxxx, pumrysh <no_reply@> wrote:
> >
> > As a subscriber to Roy's newsletter you would have a solution to
> > this.
> >
> > Preston
> >
> >
> >
> > --- In equismetastock@xxxxxxxxxxxxxxx, "Ed Hoopes"
> > <reefbreak_sd@> wrote:
> > >
> > > As a former user of MetaStock software, I can comment on why the
> > > indicator is not programmed for MS. The MetaStock formula language
> > > does not have nearly enough functions to implement the code.
> > >
> > > Below, I show the indicator programmed in AmiBroker by Tomasz
> > Janeczko.
> > >
> > > Here is an incomplete list of required functions that MS lacks:
> > > IIF - an immediate IF function that works on data arrays
> > > IF - a conditional execution statement that allows blocks of
> > > statements to be conditionally executed
> > > Hold - holds a logic true/false in a certain state for a number of
> > bars
> > > AMA - an adaptive moving average function
> > > ParamToggle - switches the logic state of a variable
> > > Flip - works like an electrical FlipFlop logic circuit
> > > StyleArea & StyleOwnScale - allows proper plotting of Heikin bars.
> > >
> > > If you wanted to implement this indicator in MS you would need to
> > buy
> > > the software developers kit which has software hooks into the MS
> > > package. Plus buy some fully capable language compiler like C++.
> > >
> > > Or, for $199 you could buy AB and use the code below :)
> > >
> > > ***********************
> > >
> > > HA Candelstick Oscillator in AmiBroker;
> > >
> > > function ZeroLagTEMA( array, period )
> > > {
> > > TMA1 = TEMA( array, period );
> > > TMA2 = TEMA( TMA1, period );
> > > Diff = TMA1 - TMA2;
> > > return TMA1 + Diff ;
> > > }
> > >
> > > /////////////////////
> > > // Heikin-Ashi code
> > > HaClose = (O+H+L+C)/4;
> > > HaOpen = AMA( Ref( HaClose, -1 ), 0.5 );
> > >
> > > avp = Param("Up TEMA avg", 34, 1, 100 );
> > > avpdn = Param("Dn TEMA avg", 34, 1, 100 );
> > >
> > > // Velvoort is using not original, but modified Heikin-Ashi close
> > > HaClose = ( HaClose + HaOpen + Max( H, HaOpen ) + Min( L,
> > HaOpen ) )/4;
> > >
> > > // up average
> > > ZlHa = ZeroLagTEMA( HaClose, avp );
> > > ZlCl = ZeroLagTEMA( ( H + L ) / 2, avp );
> > > ZlDif = ZlCl - ZlHa;
> > >
> > > keep1 = Hold( HaClose >= HaOpen, 2 );
> > > keep2 = ZlDif >= 0;
> > > keeping = keep1 OR keep2;
> > > keepall = keeping OR ( Ref( keeping, -1 ) AND ( C > O ) OR C >= Ref
> > (
> > > C, -1 ) );
> > > keep3 = abs( C - O ) < ( H - L ) * 0.35 AND H >= Ref( L, -1 );
> > > utr = keepall OR ( Ref( keepall, -1 ) AND keep3 );
> > >
> > > // dn average
> > > ZlHa = ZeroLagTEMA( HaClose, avpdn );
> > > ZlCl = ZeroLagTEMA( ( H + L ) / 2, avpdn );
> > > ZlDif = ZlCl - ZlHa;
> > >
> > > keep1 = Hold( HaClose < HaOpen, 2 );
> > > keep2 = ZlDif < 0;
> > > keeping = keep1 OR keep2;
> > > keepall = keeping OR ( Ref( keeping, -1 ) AND ( C < O ) OR C < Ref
> > ( C,
> > > -1 ) );
> > > keep3 = abs( C - O ) < ( H - L ) * 0.35 AND L <= Ref( H, -1 );
> > > dtr = keepall OR ( Ref( keepall, -1 ) AND keep3 );
> > >
> > > upw = dtr == 0 AND Ref( dtr, -1 ) AND utr;
> > > dnw = utr == 0 AND Ref( utr, -1 ) AND dtr;
> > >
> > > Haco = Flip( upw, dnw );
> > >
> > >
> > > if( ParamToggle("Chart Type", "Price with color back|HACO wave" ) )
> > > {
> > > Plot( Haco, "Haco", colorRed );
> > > }
> > > else
> > > {
> > > Plot( C, "Close", colorBlack, ParamStyle( "Style", styleCandle,
> > > maskPrice ) );
> > > Plot( 1, "", IIf( Haco , colorPaleGreen, colorRose ), styleArea |
> > > styleOwnScale, 0, 1 );
> > > }--- In equismetastock@xxxxxxxxxxxxxxx, "maurizio_innamorati"
> > > <maurizio.innamorati@> wrote:
> > > >
> > > > The above indicator is discussed in TASC December issue.
> > unfortunately,
> > > > the formula in MS code is not listed in Traders' Tips (given in
> > article
> > > > itself only available to subscribers). Could somebody share the
> > code
> > > > for the above indicator witg us? Thanks.
> > > >
> > >
> >
>
------------------------------------
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/equismetastock/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/equismetastock/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:equismetastock-digest@xxxxxxxxxxxxxxx
mailto:equismetastock-fullfeatured@xxxxxxxxxxxxxxx
<*> To unsubscribe from this group, send an email to:
equismetastock-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|