Moving averages on equity curve

Questions about MultiCharts and user contributed studies.
Algyros
Posts: 52
Joined: 28 Sep 2009
Location: Austin, TX
Has thanked: 1 time
Been thanked: 5 times

Moving averages on equity curve

Postby Algyros » 20 Aug 2011

Is it possible to apply moving averages to an equity curve on MC?

khalaad
Posts: 323
Joined: 07 Jan 2007
Location: Lahore, Pakistan
Has thanked: 64 times
Been thanked: 57 times

Re: Moving averages on equity curve

Postby khalaad » 20 Aug 2011

Algyros,

If you mean moving aveage on Strategy Performance Report equity curve(s); I do not think this is presently possible.

However, one may do this:
1. Add Symbol 'EQUITY' -- Exchange UNDEF, Category Cash, Data Source ASCII Mapping.
2. Compile a .csv file in EXCEL of daily (or any other time period) equity.
3. Import the data of the equity file to 'EQUITY'.
4. Plot the chart with moving average of choice.

Here is an informative article on equity curve trading:
http://www.breakoutfutures.com/Newslett ... er0205.htm

Khalid
Attachments
EQUITYwithMA.png
(43.21 KiB) Downloaded 796 times
EQUITY.xls
(25.5 KiB) Downloaded 227 times

User avatar
JoshM
Posts: 2195
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1544 times
Been thanked: 1565 times
Contact:

Re: Moving averages on equity curve

Postby JoshM » 01 Sep 2011

If you mean moving aveage on Strategy Performance Report equity curve(s); I do not think this is presently possible.
I think we're not on the same page, because as far as I know it's possible with the i_ClosedEquity reserved word, though this requires that the strategy is applied to one chart (i.e. no Portfolio Backtester) and requires thus a strategy (I assume Algyros is talking about a historical, not-generated-by-signals equity curve. :) ).

Anyway, for other interested users, an example with an indicator which plots the equity curve:

Code: Select all

Inputs: DisplayAccountCurve(True), // Display the 'Account equity curve' or else the 'equity curve'
AccountStart(5000), // Account starting value
MAPeriods(15); // MA periods.

Variables: AccountEquity(0), maOfAccountEquity(0);

if i_MarketPosition = 0 then begin
if DisplayAccountCurve = true then
AccountEquity = i_ClosedEquity + AccountStart
else
AccountEquity = i_ClosedEquity;
end else begin
if DisplayAccountCurve = true then
AccountEquity = i_OpenEquity+ AccountStart
else
AccountEquity = i_OpenEquity;
end;

// Change color with a growing account equity
if AccountEquity > AccountEquity[1] then
SetPlotColor(1, green)
else
SetPlotColor(1, red);

maOfAccountEquity = AverageFC(AccountEquity, MAPeriods);

Plot1(AccountEquity, "Equity");
Plot2(maOfAccountEquity, "MA", RGB(0, 128, 255));
Best regards,
Josh

khalaad
Posts: 323
Joined: 07 Jan 2007
Location: Lahore, Pakistan
Has thanked: 64 times
Been thanked: 57 times

Re: Moving averages on equity curve

Postby khalaad » 02 Sep 2011

Great job, Josh!

Thank you so much; there is almost ALWAYS an easier way of doing things.

fibonaccci
Posts: 49
Joined: 26 Dec 2009
Has thanked: 34 times
Been thanked: 1 time

Re: Moving averages on equity curve

Postby fibonaccci » 30 Jul 2012

Hi,

is it possible to use i_OpenEquity and the Moving Avg of the EquityCurve for a trading system to close out the position for backtesting and in real time trading?
Are there any simple coding examples?

Thank you

fibonaccci
Posts: 49
Joined: 26 Dec 2009
Has thanked: 34 times
Been thanked: 1 time

Re: Moving averages on equity curve

Postby fibonaccci » 31 Jul 2012

here is a code for i_OpenEquity and an Average of i_OpenEquity,
how can I use this Indicator in order to trigger Exits,
although I know that backtesting is not possible.

Thanks

Code: Select all

Inputs:
MALength(20),
StartingCapital( 100000 ),
RSILength(14);


Variables:
stratOpenEquity(0), stratClosedEquity(0), maValue(0), rsiValue(0);

stratOpenEquity = i_OpenEquity;
maValue = Average(stratOpenEquity, MALength);
rsiValue = RSI(stratOpenEquity, RSILength);

stratclosedEquity = i_ClosedEquity;

Plot1(stratOpenEquity, "OpenEquity");
Plot2(maValue, "MA");
//Plot3(rsiValue, "RSI");
Plot4(stratClosedEquity, "ClosedEquity");

User avatar
MAtricks
Posts: 789
Joined: 09 Apr 2012
Has thanked: 286 times
Been thanked: 288 times

Re: Moving averages on equity curve

Postby MAtricks » 22 Oct 2012

bump. How can this properly trigger exits?


Return to “MultiCharts”