I must have missed where you proved that
HaOpen =
AMA
(
Ref
( HaClose, -
1
),
0.5
);
-----Original
Message-----
From: amibroker@xxxxxxxxxxxxxxx
[mailto:amibroker@xxxxxxxxxxxxxxx]On Behalf
Of Tomasz Janeczko
Sent: Monday, July 16, 2007 1:06
AM
To: amibroker@xxxxxxxxxxxxxxx
Subject: Re: [amibroker] Heiken
Ashi indicator
Heikin Ashi
was published as TASC tip and it does not require loop. AMA can do the same
in fewer
lines
S&C Traders' Tips Issue 2/2004
|
S&C Traders' Tips for AmiBroker
monthly.
Issue 2/2004. 12 December 2003.
Copyright (C)2003 Tomasz Janeczko.
All back issues available from:
http://www.amibroker.com/traders/
|
USING THE HEIKIN-ASHI TECHNIQUE
In "Using The Heikin-Ashi
Technique" article Dan Valcu presents a new candlestick charting technique
based on modified open-high-low-close values. The charts presented in the
article can be easily reproduced using AmiBroker Formula Language. Listing 1
shows ready-to-use code that produces modified candlestick chart. Listing 2
shows the code for haDiffCO indicator presented in the article.
LISTING 1
HaClose = (O+H+L+C)/
4
;
HaOpen =
AMA
(
Ref
( HaClose, -
1
),
0.5
);
HaHigh =
Max
( H,
Max
( HaClose, HaOpen ) );
HaLow =
Min
( L,
Min
( HaClose, HaOpen ) );
PlotOHLC
( HaOpen, HaHigh, HaLow, HaClose,
"Modified "
+
Name
(), colorBlack, styleCandle );
LISTING 2
HaClose = (O+H+L+C)/
4
;
HaOpen =
AMA
(
Ref
( HaClose, -
1
),
0.5
);
HaHigh =
Max
( H,
Max
( HaClose, HaOpen ) );
HaLow =
Min
( L,
Min
( HaClose, HaOpen ) );
HaDiffCO = HaClose - HaOpen;
per =
Param
(
"MA Periods"
,
3
,
3
,
50
,
1
);
Plot
( HaDiffCo,
"HaDiffCO"
, colorRed
);
Plot
(
MA
( HaDiffCo, per ),
"MA("
+per+
")"
, colorBlue
);
FIGURE 1.
The screen shot in Figure 1 shows the
daily SP-500 modified candlestick chart (upper pane), classic candlestick chart
(middle pane) and HaDiffCO indicator with 3 day moving average (lower pane).
-- Tomasz
Janeczko, amibroker.com
http://www.amibroker.com
Best regards,
Tomasz Janeczko
amibroker.com
-----
Original Message -----
To: amibroker@xxxxxxxxxxxxxxx
Sent: Monday, July 16, 2007
4:31 AM
Subject: RE:
[amibroker] Heiken Ashi indicator
Joe,
That code is TJ’s kludge to
get around the need to initialize HaOpen:
HaOpen = ( Ref(HaOpen,-1) +
Ref(HaClose,-1) )/2;
The correct value requires
a loop:
HaOpen[0]= O[0]; HaClose[0]= C[0];
for(i=1;i<BarCount;i++)
{
HaOpen[i] =
(HaOpen[i-1]+HaClose[i-1])/2;
HaClose[i] =
(O[i]+C[i]+H[i]+L[i])/4;
HaHigh[i] =
Max(H[i],Max(HaOpen[i],HaClose[i]));
HaLow[i] =
Min(L[i],Min(HaOpen[i],HaClose[i]));
but inserting the correct line in your code as I’ve done below
will give a near-perfect result.
Regards,
Bob
-----Original Message-----
From: amibroker@xxxxxxxxxxxxxxx
[mailto:amibroker@xxxxxxxxxxxxxxx]On Behalf
Of Joe Landry
Sent: Sunday, July 15, 2007 6:24
PM
To: amibroker@xxxxxxxxxxxxxxx
Subject: Re: [amibroker] Heiken
Ashi indicator
Jack,
I'll ship this to you but from here on out you must promise to look in the
program library. (:>
HTH
Joe
L.
////////////////////////////////////
//
// Heikin_Ashi For Amibroker
//
////////////////////////////////////
SetChartBkColor(ParamColor("Outer
panel color ",colorLightGrey)); // color of outer border
SetChartBkGradientFill(
ParamColor("Inner panel color upper half",
colorGrey40),ParamColor("Inner panel color lower half",
colorGrey40));
// color of inner panel
HaClose
=EMA((O+H+L+C)/4,3);
HaOpen
= AMA( Ref( HaClose, -1 ), 0.5 );
HaOpen
= ( Ref(HaOpen,-1) + Ref(HaClose,-1) )/2; // ç========
Corrected value.
HaHigh
= Max( H, Max( HaClose, HaOpen ) );
HaLow
= Min( L, Min( HaClose, HaOpen ) );
PlotOHLC(
HaOpen, HaHigh, HaLow, HaClose, "Modified " + Name(), colorBlack,
styleCandle | styleNoLabel );
Title
= "\n" + "" + Name() + ", " + Interval(2) +
", " + Date() + "\n";
Also
in the program library.
http://www.amibroker.com/library/detail.php?id=714&hilite=StrFind
----- Original Message
-----
hi,
anyone has
heiken ashi indicator? I found an article talking about its fomula as below:
The heikin-ashi
candlestick technique uses modified open-high-low-close (OHLC) values and
displays them as candlesticks. The modified values are computed using these definitions:
• haClose = (O+H+L+C)/4
• haOpen = (haOpen (previous bar) + haClose (previous bar))/2
• haHigh = Maximum(H, haOpen, haClose)
• haLow = Minimum(L, haOpen, haClose)
is this the
one everyone uses? if anyone has a working heiken ashi indicator AFL file,
please help uploading it or email to me.
thanks a lot
jack
Get
the free Yahoo! toolbar and rest assured with the added security of spyware
protection.