# How to get equity high value?

Questions about MultiCharts and user contributed studies.
TW
Posts: 31
Joined: 14 Dec 2009
Has thanked: 5 times
Been thanked: 1 time

### How to get equity high value?

I want to get equity high value to calculate, like the highest equity value of recent one year. But it seems there is no functions in power language. Does anyone know about this issue?

Bruce DeVault
Posts: 438
Joined: 19 Jan 2010
Location: Washington DC
Been thanked: 2 times
Contact:
Assign the equity to a numeric series variable, then use the "highest" function to return the high within X bars. Or, you could track it and look back in another way, such as to Jan 1.

TW
Posts: 31
Joined: 14 Dec 2009
Has thanked: 5 times
Been thanked: 1 time

I'm a beginner, would you please just give me a simple example? Thank you very much!

Bruce DeVault
Posts: 438
Joined: 19 Jan 2010
Location: Washington DC
Been thanked: 2 times
Contact:
Sure, something like this as a very basic starting point, to give you an idea where to go from here to flesh it out in whatever directions you need:

Code: Select all

```inputs: FastLength(10), SlowLength(20), StartingEquity(100000); variables: FastMA(0), SlowMA(0), ClosedEquity(0), Trades(0), HighestEquity(0); // MA crossover FastMA = AverageFC(close, FastLength); SlowMA = AverageFC(close, SlowLength); if FastMA crosses above SlowMA then buy ("LE") next bar at market else if FastMA crosses below SlowMA then sellshort ("SE") next bar at market; // track closed equity once ClosedEquity = StartingEquity; Trades = NumLosTrades + NumEvenTrades + NumWinTrades; if Trades > Trades[1] then ClosedEquity = ClosedEquity + PositionProfit(1); // calculate highest closed equity in last 200 bars HighestEquity = Highest(ClosedEquity, 200); ```
This is certainly not the only way to do this, and is a little longer than it needs to be, mostly to demonstrate how some of the pieces relate. You might want to enhance it to include open P/L, make the lookback for "highest" adjustable either as an input or perhaps based on a date such as yearly or quarterly, or various other alterations relative to this example starting point.

TW
Posts: 31
Joined: 14 Dec 2009
Has thanked: 5 times
Been thanked: 1 time
You are so professional! I will try it later.