[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Constructing Equity Curves



PureBytes Links

Trading Reference Links

Peter and fellow traders...

I have an Excel spreadsheet that will do the job for you. I will gladly share this with anyone who is interested. One way of paying back all the great help this list has been. Just email me and I'll send you a zip'd copy.

For those interested, I've copied the VBA code below.

In English, the code cylces through each row starting with the row labeled "First_Row". Looking at the column labeled "Date", If it encounters a 'hole' in the date sequence it will open up a new row, copy the prior row to the new row and insert the next date.

A 'hole' in the expected date sequence is any missing weekday, holiday's included.

Do this on each market's equity curve and presto! there will be a market price for every weekday for every market regardless of disparate holiday schedules.

PS. Excel is an awesome program. All that power for a couple hundred bucks. Oh, that every program, *like TS* was opened up via VBA. You can control every aspect of Excel from VBA. Can't say enough. Way to go MS. I cringe in pain using EL after doing things in Excel.

Scott Hoffman
Issquah, WA

Option Explicit
Function GetDate(DateCode)

  GetDate = DateSerial(Int(DateCode / 10000), Int((DateCode Mod 10000) / 100), DateCode Mod 100)
  
End Function
Function GetDay(MyDate)

  GetDay = WeekDay(MyDate, vbMonday)
  
End Function
Function MakeDateCode(MyDate)

  MakeDateCode = (Year(MyDate) Mod 100) * 10000 + Month(MyDate) * 100 + Day(MyDate)
  
End Function
Sub DateFill()

Dim CurRow As Integer
Dim DateCol As Integer
Dim CurDate As Date
Dim NextDate As Date
Dim NewDate As Date
Dim Old_Status_Bar As String

  Application.Calculation = xlCalculationManual
  Old_Status_Bar = Application.DisplayStatusBar
  Application.DisplayStatusBar = True
  CurRow = Range("First_Row").Row
  DateCol = Range("Date").Column
  
  Do While IsEmpty(Cells(CurRow + 1, DateCol)) = False
    CurDate = GetDate(Cells(CurRow, DateCol))
    NextDate = GetDate(Cells(CurRow + 1, DateCol))
    
    If GetDay(NextDate) - 1 <> (GetDay(CurDate)) Mod 5 Then
      Rows(CurRow + 1).Insert
      Rows(CurRow).Copy
      Rows(CurRow + 1).PasteSpecial
      If GetDay(CurDate) < 5 Then
        NewDate = CurDate + 1
      Else
        NewDate = CurDate + 3
      End If
      Cells(CurRow + 1, DateCol).Value = MakeDateCode(NewDate)
    End If
    Application.StatusBar = "Processing Row: " + Format(CurRow)
    CurRow = CurRow + 1
  Loop

  Application.StatusBar = False
  Application.DisplayStatusBar = Old_Status_Bar
  Application.Calculation = xlCalculationAutomatic

End Sub

-----Original Message-----
From:	Peter Gibson [SMTP:Peter_Gibson@xxxxxxxxxxxxxx]
Sent:	Thursday, August 13, 1998 8:20 AM
To:	omega-list@xxxxxxxxxx
Subject:	Constructing Equity Curves


A couple of  questions on constructing equity curves.  I am using
Chartscanner to export information on equity curves to a .csv file and then
using Excel to consolidate the data into a single consolidated equity curve.
Problem I am having is that equity is only reported on days that the
exchange is open - so total equity can take a dip where futures exchanges
take holidays on different days.  Anybody have a quick and dirty solution?

Second any recommendations as to what beginning account equity should be
when constructing the equity curve.  Obviously if smaller equity number is
used makes for more impressive looking equity curve.

Third is any sort of compounding generally taken into account?  That is if
you are trading 1 contract with $10,000 of equity - presumably if your
equity doubles you would then trade 2 contracts.  Two possible methods: vary
number of contracts based on equity calculated for that future which means
you trade more in the futures which have performed best so far in the
simulation.  Second method is to calculate contracts based on total
portfolio equity - which I'm not sure can be calculated in TS as you are
trading the system.