Wed05222013

Last update12:00:00 AM

The TradersStudio code based on Slawomir Bobrowski’s article in this issue, “Camarilla Points,” is provided at the following websites:

The code is also available below.

• Function: “CAMARILLA_POINT” is a function that returns the camarilla point level based on the time frame, type, and lookback to computation start point
• Indicator plot: “CAMARILLA_SR1_IND” is the indicator code that plots the camarilla levels for R4, R3, S3 and S4
• System: “CAMARILLA_SR1” is the system described by author Slawomir Bobrowski in his article under the heading “Market opens inside S3–R3” (note the system does not enter or exit on stops but rather enters or exits the next day at the open)

I set up a test session using the SP futures contract (with data from Pinnacle Data). In Figure 8, I show the equity curve and underwater equity curve trading one contract from 1982 to 2013.

FIGURE 8: TRADERSSTUDIO. Here are sample equity and underwater equity curves for the SR1 system trading one SP contract from 1982 through 2013.

```'Author: Slawomir Bobrowski, TASC March 2013
'Coded by: Richard Denning 1/11/2013
'INPUTS:
'StartMonth is 04.  '04
'StartDay is 16.    '16
'StartYear is 2010. '2002
'Frame is 25.
'StartDate if month()=StartMonth and day()=StartDay and year()=StartYear.
'Symbol is "DIA".
Function CAMARILLA_POINT(Frame,Type,Level,LastAnchorOS)
'Type 1 = support
'Type 2 = resistance
Dim HH,LL,theRange,Point
Dim AnchorC As BarArray
HH = Highest(H,Frame,LastAnchorOS)
LL = Lowest(L,Frame,LastAnchorOS)
AnchorC = C[LastAnchorOS]
theRange = HH - LL
If (Type = 2) Then
If (Level = 5) Then Point = (HH/LL)*AnchorC 'R5
If (Level = 4) Then Point = AnchorC + theRange * (1.1)/2 'R4
If (Level = 3) Then Point = AnchorC + theRange * (1.1)/4 'R3
If (Level = 2) Then Point = AnchorC + theRange * (1.1)/6 'R2
If (Level = 1) Then Point = AnchorC + theRange * (1.1)/12 'R1
End If
If (Type = 1) Then
If (Level = 1) Then Point = AnchorC - theRange * (1.1)/12 'S1
If (Level = 2) Then Point = AnchorC - theRange * (1.1)/6  'S2
If (Level = 3) Then Point = AnchorC - theRange * (1.1)/4  'S3
If (Level = 4) Then Point = AnchorC - theRange * (1.1)/2  'S4
If (Level = 5) Then Point = AnchorC - ((HH/LL)*AnchorC-AnchorC) 'S5
End If
CAMARILLA_POINT = Point
End Function
'------------------------------------------------------------------------
'INDICATOR PLOT:
Sub CAMARILLA_SR1_IND(Frame)
Dim BarsToStart, BarsToLastComp, S1,S2,S3,S4,S5,R1,R2,R3,R4,R5
Dim NumOfIntervals As BarArray
BarsToStart = BarNumber - Frame - 1
NumOfIntervals = Round(((BarNumber-1) / Frame) - 0.5 ,0)
BarsToLastComp = BarsToStart - (NumOfIntervals-1)*Frame
If BarNumber > BarSize*2+1 Then
S1 = Round(CAMARILLA_POINT(Frame,1,1,BarsToLastComp),2)
S2 = Round(CAMARILLA_POINT(Frame,1,2,BarsToLastComp),2)
S3 = Round(CAMARILLA_POINT(Frame,1,3,BarsToLastComp),2)
S4 = Round(CAMARILLA_POINT(Frame,1,4,BarsToLastComp),2)
S5 = Round(CAMARILLA_POINT(Frame,1,5,BarsToLastComp),2)
R1 = Round(CAMARILLA_POINT(Frame,2,1,BarsToLastComp),2)
R2 = Round(CAMARILLA_POINT(Frame,2,2,BarsToLastComp),2)
R3 = Round(CAMARILLA_POINT(Frame,2,3,BarsToLastComp),2)
R4 = Round(CAMARILLA_POINT(Frame,2,4,BarsToLastComp),2)
R5 = Round(CAMARILLA_POINT(Frame,2,5,BarsToLastComp),2)
End If
plot1(R4)
plot2(R3)
plot3(S3)
plot4(S4)
End Sub
'-------------------------------------------------------------------------
'SYSTEM "MARKET OPENS BETWEEN S3 - R3":
Sub CAMARILLA_SR1(Frame)
Dim BarsToStart,BarsToLastComp,S1,S2,S3,S4,S5,R1,R2,R3,R4,R5,FirstOpen
Dim NumOfIntervals As BarArray
BarsToStart = BarNumber - Frame - 1
NumOfIntervals = Round(((BarNumber-1) / Frame) - 0.5 ,0)
BarsToLastComp = BarsToStart - (NumOfIntervals-1)*Frame
If BarNumber > BarSize*2+1 Then
S1 = Round(CAMARILLA_POINT(Frame,1,1,BarsToLastComp),2)
S2 = Round(CAMARILLA_POINT(Frame,1,2,BarsToLastComp),2)
S3 = Round(CAMARILLA_POINT(Frame,1,3,BarsToLastComp),2)
S4 = Round(CAMARILLA_POINT(Frame,1,4,BarsToLastComp),2)
S5 = Round(CAMARILLA_POINT(Frame,1,5,BarsToLastComp),2)
R1 = Round(CAMARILLA_POINT(Frame,2,1,BarsToLastComp),2)
R2 = Round(CAMARILLA_POINT(Frame,2,2,BarsToLastComp),2)
R3 = Round(CAMARILLA_POINT(Frame,2,3,BarsToLastComp),2)
R4 = Round(CAMARILLA_POINT(Frame,2,4,BarsToLastComp),2)
R5 = Round(CAMARILLA_POINT(Frame,2,5,BarsToLastComp),2)
End If
'If BarNumber >= LastBar-Frame*2 Then Print FormatDateTime(Date)," ",NumOfIntervals," ",BarsToLastComp," ",R5," ",R4," ",R3," ",R2," ",R1," ",S1," ",S2," ",S3," ",S4," ",S5," "
If BarsToLastComp >= 1 Then FirstOpen = O[BarsToLastComp-1]
If FirstOpen < R3 And FirstOpen > S3 And BarsToLastComp > 1 Then
If L < S4 Then ExitLong("LX_SL","",1,0,Market,Day)
If CrossesOver(H,R3) Then ExitLong("LX_PT","",1,0,Market,Day)
If BarsSinceEntry >= BarsToLastComp - 1 Then ExitLong("LX_Time","",1,0,Market,Day)
If CrossesOver(C,R3) Then Sell("SE",1,0,Market,Day)
If H > R4 Then ExitShort("SX_SL","",1,0,Market,Day)
If CrossesUnder(L,S3) Then ExitShort("SX_PT","",1,0,Market,Day)
If BarsSinceEntry >= BarsToLastComp - 1 Then ExitShort("SX_Time","",1,0,Market,Day)
End If
End Sub```

—Richard Denning