Tradery Forum Index Tradery
Trading tools and community
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Create new data series

 
Post new topic   Reply to topic    Tradery Forum Index -> Trading systems
View previous topic :: View next topic  
Author Message
Rigi583



Joined: 13 Jan 2010
Posts: 2
Location: Switzerland

PostPosted: Wed Jan 13, 2010 1:09 pm    Post subject: Create new data series Reply with quote

Hi

I am intending to make a new data series but I have no idea where to start. The basic of that series should be the following:

If close(t)>close(t-1) then 1
If close(t)=close(t-1) then 0 else -1

Does anyone have an idea?

Thanks a lot for your help!
Back to top
View user's profile Send private message
koolaidluke



Joined: 25 May 2009
Posts: 54

PostPosted: Thu Feb 04, 2010 9:59 pm    Post subject: Reply with quote

Hi Rigi583. I'm sorry you had to wait so long for a reply. I think the following inelegant code snippet will do what you want.
Code:

   Series newseries = 0*closeSeries();
   for (Index j=1;j<newseries.size();j++) {
      if (close(j)>close(j-1))
         newseries[j] = 1;
      else if (close(j)<close(j-1))
         newseries[j] = -1;
   }

This code is 100% untested, so, you know, beware. Good luck.
Back to top
View user's profile Send private message
Rigi583



Joined: 13 Jan 2010
Posts: 2
Location: Switzerland

PostPosted: Fri Feb 05, 2010 10:07 am    Post subject: Reply with quote

Hi koolaidluke

Thanks a lot for your reply. Will test it and see how it works!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Tradery Forum Index -> Trading systems All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group