OmniVest Forum OmniVest Forum
forums calendars search
today this week
 
register logon control panel Forum Rules
You are currently browsing as a guest.
You should logon to access more features
A Self-Moderated Community - ALL MEMBERS, PLEASE READ!
Vote for Members who contribute the most to your trading, and help us moderate content within the Forums.


[Random Quote] -

  Current location        Thread information  
OmniVest User Forums
User-Created Portfolios
CAR, MDD and Calmar, in an OScript condition
Last Activity 7/22/2015 8:11 AM
4 replies, 2772 viewings

Jump to page : 1
Now viewing page 1 [25 messages per page]
 
back
Printer friendly version

^ Top
Jim Dean

Elite
10002525
Posts: 1059

Joined: 10/11/2012
Location: L'ville, GA

User Profile
 
Subject : CAR, MDD and Calmar, in an OScript condition
Posted : 5/8/2014 1:49 PM
Post #30437

CAR is easy to calc in OScript. MDD is a pain, since OScript has no "BarsSince" function ... but there is a way around it. Here are OScan-tested correct-syntax formulae for CAR, MDD and Calmar. If you would like to go through the long derivation, and several important caveats about this solution, please click here

CAR percent:

100*( ( C/C[bar] ) ^ ( 1/ (bar/252) ) -1 )


MDD percent: (in bins, see writeup)

1
-19 * ( Sum( (
HHV((C[1] - C)/ C[1],bar) > .2
orelse
(HHV(C,2)[1] - C) / HHV(C,2)[1] > .2
orelse
(HHV(C,3)[1] - C) / HHV(C,3)[1] > .2
orelse
(HHV(C,4)[1] - C) / HHV(C,4)[1] > .2
orelse
(HHV(C,5)[1] - C) / HHV(C,5)[1] > .2
), bar) < 0 )
-14 * ( Sum( (
HHV((C[1] - C)/ C[1],bar) > .15
orelse
(HHV(C,2)[1] - C) / HHV(C,2)[1] > .15
orelse
(HHV(C,3)[1] - C) / HHV(C,3)[1] > .15
orelse
(HHV(C,4)[1] - C) / HHV(C,4)[1] > .15
orelse
(HHV(C,5)[1] - C) / HHV(C,5)[1] > .15
), bar) < 0 )
-9 * ( Sum( (
HHV((C[1] - C)/ C[1],bar) > .1
orelse
(HHV(C,2)[1] - C) / HHV(C,2)[1] > .1
orelse
(HHV(C,3)[1] - C) / HHV(C,3)[1] > .1
orelse
(HHV(C,4)[1] - C) / HHV(C,4)[1] > .1
orelse
(HHV(C,5)[1] - C) / HHV(C,5)[1] > .1
), bar) < 0 )
-4 * ( Sum( (
HHV((C[1] - C)/ C[1],bar) > .05
orelse
(HHV(C,2)[1] - C) / HHV(C,2)[1] > .05
orelse
(HHV(C,3)[1] - C) / HHV(C,3)[1] > .05
orelse
(HHV(C,4)[1] - C) / HHV(C,4)[1] > .05
orelse
(HHV(C,5)[1] - C) / HHV(C,5)[1] > .05
), bar) < 0 )


Calmar Ratio: (binned due to MDD)

100*( ( C/C[bar] ) ^ ( 1/ (bar/252) ) -1 )
/ ( 1
-19 * ( Sum( (
HHV((C[1] - C)/ C[1],bar) > .2
orelse
(HHV(C,2)[1] - C) / HHV(C,2)[1] > .2
orelse
(HHV(C,3)[1] - C) / HHV(C,3)[1] > .2
orelse
(HHV(C,4)[1] - C) / HHV(C,4)[1] > .2
orelse
(HHV(C,5)[1] - C) / HHV(C,5)[1] > .2
), bar) < 0 )
-14 * ( Sum( (
HHV((C[1] - C)/ C[1],bar) > .15
orelse
(HHV(C,2)[1] - C) / HHV(C,2)[1] > .15
orelse
(HHV(C,3)[1] - C) / HHV(C,3)[1] > .15
orelse
(HHV(C,4)[1] - C) / HHV(C,4)[1] > .15
orelse
(HHV(C,5)[1] - C) / HHV(C,5)[1] > .15
), bar) < 0 )
-9 * ( Sum( (
HHV((C[1] - C)/ C[1],bar) > .1
orelse
(HHV(C,2)[1] - C) / HHV(C,2)[1] > .1
orelse
(HHV(C,3)[1] - C) / HHV(C,3)[1] > .1
orelse
(HHV(C,4)[1] - C) / HHV(C,4)[1] > .1
orelse
(HHV(C,5)[1] - C) / HHV(C,5)[1] > .1
), bar) < 0 )
-4 * ( Sum( (
HHV((C[1] - C)/ C[1],bar) > .05
orelse
(HHV(C,2)[1] - C) / HHV(C,2)[1] > .05
orelse
(HHV(C,3)[1] - C) / HHV(C,3)[1] > .05
orelse
(HHV(C,4)[1] - C) / HHV(C,4)[1] > .05
orelse
(HHV(C,5)[1] - C) / HHV(C,5)[1] > .05
), bar) < 0 ) )
^ Top
JimB

