Equity Curve on a Chart

Questions about MultiCharts and user contributed studies.
TraderWalrus
Posts: 63
Joined: 13 Sep 2016
Has thanked: 30 times
Been thanked: 8 times

Equity Curve on a Chart

Postby TraderWalrus » 26 Dec 2016

Is there any way to overlay the equity curve on a chart? It will be very useful if we could compare the curve with price action / technical indicators.

As I understand it is not possible to use plot from a signal.

The only way I can think of to achieve that, is to write an indicator that tries to simulate strategy results and plots cumulative profit accordingly.

User avatar
ABC
Posts: 626
Joined: 16 Dec 2006
Has thanked: 119 times
Been thanked: 355 times
Contact:

Re: Equity Curve on a Chart

Postby ABC » 27 Dec 2016

TraderWalrus,

you can make use of some of the reserved words starting with I_ to plot strategy metrics in an indicator that is applied to the same chart as the strategy.
You could also use I_SetPlotValue and I_GetPlotValue to make any value from your strategy available to an indicator and plot it.
The online help has an example that does pretty much what you are looking for already:
https://www.multicharts.com/trading-sof ... tplotvalue
https://www.multicharts.com/trading-sof ... tplotvalue

Regards,

ABC

Mark Brown
Posts: 91
Joined: 29 Nov 2016
Has thanked: 38 times
Been thanked: 6 times

Re: Equity Curve on a Chart

Postby Mark Brown » 06 Jan 2017

if I_OpenEquity >= 0 then
Plot1( I_OpenEquity, "OpenEquity", Green )
else
Plot1( I_OpenEquity, "OpenEquity", Red ) ;


if I_ClosedEquity = 0 then
Plot2( I_ClosedEquity, "ClosedEquity", DarkGreen )
else if I_ClosedEquity > 0 then
Plot2( I_ClosedEquity, "ClosedEquity", DarkGreen )
else
Plot2( I_ClosedEquity, "ClosedEquity", DarkRed ) ;

Plot3( 0, "ZeroLine", DarkGray ) ;

Mark Brown
Posts: 91
Joined: 29 Nov 2016
Has thanked: 38 times
Been thanked: 6 times

Re: Equity Curve on a Chart

Postby Mark Brown » 06 Jan 2017

Input: PositiveColor( Green ),
NegitiveColor( Red ),
ZeroLineColor( White );

Variables:
OPP(0),
ProfToday(0),
PLB4Today(0);

OPP = I_OpenEquity;
If date <> date[1] Then PLB4Today = OPP[1];
ProfToday = OPP - PLB4Today;

If ( ProfToday > 0 ) Then SetPlotColor( 1, PositiveColor )
Else SetPlotColor( 1, NegitiveColor );

Plot1(ProfToday, "Daily P&L");
Plot2(0, "Zero Line", ZeroLineColor);

Mark Brown
Posts: 91
Joined: 29 Nov 2016
Has thanked: 38 times
Been thanked: 6 times

Re: Equity Curve on a Chart

Postby Mark Brown » 06 Jan 2017

{ *******************************************************************

Indicator : Equity Profile

Last Edit : 9/22/97

Provided By : Bob Fulks

Description : This indicator plots bars of closed equity for each
trade of a system on the last 200 bars of a chart. If more than
200 trades, it only plots the last 200 trades. The first bar is
cyan to note the beginning of the plot.

The number of trades plotted is the variable "Size" which may
be changed. If changed, set the size of the array "ACE" and the
"MaxBarsBack" equal to the value of "Size".

In the unlikely event that the change in equity of a trade is
exactly zero, the trade will not be recorded. To avoid this, set
commissions to some odd value such as $95 or $0.0001 for zero.

The indicator is a recoding, for greater speed, of the indicator
shown in the TS Express Newsletter of Jul/Aug 1996. It uses a
ring buffer instead of shifting the array on each new point.

© 1997 Robert G. Fulks. All rights reserved.

********************************************************************}
Vars: Countr(0), J(0), K(0), CE(0), Size(200), Last(0);
Array: ACE[200](0);

CE = I_ClosedEquity;
if CE <> CE[1] then begin {If equity changes }
ACE[Countr] = CE; {Save new value }
Countr = Mod(Countr + 1, Size); {Move pointer in buffer }
end;

if LastBarOnChart then begin
for J = 0 to Size - 1 begin {Loop to plot bars }
K = Mod(Countr + J, Size); {Calc pointer }

if ACE[K] < Last then {Plot losers in red }
Plot1[Size - 1 - J](ACE[K],"ClosEquity");

if ACE[K] > Last then {Plot winners in green }
Plot2[Size - 1 - J](ACE[K],"ClosEquity");

Last = ACE[K];
Plot4[Size - 1 - J](0, "Zero"); {Plot baseline }
end;
Plot3[Size - 1](ACE[Countr],"End"); {Plot leftmost bar }
end;

User avatar
TJ
Posts: 7156
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 988 times
Been thanked: 2041 times

Re: Equity Curve on a Chart

Postby TJ » 06 Jan 2017

See post #1 & #2
viewtopic.php?t=11713


Return to “MultiCharts”