EquityCurve: Plotting Statistics from Your Strategy

When developing a strategy within TradeStation, many times it is important to plot how the system is performing in order to visually see ways in which it can be improved. TradeStation has built-in functions that allow you to plot various statistical measures of your system from an indicator. These are known as the I_XXXX reserved words. An indicator can use these to obtain strategy performance information. Most strategy-only performance-related reserved words can be replicated in an indicator using a combination of the I_XXXX reserved words:

I_OpenEquity (in an indicator) = NetProfit + OpenPositionProfit
                                 (in a strategy)
I_ClosedEquity (in an indicator) = NetProfit (in a strategy)
I_OpenEquity – I_ClosedEquity (in an indicator) = OpenPositionProfit 
                                                  (in a strategy)

Here are all the I_ reserved words:


These indicators can be helpful in better understanding your system. However, they cannot be used to filter the system in any way.=For example, you cannot use them to filter out trades when the equity curve crosses below its moving average. These measures are based on the real system results. If you want to do something like filtering the system using the equity curve this requires a shadow system which monitors a unfiltered copy of the rules equity and we can see the real trades based on filtered version. It’s simple to use these functions in an indicator. Look at the simple example below:

Inputs: ELen(40);
Vars: CurEquity(0), AveEquity(0);
Vars: AlertCond(FALSE);
CurEquity = I_openequity;
Plot1(CurEquity, "Plot1" );

AveEquity = Average(CurEquity,ELen);
Plot2(AveEquity, "Plot2" );

AlertCond =CurEquity < AveEquity;
if Condition1 then
	Alert( "Not Safe To Trade" );

Let’s see how this looks on a chart:


You can see that for about a dozen trades the current cycle equity stays below the moving average. This is because intermarket trades have serial dependencies due to decoupling between the traded market and the intermarket. Equity curve filters are a good tools for trading using intermarket analysis.

Please check out this product – EquityCurve – as well as my other free TradeStation code by filling out the form on the right!

Leave a Reply

Your email address will not be published. Required fields are marked *