AIQ: MARCH 2013
- Details
- Parent Category: Departments
- Category: Traders' Tips
- Written by Richard Denning

The AIQ code based on Slawomir Bobrowski’s article in this issue, “Camarilla Points,” is provided at www.TradersEdgeSystems.com/traderstips.htm and is shown below.
The camarilla point levels are dependent on both the time frame and the starting point. As for how to determine where to start the analysis, Bobrowski indicated that this question was beyond the scope of this month’s article and that he would cover this in a future article in S&C.
In the AIQ code I am offering here, I provide for inputs that allow the user to set the start date of the analysis and also the length of the time frame. Each of the 10 camarilla points can be added as custom single line indicators on the upper portion of the chart. Each can then be clicked on or off separately, and one or more of the levels can be shown on the chart.

FIGURE 7: AIQ. This sample AIQ charts displays four sets of camarilla points (R4-green, R3-white, S3-white, and S4-red) on a chart of the DIA ETF using a 25-bar time frame and a starting date of 1/14/2011.
In Figure 7, I show the R4, R3, S3, S4 levels on a chart of DIA. The time frame interval was set to 25 and the start date was set to 1/14/2011. The code provided allows for a backtest of the first support and resistance system described by Bobrowski under the subheading “Market opens inside S3–R3.”
!CAMARILLA POINTS
!Author: Slawomir Bobrowski, TASC March 2013
!Coded by: Richard Denning 1/11/2013
!www.TradersEdgeSystems.com
!INPUTS:
StartMonth is 01.
StartDay is 14.
StartYear is 2011.
TimeFrame is 25.
Symbol is "DIA".
!ABREVIATIONS:
C is [close].
H is [high].
L is [low].
O is [open].
OSD is offsettodate(month(),day(),year()).
BarsHeld is {position days}.
!INDICATOR RULES AND UDFs:
StartDate if month()=StartMonth and day()=StartDay and year()=StartYear.
DaysToStart is scanany(StartDate,252*10) then OSD.
DaysToStartSPX is tickerUDF("SPX",DaysToStart) then OSD.
NumOfIntervals is floor(^DaysToStart / (TimeFrame)).
LastModDate is setdate(DaysToStart-NumOfIntervals*TimeFrame).
LastModOS is ^DaysToStart-NumOfIntervals*TimeFrame.
LastAnchorOS is iff(LastModOS > TimeFrame-1,LastModOS-(TimeFrame-1),LastModOS).
LastAnchorDate is setdate(LastAnchorOS).
HH is highresult(H,TimeFrame,LastAnchorOS).
LL is lowresult(L,TimeFrame,LastAnchorOS).
AnchorC is valresult(C,LastAnchorOS).
Range is HH - LL.
R5 is (HH/LL)*AnchorC.
R4 is AnchorC + Range * (1.1)/2.
R3 is AnchorC + Range * (1.1)/4.
R2 is AnchorC + Range * (1.1)/6.
R1 is AnchorC + Range * (1.1)/12.
S1 is AnchorC - Range * (1.1)/12.
S2 is AnchorC - Range * (1.1)/6.
S3 is AnchorC - Range * (1.1)/4.
S4 is AnchorC - Range * (1.1)/2.
S5 is AnchorC - (R5-AnchorC).
BaseDate is setdate((TimeFrame)+LastAnchorOS).
ShowValues if Symbol()=Symbol.
FirstOpen is valresult(O,LastAnchorOS-1).
!SYSTEM RULES FOR "MARKET OPENS INSIDE S3 - R3":
Buy if Symbol()=Symbol and FirstOpen < R3 and FirstOpen > S3 and L < S3 and LastAnchorOS > 1.
BuyPrice is max(O,S3).
ExitBuy if L < S4 or (H > R3 and valrule(H < R3,1)) or BarsHeld >= TimeFrame.
ExitBuyPrice is iff(L < S4,S4-0.01,iff(H > R3 and valrule(H < R3,1),R3,-99)).
Sell if FirstOpen < R3 and FirstOpen > S3 and H > R3 and LastAnchorOS > 1.
SellPrice is min(O,R3).
ExitSell if H > R4 or (L < S3 and valrule(L > S3,1)) or BarsHeld >= TimeFrame.
ExitSellPrice is iff(H > R4,R4+0.01,iff(L < S3 and valrule(L > S3,1),S3,-99)).The code and EDS file can be downloaded from www.TradersEdgeSystems.com/traderstips.htm.


Join us on Facebook
Follow us on Twitter