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

Re: [amibroker] editing default.format



PureBytes Links

Trading Reference Links

Graham, it is slightly different from Metastock's.  I'll send you both charts for a brick size of 144.  Bill
  ----- Original Message ----- 
  From: Graham 
  To: amibroker@xxxxxxxxxxxxxxx 
  Sent: Thursday, August 12, 2004 10:14 PM
  Subject: [amibroker] Renko chart code


  I will add the chart code below here for testing before placing in the AFL
  library.
  This is first pass only, so errors may occur
  Copy the code to custom chart

  Cheers,
  Graham
  http://e-wire.net.au/~eb_kavan/


  // Renko  Chart
  // Graham Kavanagh  13 Aug 2004
  // Custom Indicator, date axis does not apply

  SetBarsRequired(10000,10000);
  // Brick size is dependant on what you want, if too small will not produce a
  chart due to insufficient x-axis bars
  Brick = LastValue(ATR(10));
  reverse = 3;

  // Convert the closing price to rising and falling rounded bricks
  CF = ceil(C/Brick);
  CR = floor(C/Brick);

  // initialize first element
  j = 0;
  RKC[j] = CF[0];
  RKO[j] = CF[0] + 1;

  down[j] = 1;  // By default the first bar is a down bar.
  up[j] = 0;

  // Loop to produce the Renko values in number of bricks

  for( i=1; i<BarCount-1; i++ )
  {
  if( CF[i] <= RKC[j] - 1 && down[j] ) // Continue down
  {
  num = RKC[j] - CF[i];
  for( x=1; x<=num; x++ )
  {
  j++;
  up[j] = 0;
  down[j] = 1;
  RKC[j] = RKC[j-1] - 1;
  RKO[j] = RKC[j] + 1;
  }
  }
  else
  {
  if( CR[i] >= RKC[j] + Reverse && down[j] )  // Change down
  to up
  {

  num = CR[i] - RKC[j];
  for( x=1; x<=num; x++ )
  {
  j++;
  up[j] = 1;
  down[j] = 0;
  RKC[j] = RKC[j-1] + 1;
  RKO[j] = RKC[j] - 1;
  }
  }
  else
  {
  if( CR[i] >= RKC[j] + 1 && up[j] ) // Continue Up
  {
  num = CR[i] - RKC[j];
  for( x=1; x<=num; x++ )
  {
  j++;
  up[j] = 1;
  down[j] = 0;
  RKC[j] = RKC[j-1] + 1;
  RKO[j] = RKC[j] - 1;
  }
  }
  else
  {
  if( CF[i] <= RKC[j] - Reverse && up[j] )  //
  Change up to down
  {
  num = RKC[j] - CF[i];
  for( x=1; x<=num; x++ )
  {
  j++;
  up[j] = 0;
  down[j] = 1;
  RKC[j] = RKC[j-1] - 1;
  RKO[j] = RKC[j] + 1;
  }
  }
  }
  }
  }
  }


  // move the chart to right end of chart space, ie last brick on last bar
  position
  delta = BarCount-1 - j;

  RKC = Ref( RKC, -delta );
  RKO = Ref( RKO, -delta );

  Up = Ref( Up, -delta );
  Down = Ref( Down, -delta );

  // Convert bricks to prices

  C = RKC * Brick;
  O = RKO * Brick;
  H = IIf( Up, RKC, RKO ) * Brick ;
  L = IIf( Up, RKO, RKC ) * Brick ;

  // plot chart
  Plot( C, "Brick size = " + brick + "Renko Price =" , colorBlack,
  styleCandle);






  Check AmiBroker web page at:
  http://www.amibroker.com/

  Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
  Yahoo! Groups Links



   


[Non-text portions of this message have been removed]



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Yahoo! Domains - Claim yours for only $14.70
http://us.click.yahoo.com/Z1wmxD/DREIAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> 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/