Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

back_test

Generic back test function


Description

Back test by enter and exit signals with stop loss on price history. Execution is immediate. Useful for testing on daily data.

Usage

back_test(enter, exit, price, stop_loss = -1000, side = 1L)

Arguments

enter

bool vector of length n of enter signals

exit

bool vector of length n of exit signals

price

numeric vector of length n of prices

stop_loss

relative stop loss, must be negative

side

direction of enter order, -1:short, 1:long

Value

trades data.table with columns price_enter,price_exit,mtm_min,mtm_max,id_enter,id_exit,pnl_trade,side


QuantTools

Enhanced Quantitative Trading Modelling

v0.5.7.1
GPL-3
Authors
Stanislav Kovalevsky
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.