Trading the strategy profit curve

Category: Trading

 

There are a billions ways to adapt your risk exposure while trading. Another approach is to base our trades triggers on recent performance of the strategy by using the strategy profit curve like any other technical indicator. ProBuilder language offers this possibility.

What is the strategy profit curve ?

The instruction ‘strategyprofit’ is present in the ProBuilder language. It returns the profit of the automated trading strategy you actually trade. Like any other variable it can be use to manage trading triggers with specific conditions based on it.

A perfect trading strategy would return a perfect profit curve, like this one :

strategy profit graph curve

Of course, it is irrelevant as it would reflect a strategy that always win or never cut a loss.

Using the strategy profit curve, built in ProRealTime, can almost achieve this possibility, not to make a strategy perfect, but the capability to make your profit curve look more straight than it could be without using this trick.

Let have a look of what is the strategy profit look like in ProBacktest, using the GRAPH instruction i introduced in a recent other blog article.

I’m using a simple golden cross long only strategy on S&P500 :

i1 = exponentialaverage[15](close)
i2 = exponentialaverage[50](close)

long = i1 crosses over i2
short = i1 crosses under i2

IF NOT LongOnMarket AND long THEN
  BUY 1 CONTRACTS AT MARKET
ENDIF

IF short THEN
  SELL AT MARKET
ENDIF

Adding the GRAPH instruction at the end of the code, to reflect the profit as a variable :

GRAPH strategyprofit as "strategy profit"

Return the stair steps of our profit over time :

equity curve trading graph

Use strategyprofit variable as a trigger

While our strategy may have a nice decent profit, its curve is not so straight and may create doubt in its reliability over time. We know that the strategy is profitable on long term, because we also have a clear view of the past by now, but we also know by now that market conditions may minimize its profitability sometimes.

Sometimes, our strategy profit is declining, we can avoid long runs of profit disappearance by triggering our entries with the strategyprofit curve.

This curve can act as any other technical indicators to make market entries decisions. A simple way to open trades or not is to add a classical moving average to the curve and using it as a trigger.

Passing strategyprofit values into a simple moving average :

curveperiod = 500
equitycurve = average[curveperiod](strategyprofit)

GRAPH equitycurve coloured(255,0,0) as "profit curve"

give us a more clear view of the profit over time :

curving the strategy profit over time

We can see here that a crossover of the profit of the strategy crossing its average may be a good trigger to :

  1. stop using the strategy while the profit is under the average
  2. trading the strategy while the profit is still over the average profit over time

 

Equity curve trading

Here is the entire code of the strategy within the triggers :

//variables 
equitycurve = undefined
curveperiod = 500
once mydays = 1
once olddate = 0

//indicators 
i1 = exponentialaverage[15](close)
i2 = exponentialaverage[50](close)
equitycurve = average[curveperiod](strategyprofit)

//trades conditions
long = i1 crosses over i2
short = i1 crosses under i2

//mydays variable incrementing to let the average curve build over time
if date > olddate then
  mydays=mydays+1
  olddate = date
endif

//first trades while the average profit curve is building
IF NOT LongOnMarket AND long AND mydays<curveperiod THEN
  BUY 1 CONTRACTS AT MARKET
ENDIF

//trades when the curve has built
IF NOT LongOnMarket AND long AND strategyprofit>=equitycurve AND mydays>curveperiod THEN
  BUY 1 CONTRACTS AT MARKET
ENDIF

//exit positions
IF short THEN
  SELL AT MARKET
ENDIF

GRAPH equitycurve coloured(255,0,0) as "profit curve"
GRAPH strategyprofit as "strategy profit"

and here is the strategy profit returns by ProBacktest :

equity curve trading with triggersSo, here is the deal : we have a better straight profit curve, but we may have also not trade for a long period and miss a lot of good trades while the strategy profit were under its average. There is nothing perfect, but the strategy well perform most of the times.

Here is a profit curve comparison :

equity-curve-comparaison

Because the average will never drop below the actual profit of the strategy, we need to trigger its activation when the average is equal to profit. This will lead to trade once and get back to non trade period if this trade is not a profitable one. In fact, this behaviour can be a strategy killer, it can results in slow profit drain if there are a lot of bad trades in the same row. This is the main con of this trading trick, but there are many more ways to deal with the strategyprofit curve, this article deal with the main idea behind it and i’m gonna talk again in future blog’s posts, i guess !

Many more ways to deal with the strategyprofit curve

Here are some ideas, that be can explored by this technique :

  • trades volumes sized adapted to the equity curve values (more volumes or less when you are below/above it)
  • use standard deviation of your strategy profit : when profit derivate more than 2% from its average, stop trading or adapt strategy
  • rebalancing strategy on other instrument
  • … your ideas !

I’ll appreciate discuss more about this with any one, please feel free to comment and share your ideas about it ! Thanks in advance.

 

Logo Logo
Loading...