Hi gsee, Thank you kindly for spending the time to look at my code and making the appropriate changes. The challenge for me is that I am new to blotter/quantstrat and have only used R for the past 1.5 months. Thank you all for you patience.
I just ran your new code and it generates the trades as I would expect based on the rules. :) I did get warnings after executing 'applyStrategy' on both the long and short strategies (please see below). I don't know whether these warnings are benign or serious in nature. In any case I am now in a position to continue my research. I do think this strategy highlights use cases that could be beneficial for users. Perhaps we can include the code for this strategy (or some variant of) more formally as a demo in the documentation i.e. a long / short portfolio strategy. Warning messages: 1: In match.names(columns, colnames(data)) : all columns not located in Close ma10 for IBM.Open IBM.High IBM.Low IBM.Close IBM.Volume IBM.Adjusted ma10 close.gt.ma10 2: In max(i) : no non-missing arguments to max; returning -Inf 3: In min(dindex[dindex > curIndex]) : no non-missing arguments to min; returning Inf 4: In match.names(columns, colnames(data)) : all columns not located in Close ma10 for UTX.Open UTX.High UTX.Low UTX.Close UTX.Volume UTX.Adjusted ma10 close.gt.ma10 5: In max(i) : no non-missing arguments to max; returning -Inf 6: In min(dindex[dindex > curIndex]) : no non-missing arguments to min; returning Inf Warning messages: 1: In match.names(columns, colnames(data)) : all columns not located in Close ma10 for CAT.Open CAT.High CAT.Low CAT.Close CAT.Volume CAT.Adjusted ma10 close.gt.ma10 2: In max(i) : no non-missing arguments to max; returning -Inf 3: In min(dindex[dindex > curIndex]) : no non-missing arguments to min; returning Inf 4: In match.names(columns, colnames(data)) : all columns not located in Close ma10 for MSFT.Open MSFT.High MSFT.Low MSFT.Close MSFT.Volume MSFT.Adjusted ma10 close.gt.ma10 5: In max(i) : no non-missing arguments to max; returning -Inf 6: In min(dindex[dindex > curIndex]) : no non-missing arguments to min; returning Inf -- View this message in context: http://r.789695.n4.nabble.com/quantstrat-custom-indicators-tp3491259p3497029.html Sent from the Rmetrics mailing list archive at Nabble.com. _______________________________________________ [email protected] 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.
