Here is something fun (and maybe educational) that I wrote last
night.  It draws giant candlesticks containing normal candlesticks. 
If you zoom out enough, the giant candlesticks look pretty normal.

One thing I don't quite understand yet is what happens when you
scroll the screen left and right.  Click and hold on the left and
right arrows and you will see that the candlesticks stay in the same
place while the prices shift within, except at the far right end of
data.   ... something about how scripts are interpreted in the
indicators that I am still missing.

dan
[EMAIL PROTECTED]
-------

// Candlestick Giants
// by Daniel LaLiberte ([EMAIL PROTECTED])
// Draws candlesticks for larger periods,
// while still showing the lowest level candlesticks.

// Based on "Candlestick Periods"
// by Junya Ho ([EMAIL PROTECTED])

period = Param("Candlestick Period", 10, 1, 500, 1);
offset = Param("Candlestick Offset", 0, 0, 100, 1);

// globals reassigned by scaleCandlesticks
newO = O; newC = C; newH = H; newL = L;

function scaleCandlesticks(period, offset)
{
      // barIndex is freaky when scrolling
      //barnum = barIndex() + 1 ;
      barnum = Cum(1) + offset % period;

      delta = BarCount - barnum;
      mod = delta % period;
      //plot(mod, "mod", colorBlack, styleOwnScale);

      beginIdx = mod - period + 1;
      endIdx = mod;

      newO = Ref(O, beginIdx);
      newC = Ref(C, endIdx);
      newH = Ref(HHV(H, period), endIdx);
      newL = Ref(LLV(L, period), endIdx);
}

PlotOHLC(Open, High, Low, Close, "Price", 17, styleCandle);

scaleCandlesticks(period, offset);

openCloseMin = min(newO, newC);
openCloseMax = max(newO, newC);
boxColor = Iif(newC > newO, colorPaleGreen, colorPink);

PlotOHLC(newO, openCloseMax , openCloseMin , newC,
      "", boxColor, stylePointAndFigure ); // could use styleCloud

// following two plots are not needed with styleCloud above.
Plot(openCloseMin, WriteIf(newC > newO, "open", "close"),
      boxColor, styleStairCase );
Plot(openCloseMax, WriteIf(newC > newO, "close", "open"),
      boxColor, styleStairCase );
// Highs and lows are shown with empty box rather than a line.
Plot(newL, "low", colorBlack, styleStairCase);
Plot(newH, "high", colorBlack, styleStairCase);







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




Reply via email to