Learn R Programming

aqr (version 0.4)

approximateSLTP: Approximates StopLoss/TakeProfit for a given PNL series and an HLC series.

Description

This function uses the generatePnlCurve function to forward generate a PNL curve. Best, test it with your own series to understand how it works (or contribute documentation).

Usage

approximateSLTP (high, low, close, takeProfit, stopLoss, runningPosition, messages=FALSE)

Arguments

high
an XTS object containing the highs of a price series
low
an XTS object containing the lows of a price series
close
an XTS object containing the closes of a price series
takeProfit
an absolute value when to trigger a take profit action
stopLoss
an absolute value when to trigger a stop loss action
runningPosition
the running position
messages
whether to print informational message or not, defaults to FALSE

Value

a two column matrix with position and pnl, where position is a rewritten version of the input