# How to get equity high value?

Questions about MultiCharts and user contributed studies.
TW
Posts: 29
Joined: 14 Dec 2009
Has thanked: 4 times

### 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: 29
Joined: 14 Dec 2009
Has thanked: 4 times

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 crossoverFastMA = AverageFC(close, FastLength);SlowMA = AverageFC(close, SlowLength);if FastMA crosses above SlowMA then   buy ("LE") next bar at marketelse 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 barsHighestEquity = 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: 29
Joined: 14 Dec 2009
Has thanked: 4 times
You are so professional! I will try it later.