**Article/Author:**

**Download:**STR PRFT.ELA

**File Includes:**

Indicator - ELD Strategy Profit

**Category:**Indicator > Miscellaneous

**Description:**

Like the built in Strategy Equity indicator, this indicator is designed to graphically display performance information about a strategy that has been applied to a chart. This indicator should be applied to the chart after the strategy has been applied, and it will display the cumulative profit factor for the strategy.

**Usage:**

This indicator separately accumulates the incremental profit or loss each time a position is closed out, and then divides the accumulated profit (gross profit) by the accumulated loss (gross loss) to determine the profit factor. If your strategy scales out of a position, note that the profit factor will not update until a position is fully closed out.

**No Inputs**

**EasyLanguage Code:**

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

NOTES: Calculates and plots Strategy Profit Factor

CRITICAL =Does NOT calculate multiple lots within a single

trade. Views multiple lots as a single trade when closed.

**********************************************************************}

VARIABLES: Market_Position( 0 ),

Closed_Equity( 0 ),

Closed_Equity_Old( 0 ),

Trade_Profit( 0 ),

Gross_Profit( 0 ),

Gross_Loss( 0 ),

Profit_Factor( 1 ) ;

Market_Position = I_Marketposition ;

Closed_Equity = I_ClosedEquity ;

IF Closed_Equity <> 0 AND

Market_Position <> Market_Position[1] AND

Market_Position[1] <> 0 THEN BEGIN

Trade_Profit = Closed_Equity - Closed_Equity_Old ;

IF Trade_Profit > 0 THEN

Gross_Profit = Gross_Profit + Trade_Profit ELSE

Gross_Loss = Gross_Loss + Absvalue( Trade_Profit ) ;

IF Gross_Loss = 0 THEN

Profit_Factor = 100 ELSE

Profit_Factor = Gross_Profit / Gross_Loss ;

Closed_Equity_Old = Closed_Equity ;

END ;

{ ***** Plot if Profit Factor <> 0 or <> 100 and set color ***** }

IF Closed_Equity <> 0 THEN BEGIN

Plot1( 1, "PF=1", White );

IF Profit_Factor = 100 THEN

Plot2( 1, "Pft Fac", Green, Default, 0 ) ELSE

Plot2( Profit_Factor, "Pft Fac", Green, Default, 2 ) ;

IF Profit_Factor < 1 THEN

Setplotcolor[1]( 2, Red );

IF Profit_Factor[1] = 100 THEN

Setplotcolor[1]( 2, Black );

END ;