Traders Laboratory - View Single Post - Allocating Trading Day Number
View Single Post
  #1 (permalink)  
Old 02-16-2008, 01:08 AM
johni johni is offline
johni has no status.

 
Join Date: Jan 2008
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Allocating Trading Day Number

Hi,

Anyone can help to translate the following Metastock code into TS2000i compatiable code?

The indicator allocate a number to each trading day and reset to zero following a new month.

========================= ========================= ====
{ User input }
EOM:=Input("Final month's end: [1]True, [2]Current (dynamic)",1,2,1);

{ Choice of Static/Dynamic last EOM signal }
EOM:=If(EOM=2,Cum(1)=Last Value(Cum(1)),
DayOfMonth()=31);

{ Start of month }
nuMonth:=Month()<>Ref(Mon th(),-1) OR Cum(1)=2;

{ End of month }
monthEnd:=PeakBars(1,
-(nuMonth OR Cum(IsDefined(nuMonth))=1 ),1)=0
OR EOM;

{ Plot signals in own window }
nuMonth;-monthEnd

BarsSince(nuMonth)
========================= ========================= =====

Regards.

Reply With Quote