Traders Laboratory - View Single Post - "Rebase" function in Tradestation
View Single Post
  #4 (permalink)  
Old 12-08-2007, 11:55 PM
thrunner thrunner is offline
thrunner has no status.

 
Join Date: Feb 2007
Posts: 178
Thanks: 60
Thanked 47 Times in 25 Posts
Re: "Rebase" function in Tradestation

Quote:
View Post
IRT will allow for the plotting of multiple instruments on the same scale as a percentage change so I may be able to do this with that combo
Good luck with your efforts in IRT. Here is an example of TS code that will do this:
//A look at sector rotation, plot the nine Sector SPDRs vs base line, start at 1st of the year, changeable. INPUTS: MyDate(1070103), DataNum(9); // match this with number of Datastreams; also chart limit array set at 24 Var: Num (0); Array: CloseData[24] (0); For Num = 1 to DataNum begin If date = MyDate then CloseData[num] = Close of data(num); // assign the start date close value end; If date >= MyDate then begin plot1 (Close of Data(1)/ CloseData[1] - 1, "Clo1" , Blue ); plot2 (Close of Data(2)/ CloseData[2] - 1, "Clo2" , Cyan ); plot3 (Close of Data(3)/ CloseData[3] - 1, "Clo3" , Red ); plot4 (Close of Data(4)/ CloseData[4] - 1, "Clo4" , Green ); plot5 (Close of Data(5)/ CloseData[5] - 1, "Clo6" , DarkBlue); plot6 (Close of Data(6)/ CloseData[6] - 1, "Clo6" , Magenta ); plot7 (Close of Data(7)/ CloseData[7] - 1, "Clo7" , DarkGray); plot8 (Close of Data(8)/ CloseData[8] - 1, "Clo8" , DarkRed ); plot9 (Close of Data(9)/ CloseData[9] - 1, "Clo9" , DarkBrown); end;
Sample output, top 6 symbols cut off and not shown.
Attached Images
File Type: png NineSector SPDRs 2007-12-08_234609.png (23.2 KB, 40 views)
File Type: png NineSector Lookup2007-12-08_234640.png (24.9 KB, 5 views)

Reply With Quote