[R-SIG-Finance] stoplimit market price with OHLC

Joshua Ulrich josh.m.ulrich at gmail.com
Sat Apr 2 16:18:53 CEST 2016

On Tue, Mar 29, 2016 at 9:46 AM, Diego Peroni <diegoperoni at vodafone.it> wrote:
> Hi All,
> my strategy exit an open position with a simple Signal based on 1 minute
> OHLC bars.
> This is my exit rule:
> add.rule(qs.strategy, name='ruleSignal',
>          arguments=list(sigcol='upTrend', sigval=TRUE,
>                         replace=TRUE,
>                         orderside='short',
>                         ordertype='market',
>                         orderqty='all',
>                         orderset='ocoshort'
>          ),
>          type='exit',
>          label='ExitShort',
>          enabled=TRUE)
> My question is: which price quantstrat use to sell market by default?
> - Current Bar Close Price?
> - Next Bar Open Price?
> - Next Bar "worst"/"best" Price?
Assuming you haven't specified "prefer", it will be NULL by default,
which means getPrice will be called on mktdata with prefer=NULL.  When
getPrice is called with prefer=NULL, it will search for a column name
containing "price", "trade", or "close" (in that order) and will
return the first it finds.

The transaction will occur on the observation after the order is
entered, since it's not safe to assume that your order will be filled
at the price you observed that triggered the order entry.

> Thanks in advance
> Diego
> _______________________________________________
> R-SIG-Finance at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only. If you want to post, subscribe first.
> -- Also note that this is not the r-help list where general R questions
> should go.

Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com
R/Finance 2016 | www.rinfinance.com

More information about the R-SIG-Finance mailing list