Trade the equity

 

Trade the equity

There are so many trading systems out there that all have something in common: sooner or later they are all facing a more or less heavy drawdown. They have times when they work nicely and times when they don´t. And as we all heard so often they stop working when we start trading them live despite so good backtesting results. Well, because of these good results we started livetrading and chances are that we face a drawdown after the last run up which it made at the end of the backtest. It would be nice to be able to stop the trading system (EA) from trading when it has a certain drawdown and start trading again when the equity goes up again and this way only trade the upmoves of the system.

In a book I read about trading the equitycurve of a trading system where the authors did their research and came up with some astonishing results. And as a picture is worth more than a thousand words please look at the example below (for copyright reasons I don´t want to take a picture / example from the book) .


This example is not even an EA but thats not important here. I simply filled in some trades in a spreadsheet (in this case some manually foolish trading on a demo account) which created the equitycurve (blue line) . Then I calculated a MA10 (simple) on this curve (red line) . The rule in this example now was only to trade when the equitycurve was above the MA10 and to do nothing when below. The result is shown by the result line (orange line) .

Do you see what happens? This is not a selected example. I just took what I got first. Just to start and get a line on which I can do my calculations. And I did not experiment with the MA10 to get a nice result. I just took something. In the book I read they made it with a 50 period donchian channel and I think we can experiment with everything we know from technical analysis or an EA on the equity of an EA to act as a filter and switch an EA on/off.

As you can see the first 10 trades were not made because the MA10 first had to be in place to switch on. This is something we have to keep in mind: depending on what ever system we use we need some trades first before we start the basic system.

Now imagine what happens when we trade a portfolio of some EAs this way. The market and the timeframe doesn´t matter. It is only the equitycurve that counts and becomes next to the EA itself and money management a third important part of our trading and attempt to make money.

I am not a pro in programming. I know how to write an EA, indicator or script but I come to my limits when it comes to file handling. I have no idea how to read out the orderprofit of a given EA to a file and add the next trades, show them maybe even in MT4 as a chart and so on. As you can see from the example above I just copied the history (saved as report) to a spreadsheet and did the rest there manually. To do that with several EAs every day will be a lot of work and I am looking for some way to automate this. If someone has a nice idea how to do that I would appreciate any response. And if someone likes the idea of an equityfilter and likes to do all the work and backtesting on it you are very welcome to share it here.

Happy trading



 

That simply makes no sense. If you stop trading when your equitycurve fall below M10, there is no more equity curve it becomes flat. How the curve can rise above the MA10 to start trading again ?

It's only something you can do after the facts.

 

Does he means simulate trading the entire time and only take the trades live when the equity curve is up ?

 
angevoyageur:

That simply makes no sense. If you stop trading when your equitycurve fall below M10, there is no more equity curve it becomes flat. How the curve can rise above the MA10 to start trading again ?

It's only something you can do after the facts.

You are right angevoyageur, that way it would make no sense. But SDC (2 posts below) got it right. You have to let your basic system run in the background to get the performancedata on which you can do your calculations and switch on/off for livetrading. Years before this would be done by papertrading but my thought is to get a little help from the computer and automate this as good as possible. Thanks for your response to make that point clear.
 
SDC:

Does he means simulate trading the entire time and only take the trades live when the equity curve is up ?


Yes SDC, thats what I meant. But in contrast to what deVries said Im not looking to get something for free but more 1.) to share this idea which I think isnt bad and 2.) this way to find some people out there who like to work together on this for the benefit of all. If it is understood the way deVries did I simply stop it and do the further research on my own.


Happy trading

 
realtrade:

Yes SDC, thats what I meant. But in contrast to what deVries said Im not looking to get something for free but more 1.) to share this idea which I think isnt bad and 2.) this way to find some people out there who like to work together on this for the benefit of all. If it is understood the way deVries did I simply stop it and do the further research on my own.


Happy trading


In the past i did that i rebuild a program coded it shared it for free

but when you share it with lot of people then there are a few people doing the work

and a lot of people only wants to benefit the work others do

if you search for a program to get closed files in a program

then open some demo accounts with different brokers and see the scripts i think interbank

will have some programs where you can get closed trades into an excell program

