Current Equity Level
Author: dansmo
Creation Date: 3/1/2010 7:04 AM
profile picture

dansmo

#1
How do I get the current level of equity?
In WL4 I used this:
QUOTE:
Equity(BarCount-1)

I already had a look at the WL5 Wiki atricle on "Interacting dynamically with Portfolio level equity". However, this was quite confusing to me, as I only need this on figure!

profile picture

Eugene

#2
Getting the current level of equity is not supported in WL5. Otherwise it would be documented in the QuickRef and I wouldn't have to create this workaround. But you can still give the Wiki article a go, these examples are quite illustrative and simple:
CODE:
Please log in to see this code.
profile picture

Eugene

#3
But if you were used to access the portfolio equity in simuscripts i.e. "Equity(BarCount-1)", this is still quite easily possible in WL5 using PosSizers. Although the API documentation is currently unaccessible, this will be supported and requires no programming tricks (e.g. Trading the Equity Curve PosSizer).
profile picture

dansmo

#4
QUOTE:

DataSeries globalEquity = sr.EquityCurve;...PlotSeries( gEqPane, globalEquity, Color.DarkGreen, LineStyle.Histogram, 2 );


I dont understand where "sr" is coming from.
profile picture

Eugene

#5
You don't have to, it's an "programming trick" from Community.Components' Utility.cs that uses some undocumented (unsupported) classes. Try using the data series as a regular data series:
CODE:
Please log in to see this code.
profile picture

dansmo

#6
Sorry, I dont get it. Next trades size should depend on current equity.
CODE:
Please log in to see this code.

profile picture

Eugene

#7
In this case, you should use "bar", and not "Bars.Count-1". The latter syntax is for finding the equity value on the last bar outside of the trading loop.
profile picture

dansmo

#8
"Tne name'globalEquity' does not exist in the current context."

Sorry, I meant "The name 'sr' dpes not exist...".
profile picture

Eugene

#9
Right, it doesn't - because you have arbitrarily removed many necessary lines of code from the Wiki example.
profile picture

dansmo

#10
Like I said. I do not understand it. Now, I added some lines. But still does not work.
"Object referencet not set to an instace of an object.
at WealthLab.Strategies.MyStrategies.Execute()
at Community.Components.Utility.runDonor
CODE:
Please log in to see this code.
profile picture

Eugene

#11
The code runs fine, it just wouldn't produce any results because its "donor system" code is missing, so the equity is 0 at all times:
CODE:
Please log in to see this code.


P.S. Another forum thread to look for the hints: Save Equity Curve Data
profile picture

dansmo

#12
There is a donor code at the end. I just modified it, so that there are no trades and the equity will stay at the level I enter in the Position size tab.
profile picture

Eugene

#13
I couldn't duplicate the error, but in any case, please try restarting WLD or simply running ClearGlobals once to clear WL's global memory.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).