[R-SIG-Finance] Need help getting stop-loss and take-profit orders to work with indicators

Ilya Kipnis ilya.kipnis at gmail.com
Wed Aug 6 18:32:35 CEST 2014


Mark,

Are you using an outdated version of TTR? Josh had the same problem
when he tried my demo.

My error isn't a "stop, program won't run" error, but a runtime error
of my exit rules not working--that is, I only get a few entry orders
filled, and then no exits ever.

-Ilya

On Wed, Aug 6, 2014 at 10:10 AM, Mark Knecht <markknecht at gmail.com> wrote:
> On Tue, Aug 5, 2014 at 3:47 PM, Ilya Kipnis <ilya.kipnis at gmail.com> wrote:
>> Mark,
>>
>> Thanks for getting back to me. Since I'm using gmail, I didn't have any line
>> wraps. However, I'm attaching my demo as an R file. Fixed the little typo.
>>
>> Thanks so much.
>>
>> -Ilya
>>
>
> When using gmail ensure you have 'plain text' selected. (bottom right usually)
>
> When I run this code I see this as the first failure:
>
> [1] "Hammer_4TP"
>>
>> #apply strategy
>> t1 <- Sys.time()
>> out <- applyStrategy(strategy=strategy.st,portfolios=portfolio.st)
> Error in `colnames<-`(`*tmp*`, value = c("XLB.Close.SMA.30",
> "XLB.Close.SMA.10.sma1.SMA.30" :
>   length of 'dimnames' [2] not equal to array extent
>> t2 <- Sys.time()
>> print(t2-t1)
> Time difference of 0.06236649 secs
>>
>
> Is that the problem you are trying to solve?
>
> Generally it's good to be really clear about what you're asking for.
> Show the code run, copy error messages, etc.
>
> - Mark



More information about the R-SIG-Finance mailing list