espiral59 Posted March 25, 2017 Report Posted March 25, 2017 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; Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.