[Blotter-commits] r958 - pkg/quantstrat/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sun Mar 4 16:29:13 CET 2012
Author: braverock
Date: 2012-03-04 16:29:13 +0100 (Sun, 04 Mar 2012)
New Revision: 958
Modified:
pkg/quantstrat/R/orders.R
Log:
- stoplimit, stoptrailing, iceberg orders with threshold now enter correct prices (again)
TODO FIXME execution logic still broken for these, but needed to fix prices first.
Modified: pkg/quantstrat/R/orders.R
===================================================================
--- pkg/quantstrat/R/orders.R 2012-03-04 01:35:01 UTC (rev 957)
+++ pkg/quantstrat/R/orders.R 2012-03-04 15:29:13 UTC (rev 958)
@@ -220,18 +220,15 @@
#we have a threshold set on a stop* order, process it
switch(ordertype,
stoplimit =,
- iceberg = {
- # handle setting the stop limit price
- if(isTRUE(tmult)){
- price = price*threshold
- } else {
- price = price+threshold
- }
- },
+ iceberg =,
stoptrailing = {
if(isTRUE(tmult)){
- #get the difference between the threshold*price and the price
- threshold = (price*threshold)-price
+ #set the numeric theshold as threshold*price
+ if(threshold<1) threshold = price*threshold
+ else{
+ #get the difference between the threshold*price and the price
+ threshold = price-(price*threshold) #positive threshold
+ }
tmult=FALSE
#this sets the threshold as a fixed number for later trailing orders
}
More information about the Blotter-commits
mailing list