Skip to content

Commit bdac3b4

Browse files
committed
Refactor moveTA to use panel functionality
In addition to the movement of TA, function calls and actions are re-ordered as well.
1 parent 756da0a commit bdac3b4

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

R/dropTA.R

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,18 @@ function(ta1,ta2,occ1=1,occ2=1,chob) {
4141
}
4242

4343
`moveTA` <-
44-
function(ta,pos,occ=1,dev) {
44+
function(ta,pos,occ=1,chob) {
4545

4646
pos <- pos - 1
4747

4848
if(missing(ta)) stop("no TA indicator specified")
4949

50-
# default to the current device if none specified
51-
if(missing(dev)) dev <- dev.cur()
52-
ta.list <- listTA(dev)
50+
# default to the current chob if none specified
51+
if(missing(chob)) chob <- get.chob()
52+
ta.list <- listTA(chob)
5353

5454
# get the current chob
55-
lchob <- get.chob()[[dev]]
55+
lchob <- chob
5656

5757
# make indicator name match original call
5858
if(regexpr("^add",ta) == -1) ta <- paste("add",ta,sep='')
@@ -63,12 +63,19 @@ function(ta,pos,occ=1,dev) {
6363

6464
if(is.na(which.ta)) stop("no TA")
6565

66-
lchob@passed.args$TA <- append(lchob@passed.args$TA[-which.ta],
67-
lchob@passed.args$TA[which.ta],
66+
lchob$Env$TA <- append(lchob$Env$TA[-which.ta],
67+
lchob$Env$TA[which.ta],
6868
after=pos)
69-
70-
do.call("chartSeries.chob",list(lchob))
71-
write.chob(lchob,lchob@device)
69+
lchob$Env$call_list <- append(lchob$Env$call_list[-(1+which.ta)],
70+
lchob$Env$call_list[1+which.ta],
71+
after=pos+1)
72+
# move actions
73+
lchob$Env$actions <- append(lchob$Env$actions[-(9+which.ta)],
74+
lchob$Env$actions[9+which.ta],
75+
after=pos+9)
76+
77+
lchob
78+
#write.chob(lchob,lchob@device)
7279
}
7380

7481
`dropTA` <-

0 commit comments

Comments
 (0)