Data Manipulation in a series
Posted: Wed Oct 23, 2013 5:24 am
Hi,
I am trying to create a series for signals for past 200 days such that if my signal on previous day was -1 ( exit a trade) ,my position becomes 0 today and if it was 1 on previous day (entry) , my position becomes +1 today. My Entry and exit signals comes from different series.
I am trying to code it like :
for !k=1 to 200
smpl @first+!end -200 @first+!end-(200-!k)
if @last(trade_pos(-1))=-1 then
@elem(trade_pos,!k) = 0
endif
if @last(trade_pos(-1))=1 then
@elem(trade_pos,!k) = 1
endif
next
But this doesn't seem to work. Is there a better way to do this ?
I am trying to create a series for signals for past 200 days such that if my signal on previous day was -1 ( exit a trade) ,my position becomes 0 today and if it was 1 on previous day (entry) , my position becomes +1 today. My Entry and exit signals comes from different series.
I am trying to code it like :
for !k=1 to 200
smpl @first+!end -200 @first+!end-(200-!k)
if @last(trade_pos(-1))=-1 then
@elem(trade_pos,!k) = 0
endif
if @last(trade_pos(-1))=1 then
@elem(trade_pos,!k) = 1
endif
next
But this doesn't seem to work. Is there a better way to do this ?