Stock Portfolio Organizer

The ultimate porfolio management solution.

Shares, Margin, CFD's, Futures and Forex
EOD and Realtime
Dividends and Trust Distributions
And Much More ....
Find Out More Here

WiseTrader Toolbox

#1 Selling Amibroker Plugin featuring:

Advanced Adaptive Indicators
Advanced Pattern Exploration
Neural Networks
And Much More ....
Find Out More Here

KAGI CHARTS for Amibroker (AFL)
cnbondre
almost 8 years ago
Amibroker (AFL)

Rating:
3 / 5 (Votes 2)
Tags:
amibroker, kagi

Kagi Chart Interpretation

Kagi charts are an excellent way of viewing the underlying supply and demand of a market. When the most recent kagi line is thick (and GREEN), it indicates that demand is exceeding supply, and that the market is in an upward trend. Thin (RED) lines, on the other hand, show that supply is exceeding demand and that the market is in a downward trend.

Alternating thick and thin lines indicate that supply and demand are in an approximate state of balance.

Kagi charts take the ‘noise’ out of the market, giving you a chart of the market’s overall moves. You can gauge the strength of a trend by noting whether or not, in an upward trending market, a swing bottom is above, equal to, or below the previous swing top. The more ‘above’ it is, the stronger the trend.

Normal technical analysis techniques can be used very effectively. The following chart shows how effective trend lines can be when applied to kagi charts.
Note also the strong sell signal when the market broke below two swing bottoms.

Similar Indicators / Formulas

Kavach Of Karna v2
Submitted by hbkwarez over 3 years ago
Advanced Elliott Waves
Submitted by MarcosEn about 6 years ago
3_6Day GuaiLiLv
Submitted by motorfly about 6 years ago
Williams Alligator System
Submitted by durgesh1712 about 6 years ago
*Level Breakout system*
Submitted by Tinych about 6 years ago

Indicator / Formula

Copy & Paste Friendly
_SECTION_BEGIN("KAGI CHART");
//KAGI Chart (or Swing) for Amibroker Indicator window. 
//Reverse swing is 3%.

SetBarsRequired(100000,100000);

Close = IIf( C<10, round(C*10)/10, IIf( C>=10 AND C<50, int(C) + round(round(frac(C)*10)/5)*5/10, int(C)));

Reverse = LastValue(IIf(C<50,0.05,IIf(C>=50 AND C<100,0.04,0.03)));


EnableScript("jscript");
<%

Close = VBArray( AFL( "Close" ) ).toArray();

KC = new Array();

// initialize first element
j = 0;
KC[j] = Close[0];

down = 1;    // By default the first bar is a down bar.
up = 0;
swap = 0;

// perform the loop that produces Kagi Chart
for( i = 1; i < Close.length; i++ )
{
 Reverse =AFL("Reverse");                        // percent reversal requirement

 if( Close[i] <= KC[j] && down)         //continue down
 {
  KC[j] = Close[i];
 }
 else
 {
  if( Close[i] >= KC[j]*(1 + Reverse) && down)  //Change direction to up
  {
   j++;
   swap = 1;

   KC[j] = Close[i];
  }
 }
 if( Close[i] >= KC[j] && up)         //Continue up
 { 
  KC[j] = Close[i];
 }
 else
 {
  if( Close[i] <= KC[j]*(1 - Reverse) && up)   //Change direction to down
  {
   j++;

   KC[j] = Close[i];
   swap = 1;
  }
 }
 if( swap )
 {
  swap = 0;
  if( up )
  {
   up = 0;
   down = 1;
  }
  else
  {
   up = 1;
   down = 0;
  }
 }
}
delta = Close.length - j-1;      //to get all of chart

AFL.Var("KC") = KC;
AFL.Var("delta") = delta;
AFL.Var("Reverse") = Reverse;
 
%>

KC = Ref( KC, -delta );
C = KC;
L = LLV(C,2);
H = HHV(C,2);

MyColor = 
IIf(C>Ref(H,-2),colorBrightGreen, 
IIf(C<Ref(L,-2),colorRed,
colorBlack));
Graph0BarColor = MyColor;
Graph0Style = 512+4096;
GraphXSpace = 5;
Graph0 = C;
Graph0Name = "Kagi Chart";
Graph1BarColor = 1;
Graph1Style = 16+2048+4096;
Graph1 = Reverse*100;
Graph1Name = "Reverse %";
_SECTION_END();
_SECTION_END();

2 comments

1. colion

Usually, the chart color is kept constant until a reversal above/below a shoulder >= threshold. You might want to consider this coloring scheme as it makes identifying trends easier.

In addition, it is probably worthwhile to include the option to specify the threshold not only in terms of percentage but also in terms of points and ATR().

You can view the coloring scheme and threshold options at a number of websites, including stockcharts.com.

2. madhavpatel

i got error is Error :31 .syntax error unexcepted ‘=’, excepting ‘(’

at line 9 reverse =

Leave Comment

Please login here to leave a comment.

Back