[R-SIG-Finance] apply.paramset stopping on condition
Diego Peroni
diegoperoni at vodafone.it
Tue Mar 14 18:50:05 CET 2017
Hi Brain,
thanks for your answers.
See following answers below.
Diego
On 14/03/2017 18:02, Brian G. Peterson wrote:
> How are you planning to calculate this statistic to 'stop trading'?
For me it's just a threshold for drawdown: reading transaction by
transaction I can easly calculate it.
>
> If you're using net profit, drawdown, etc., these are typically
> calculated after the backtest is over, e.g. using updatePortf and
> tradeStats.
>
> Obviously this is too late to bail out early.
>
> You could conceivably check some 'partial' profit or loss in a rule
> (maybe a rebalance rule) from the trades that have happened, zero out
> all your signals, adjust the next dindex to the last observation to
> skip to the end.
Ok this is probably what I'm looking for!
>
> I'd argue that your question suggests that you're not doing analysis of
> your signals before running the expensive walk-forward or
> apply.paramset processes. Wouldn't it make more sense to apply your
> proposed parameters over your signal process, where the code should be
> vectorized, fast, and cheap, than to wait till you're running the
> comparatively slower path dependent rules?
If I've understood your suggestion I've seen that indicator&signal
calculation takes just few seconds, it's not a problem.
But I don't know effectiveness over trading...
>
> quantstrat has many functions for doing signal analysis, including
> signal analysis over a parameter set. See the signal analysis demos.
I'm going to see the code in signal.SMA.R and signal.RSI.R
>
> Also, I suspect you may be doing something else computationally
> expensive in your backtest. We can typically get to about one core-
> minute per symbol per day on tick data. So we've certainly seen tests
> that take hours or even days to run here, but those are over massive
> amounts of data. Have you profiled a single run of the backtest to see
> where it is spending its time?
I'm testing 7 years of minute data (1 symbol) and 1 backtesting normally
takes about 2 hours.
My simulation uses trailingstops and I think that it is the slowest
order type (path.dep).
Am I wrong?
Is there a way to profile where my backtest is spending its time?
Thanks a lot for your help! :-)
>
> Regards,
>
> Brian
>
>
More information about the R-SIG-Finance
mailing list