Member
25
Posts: 36

Joined: 3/7/2014
Location: Rogers, MN

User Profile
 
Subject : RE: CAR, MDD and Calmar, in an OScript condition
Posted : 5/8/2014 2:49 PM
Post #30445 - In reply to #30437

Oh my!
Did I mention I am the poster child for the customer Ed describes that just wants to press the F9 key and make a $zillion? I am very glad that you and many of the active posters on this forum think the way you do, but...could we put this in the x-rated section of the video store?
joking (sort of). Thanks, Jim, for all of your many contributions.
^ Top
Jim Dean

Elite
10002525
Posts: 1059

Joined: 10/11/2012
Location: L'ville, GA

User Profile
 
Subject : RE: CAR, MDD and Calmar, in an OScript condition
Posted : 5/8/2014 2:58 PM
Post #30447 - In reply to #30445

I should have started off by saying this:

1. Warning ... for experimenters only ... not for faint of heart!

2. Hopefully ... once dust settles from OVest V3 work, we will have access to the MDD, CAR, Calmar and other "metrics" for both Strat's and Port's, directly from the OScript window. BUT ... that requires a parser change and that's not trivial ... so it will likely be awhile. Hopefully these will help out in the meantime.

3. PortBal will definitely provide for rules like this, somehow. But it's quite possible that the metrics won't make it very quickly to the Strat level ... so this might have usefulness for several months at least, maybe longer.

4. Part of the reason for posting this is to show people who have a yen for such things, that OSCRIPT IS POWERFUL. It's a toolkit that can do a lot of things which most folks can't imagine would be possible.

5. Finally, the MDD thing is a pretty good demo of WHY the "BarsSince" function would be sooo helpful for OScript, and when the dust settles from OVest rollout, I hope Nirvana will add it to the OScript toolkit.
^ Top
Lain

Regular
252525
Posts: 77

Joined: 10/11/2012

User Profile
 
Subject : RE: CAR, MDD and Calmar, in an OScript condition
Posted : 5/13/2014 7:45 AM
Post #30550 - In reply to #30447

Nice work. Thanks Jim!
^ Top
Jim Dean

Elite
10002525
Posts: 1059

Joined: 10/11/2012
Location: L'ville, GA

User Profile
 
Subject : RE: CAR, MDD and Calmar, in an OScript condition
Posted : 5/13/2014 8:05 AM
Post #30553 - In reply to #30550

I've found out something from Barry since posting earlier. The "window" over which the OScript is calc'd is ALWAYS the full history ... it ignores the Account settings "start date" entry. It also includes some unspecified-as-yet number of warmup bars, before 1/1/2000 ... which may or may not affect the MDD & CAR & CALMAR calc's depending on whether the "Equity C" is populated before the 1/1/2000 official-history start date.

So, every time you run these formulae, they will be for the period of 1/1/2000 (or before), up through whatever bar is being processed.

If you want to LIMIT the range of the calc's to a LATER start date, then you need to SUBTRACT some integer from "bar" wherever it's used in the formulae. That is, replace "bar" in the formulae with (bar-N-M), where:
N = bars (ie days) between your desired start date, and 1/1/2000
M = whatever number of warmup bars OVest is using (Barry please help with this info)

So, if you wanted to start your MDD or CAR or CALMAR analysis as of 1/1/2007, there are a total of six years before that since 1/1/2000, and each year has about 252 trading days, so N = 6*252 = 1512. If your test period starts on 1/1/2013, N would be 12 years = 3024.

[Edited by Jim Dean on 5/13/2014 8:12 AM]

Jump to page : 1
Now viewing page 1 [25 messages per page]
back

Legend    Action      Notification  
Administrator
Forum Moderator
Registered User
Unregistered User
E-Mail this thread to a friend
Toggle e-mail notification


Nirvana Systems
For any problems or issues please contact our Webmaster at webmaster@nirvsys.com.