Equity Curve - What do Open and High Array Values Represent?

Hello all,

I hope you are well. In the ~~~Equity curve, Close array represents the end of the day equity vaue and L array represents cash available. Can someone please let me know what do Open and High arrays represent ?

Many thanks,
AD

Portfolio Equity (~~~EQUITY symbol):

Close field -> All Trades Equity
Open field -> Long Trades Equty
High field -> Short Trades Equity
Low field -> Cash
OpenInterest field -> Open Positions

Plot( Foreign( "~~~EQUITY", "C"), "All Trades", colorAqua );
Plot( Foreign( "~~~EQUITY", "O"), "Long Trades", colorgreen );
Plot( Foreign( "~~~EQUITY", "H"), "Short Trades", colorRed );
Plot( Foreign( "~~~EQUITY", "L"), "Cash", colorGold );
Plot( Foreign( "~~~EQUITY", "I"), "Open Positions", colorOrange, styleOwnScale );

14

10 Likes

@fxshrat

Taking your response a step further, I was trying to modify the equity chart in the backtest report to include open positions. Using Plot (Foreign("~~~Equity", "I")... results in 1 open position the entire time, which I guess is to be expected.

How can I modify the "Portfolio Equity.afl" to plot open positions in a backtest? Ie, X open
positions out of a max of 10 total positions.

Thanks for your help.

Then you simply have just 1 open position the entire time!
It depends on your code and settings.

As you can see in below example it does NOT show 1 open pos. entire time.
15

Same as result list does not show 1 open position entire time
14

SetOption("MaxOpenPositions", 4);
SetPositionSize(10, spsPercentOfEquity);
m = MA( Close, 20 );
Buy = Cross( Close, m ); 
Sell = Cross( m, Close ); 
Short = Cover = 0;

In Portfolio Equity AFL you do not need to use Foreign. You just need OI or OpenInterest to refere to open positions as during backtest (and as regards to backtest report creation) it (OI and other data fields) refer to Equity data.

And if you want percentage output then you may do like this

Plot(OI/GetOption("MaxOpenPositions")*100, "OpenPos%", colorRed);

16

1 Like

Thanks @fxshrat for your help!

I must have an issue with my settings. I used your example code and some of my own code and it plots current open positions but not historical. Any idea of what I need to adjust in my settings? I've looked though backtester settings and also preferences and it isn't obvious to me what is the issue.

Thanks again for your guidance.

here is output that shows the current open position count but does not plot historical position count correctly.
1_ Portfolio Equity

Sorry - I figured it out, it was a scale issue - needed to plot on separate axis.

@fxshrat

sorry, one last question if that's ok, how did you get OI to plot in a new chart below the equity chart?

My equity and open interest is plotting in the same chart and looks way to busy...

Thanks for your help.

Simply add addtional (plotting/drawing) AFLs to Report Charts folder of Charts window.
E.g. create AFL by name "1.1 Open Positions.afl" and save it to that folder.

18

3 Likes

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.