[R-SIG-Finance] Help activating stop loss order.

Joshua Ulrich josh.m.ulrich at gmail.com
Wed Nov 4 16:13:09 CET 2015


Thanks for the reproducible example.  Your chain rule isn't executing
because of timezone issues.  Your script works if you call
Sys.setenv(TZ="UTC") before calling applyStrategy.

On Thu, Aug 27, 2015 at 12:00 AM, Amod Karve (अमोद)
<karve.amod at gmail.com> wrote:
> forgot to add the contents of position_sizing.r. Here it is:
>
> osFixedDollar <- function(data, timestamp, orderqty, portfolio, symbol,
> ruletype, ...) {
>   ClosePrice <- as.numeric(Cl(mktdata[timestamp,]))
>   orderqty <- round(tradeSize / ClosePrice, -2)
>   return(orderqty)
> }
>
>
> On Thu, Aug 27, 2015 at 12:51 AM, Amod Karve (अमोद) <karve.amod at gmail.com>
> wrote:
>
>> Hey All,
>>
>>  For the life of me I can't figure out why my stop loss order is not
>> getting triggered. I am trying to play around with a simple Trend vigor
>> strategy as illustrated in Ilya kipnis's blog. Everything else works except
>> for the stop loss order which doesn't seem to take effect. I can't even see
>> the stop loss in my order book (I see it only if I set type='risk' instead
>> of chain).
>>
>> Could someone help me figure out where the problem might be?
>>
>> Attached please find the code.
>>
>> Thanks
>> amod
>>
>
>         [[alternative HTML version deleted]]
>
> _______________________________________________
> 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



More information about the R-SIG-Finance mailing list