Convert to Metastock 9 5 Count

#1
Hi,

Would anyone be kind enough to convert the following Tradestation code
for a 9 5 Count into Metastock Code as an indicator
(or better still as a MS Expert System )

See the attached Chart of the 9 5 Plot

Thank you in advance

Derek

Code:
inputs: 
	BackLen(4),
	FirstCount(5),
	SecondCount(9),
	UpPrice(Close),
	DnPrice(Close),
	ShowText( true ), 
	TextColor( White );
    
variables: 
	CountUp( 0 ),
    CountDn( 0 ),
	TextID( 0 ) ;
if UpPrice < UpPrice[BackLen] then CountUp = 0;
if UpPrice > UpPrice[BackLen] then
	begin
	CountUp = CountUp + 1 ;
	if CountUp = FirstCount  then 
		begin
		Plot1( H, "5 Sell" ) ;
		Alert ;
		if ShowText then 
			begin
			TextID = Text_New( Date, Time, High+(H*.001), NumToStr( CountUp, 0 ) ) ;
			Text_SetStyle( TextID, 2, 1 ) ;
			Text_SetColor( TextID, TextColor ) ;
			end ;
		end ;
	if CountUp = SecondCount  then 
		begin
		Plot2( H, "9 Sell" ) ;
		Alert ;
		if ShowText then 
			begin
			TextID = Text_New( Date, Time, High+(H*.001), NumToStr( CountUp, 0 ) ) ;
			Text_SetStyle( TextID, 2, 1) ;
			Text_SetColor( TextID, TextColor ) ;
			end ;
		end ;
end;
if DnPrice > DnPrice[BackLen] then CountDn = 0;
if DnPrice < DnPrice[BackLen] then
	begin
	CountDn = CountDn + 1 ;
	if CountDn = FirstCount  then 
		begin
		Plot3( L, "5 Buy" ) ;
		Alert ;
		if ShowText then 
			begin
			TextID = Text_New( Date, Time, Low-(Low*.001), NumToStr( CountDn, 0 ) ) ;
			Text_SetStyle( TextID, 2, 0 ) ;
			Text_SetColor( TextID, TextColor ) ;
			end ;
		end ;
	if Countdn = SecondCount then 
		begin
		Plot4( L, "9 Buy" ) ;
		Alert ;
		if ShowText then 
			begin
			TextID = Text_New( Date, Time, Low-(Low*.001), NumToStr( Countdn, 0 ) ) ;
			Text_SetStyle( TextID, 2, 0) ;
			Text_SetColor( TextID, TextColor ) ;
			end ;
	end ;
end;
 
Last edited:

Similar threads