Jump to content

9-5 count for Metastock


Recommended Posts

Hi,

 

Would anyone be kind enough to convert the following Tradestation code

for a 9 5 Count into Metastock Code as an indicator?

 

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;

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...