Fri05242013

Last update12:00:00 AM

## AMIBROKER: MARCH 2013

In “Camarilla Points” in this issue, author Slawomir Bobrowski presents a simple pivot trading technique.

A ready-to-use formula for the indicator is given here. To display the indicator, simply input the formula into the Formula Editor and press “Apply indicator.” To adjust the number of periods, click the right mouse button and choose “parameters” from the menu. The camarilla points are calculated based on prices from a given number of bars prior to the selected date. To change the selected date, simply click on any bar.

```AMIBROKER CODE LISTING
Period = Param("Period", 25, 2, 100 );
bi = BarIndex();
procedure PlotLevel( array, nam, Color )
{
x = SelectedValue( bi );
y = SelectedValue( array );
Plot( IIf( bi >= x AND bi < x + Period, y, Null ),
nam, Color, styleDashed );
PlotText( nam, x + Period - 1, y, Color );
}
pl = Ref( LLV( Low, Period ), -1 );
ph = Ref( HHV( High, Period ), -1 );
range = ph - pl;
pc = Ref( Close, -1 );
R5 = ph/pl * pc;
R4 = pc + Range * 1.1/2;
R3 = pc + Range * 1.1/4;
R2 = pc + Range * 1.1/6;
R1 = pc + Range * 1.1/12;
S1 = pc - Range * 1.1/12;
S2 = pc - Range * 1.1/6;
S3 = pc - Range * 1.1/4;
S4 = pc - Range * 1.1/2;
S5 = pc - ( R5 - pc );
Plot( C, Name() + " " + Date(), colorDefault, styleCandle );
PlotLevel( R5, "R5", colorBlue );
PlotLevel( R4, "R4", colorBlue );
PlotLevel( R3, "R3", colorBlue );
//PlotLevel( R2, "R2", colorBlue );
//PlotLevel( R1, "R1", colorBlue );
//PlotLevel( S1, "S1", colorRed );
//PlotLevel( S2, "S2", colorRed );
PlotLevel( S3, "S3", colorRed );
PlotLevel( S4, "S4", colorRed );
PlotLevel( S5, "S5", colorRed );
```

A sample chart is shown in Figure 5.

FIGURE 5: AMIBROKER. Here is a sample chart showing camarilla points (15-day time frame: May 29–June 19, 2012).

—Tomasz Janeczko, AmiBroker.com
www.amibroker.com