- ago
QUOTE:
In other words, only take the trade if the equity curve is above the SMA of the equity curve.


I've been thinking about basing trades on the equity curve. My question is, how can it be backtested? In a standard backtest, if the condition is such that no trades should be taken, the equity curve would never change, as no more trades are taken by the backtesting engine.

I can think of a couple of ways to make this work, both involve saving the trades you would take based on the equity curve and letting the backtesting continue as normal.

My question - Is there an easier way? Perhaps something built into WL that I'm not familiar with?

Thanks,
TG
0
273
7 Replies

Reply

Bookmark

Sort
- ago
#1
QUOTE:
In a standard backtest, if the condition is such that no trades should be taken, the equity curve would never change, as no more trades are taken by the backtesting engine.

Right. Our PowerPack extension has the "Trading the system's Equity Curve" PosSizer with related option: "Don't skip trade but adjust size".
2
- ago
#2
Eugene, thanks for confirming. The ability to position size based on the curve makes sense as the trade still happens and the equity curve continues to evolve. Not taking trades is another matter.
1
Cone8
 ( 23.78% )
- ago
#3
Coming late to the party, so I might be off base...

It seems to me that it depends if the portfolio is still holding positions as these will keep moving the equity curve.

In any case, it's just a matter of logic. Assume you're not holding positions and the equity is below its SMA. You just need a rule to start trading again. What is it?

Maybe you don't trade for 30 days.

Maybe you wait for the average to equal equity. Again, assuming no open positions, this will happen at the SMA period since the last closed trade.
0
- ago
#4
QUOTE:
You just need a rule to start trading again. What is it?

I think that's the wrong question. Rather the simulation needs to continue trading (like there's no tomorrow), but there needs to be a disconnect between the simulation (i.e. backtest) and "signals" controlling actual portfolio trading. Trading signals need to be suppressed (or a colored warning attached), but the backtest needs to proceed.

But if WL performs this disconnect between the simulation and trading signals, then how is WL suppose to quantify this disconnect? One solution leads to another problem.
1
- ago
#5
QUOTE:
You just need a rule to start trading again. What is it?


Let's assume no positions are held, so the equity curve would be static. Then yes, a time-out rule or something like that could kick it off again. But, in this case, we want to keep the strategy running and jump back in based on the equity curve.

QUOTE:
but there needs to be a disconnect between the simulation (i.e. backtest) and "signals" controlling actual portfolio trading. Trading signals need to be suppressed (or a colored warning attached), but the backtest needs to proceed.


This is more what I'm looking for. It seems to me that I can accomplish this by running the strategy twice (same symbols, and time frame).

On the first run execute as normal, but write the trades that meet the equity criteria to a file, list, or whatever. Save them with a key like Symbol/Bar DateTime.

Run the strategy again. This time before you take the trade check the file to see if that trade exists. If does, take it, if not, skip it. This second run would only take the trades that met the equity curve criteria, and produce the related performance metrics.

Any reason why this would not work? I'd rather know now than after I take the time to build it.

0
Glitch8
 ( 10.92% )
- ago
#6
Can’t think of any reason why it wouldn’t work, and I even remember people doing this back in the WL6 days.

You could probably even leverage the StrategyRunner class to help achieve this.
0
- ago
#7
@TraderGuy, I recall a conversation that may help you make life more complex than it should be (read: the PosSizer option) 😂

How can I track hidden positions?

Topic starter considered the StrategyRunner class too but dropped out for performance reasons in WL7 (which may be no longer actual since WL8 has improved in every sense).
0

Reply

Bookmark

Sort