but i'm sure some other brokers will have also

 
realtrade:
You are right angevoyageur, that way it would make no sense. But SDC (2 posts below) got it right. You have to let your basic system run in the background to get the performancedata on which you can do your calculations and switch on/off for livetrading. Years before this would be done by papertrading but my thought is to get a little help from the computer and automate this as good as possible. Thanks for your response to make that point clear.

Ah ok. I'll think about it, thanks for sharing.

EDIT : Seems an interesting idea, and I am curious about what could be the result to apply this method.

1° We need a base system which is not too sensitive to "demo account", I mean it must present sensibly the same performance on live account and demo account.

2° We need an indicator who calculate equity curve and the MA of this curve.

3° Based on this indicator (or eventually include in the indicator) we can have an EA who provided a signal (trade/not trade) which can be exported in one way or another.

4° On live account, the based system can be modified by adding a filter based on the data exported in 3°.

What do you think all ? realtrade, are you a programmer ?

 
angevoyageur:

Ah ok. I'll think about it, thanks for sharing.

EDIT : Seems an interesting idea, and I am curious about what could be the result to apply this method.

1° We need a base system which is not too sensitive to "demo account", I mean it must present sensibly the same performance on live account and demo account.

2° We need an indicator who calculate equity curve and the MA of this curve.

3° Based on this indicator (or eventually include in the indicator) we can have an EA who provided a signal (trade/not trade) which can be exported in one way or another.

4° On live account, the based system can be modified by adding a filter based on the data exported in 3°.

What do you think all ? realtrade, are you a programmer ?

Hi angevoyageur,

to answer your last question first, nope Im not a programmer. Its learning by doing for quite some time now and I def. have my limits. But Im willing to learn and it seems here I found a subject that is worth making the next new step into filehandling.

to 1°

Yes, I prefer to have the same data and execution as I would have on the live account, therefor I was thinking of taking the open and close of virtual orders right from the same chart that I would trade from. Virtual orders means Im not opening these orders but get the prices according to the EA rules and calculate the difference (orderprofit) and go from there to your 2°, 3° and 4°.

Weather this can be done with an offlinechart, a spreadsheet or with papertrading .... Well, I will see where my reseach takes me to. However, I think this is a good way to control the risk (even when it also reduces the profit depending on the EA).

Thanx for your thoughts. Happy trading

 

That could easily be translated to an EA, I have coded self testing indicators that do exactly that to simulate trading on their own signals. I attach them to a chart and just leave them there, they display the running profit loss and any other relevent parameters as a screen display.

You could test this entire theory that way in an indicator. An NRP indicator would be best for this, or bar shift a regular one so its signals are true. Keep two running totals at the same time, one of simulated trading its signals the usual way and calculates an equity curve. The other simulates trading its equity curve. Attach it to a chart and it will run the entire chart in a split second and give the results, then if you wanted it to continue on the live prices you could let it do that too.

 
SDC:

That could easily be translated to an EA, I have coded self testing indicators that do exactly that to simulate trading on their own signals. I attach them to a chart and just leave them there, they display the running profit loss and any other relevent parameters as a screen display.

You could test this entire theory that way in an indicator. An NRP indicator would be best for this, or bar shift a regular one so its signals are true. Keep two running totals at the same time, one of simulated trading its signals the usual way and calculates an equity curve. The other simulates trading its equity curve. Attach it to a chart and it will run the entire chart in a split second and give the results, then if you wanted it to continue on the live prices you could let it do that too.

Hi SDC,

thanx for your response. Yes, Im thinking the same direction and did my first research yesterday evening. What is needed is a file that contains the profits of closed trades only of an EA (so x-axis is not time but number of trades) that can be opened as offline chart in mt4 again. I think I will find a way to do it.

But for now I have to focus on trading again.

Thanx for your input. Happy trading

 

Hi realtrade,

the idea of trading the balance curve is very interesting! In the end you get less trades but your drawdowns are lower and i come from the risk-side of trading! I am looking for an solution for my EA as well! Does anybody already has an code for that idea? How can i build the balance curve as indicator or something like that?

I found an interesting article! http://www.pimpmyea.com/equity-curve-trading/

Thanx

Julian

Reason: