Window dressing

I just read a fascinating article by the guys at TradingMarkets.com. They did some back testing regarding the end of the month rallies and came to some very interesting conclusions.

Posted by
Paul Stiles
at
12/03/2006 05:19:00 PM
 
 
Dim i,j,k,last As Integer
Dim swing As Single = Me.CodeBlock.ParameterValue
Dim curhigh,curlow,swhigh,swlow,lowp,highp As Single
Dim pcswing As Single
Dim highbar, lowbar, chighbar, clowbar As Integer
		
pcswing = swing/100
    For i = 1 To InputCount-1
	If i = 1 
	curhigh = inputlast(0)
	curlow = inputlast(0)
	End If
			
	If last <> 1
				
	If inputlow(i) < (curhigh-curhigh*pcswing)
	last = 1
	swhigh=curhigh
	highbar = chighbar
	curlow = inputlow(i)
	clowbar = i
	lowp = inputlow(i)
	addtooutput(inputdate(chighbar),swhigh)
					
	ElseIf inputhigh(i) > curhigh
	curhigh = inputhigh(i)
	chighbar = i
					
	End If
        End If
			
    If last <> -1
	If inputhigh(i) > curlow+(curlow*pcswing)
	last = -1
        swlow = curlow
	curhigh = inputhigh(i)
	chighbar = i
	addtooutput(inputdate(clowbar),swlow)
					
	ElseIf inputlow(i) < curlow
	curlow = inputlow(i)
	clowbar = i
	End If
	End If
	Next
Dim j,k As Integer
Dim x As Integer = 0
Dim m As Integer = 0
Dim n As Integer = 0
Dim p As Integer = 0
Dim ar1(50000), ar2(50000) As Integer
Dim Period As Integer = Me.CodeBlock.ParameterValue
For i As Integer = 4 To InputCount-1
Dim CurDate As Date = InputDate(i)
If inputlast(i) > Inputlast(i-4) And InputLast(i-1) > InputLast(i-5) _
And InputLast(i-2) > InputLast(i-6) And InputLast(i-3) > InputLast(i-7) _
And InputLast(i-4) > InputLast(i-8) And InputLast(i-5) > InputLast(i-9) _
And InputLast(i-6) > InputLast(i-10) And InputLast(i-7) > InputLast(i-11) _
And InputLast(i-8) > InputLast(i-12) And InputLast(i-9) < InputLast(i-13)
m = m+1
ar1(i) = m
End If
Next
For j = 4 To InputCount-1
If ar1(j) > 0 And ar1(j) > ar1(j-1)
n = n + 1
ar2(n) = j
End If
Next
addtooutput(inputdate(ar2(n-(Period-1))-8),inputlow(ar2(n-(Period-1))-8)) 
No comments:
Post a Comment