/ / + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + / /  
 / / )       _ _ _ _     _     _     _ _ _ _     _ _ _ _     _ _ _ _     _ _ _ _     _ _     _ _         _ _             _ _ _     _ _ _ _ _     _ _     _ _       ( / /  
 / / )     (   _ _ _ ) (   \ /   ) (     _   \ (     _   \ (   _ _ _ ) (   _ _ _ ) (     \ /     )     / _ _ \         /   _ _ ) (     _     ) (     \ /     )     ( / /  
 / / )       ) _ _ )     )     (     ) ( _ )   ) )       /   ) _ _ )     ) _ _ )     )         (     / ( _ _ ) \     (   ( _ _     ) ( _ ) (     )         (       ( / /  
 / / )     ( _ _ )     ( _ / \ _ ) ( _ _ _ _ / ( _ ) \ _ ) ( _ _ _ _ ) ( _ _ _ _ ) ( _ / \ / \ _ ) ( _ _ ) ( _ _ ) ( ) \ _ _ _ ) ( _ _ _ _ _ ) ( _ / \ / \ _ )     ( / /  
 / / )       h t t p : / / f x d r e e m a . c o m                                                             C o p y r i g h t   2 0 1 6 ,   f x D r e e m a     ( / /  
 / / + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + / /  
 # p r o p e r t y   c o p y r i g h t   " "  
 # p r o p e r t y   l i n k             " h t t p s : / / f x d r e e m a . c o m "  
  
 / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /  
 / /   + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +   / /  
 / /   |                                               I N P U T   P A R A M E T E R S ,   G L O B A L   V A R I A B L E S ,   C O N S T A N T S ,   I M P O R T S   a n d   I N C L U D E S                                                 |   / /  
 / /   |                                             S y s t e m   a n d   C u s t o m   v a r i a b l e s   a n d   o t h e r   d e f i n i t i o n s   u s e d   i n   t h e   p r o j e c t                                               |   / /  
 / /   + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +   / /  
 / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /  
  
 / / V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V / /  
 / /   S y s t e m   c o n s t a n t s   ( p r o j e c t   s e t t i n g s )   / /  
 / / ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ / /  
 / / - -  
 # d e f i n e   P R O J E C T _ I D   " m t 5 - 2 0 5 8 "  
 / / - -  
 / /   P o i n t   F o r m a t   R u l e s  
 # d e f i n e   P O I N T _ F O R M A T _ R U L E S   " 0 . 0 0 1 = 0 . 0 1 , 0 . 0 0 0 0 0 1 = 0 . 0 0 0 1 "  
 / / - -  
 / /   E v e n t s   O n / O f f  
 # d e f i n e   E N A B L E _ E V E N T _ T I C K   1   / /   e n a b l e   " T i c k "   e v e n t  
 # d e f i n e   E N A B L E _ E V E N T _ T R A D E   0   / /   e n a b l e   " T r a d e "   e v e n t  
 # d e f i n e   E N A B L E _ E V E N T _ T I M E R   0   / /   e n a b l e   " T i m e r "   e v e n t  
 / / - -  
 / /   S e t t i n g s   f o r   e v e n t s  
 # d e f i n e   O N _ T I M E R _ P E R I O D   5   / /   T i m e r   e v e n t   p e r i o d   ( i n   s e c o n d s )  
  
 / / V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V / /  
 / /   S y s t e m   c o n s t a n t s   ( p r e d e f i n e d   c o n s t a n t s )   / /  
 / / ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ / /  
 / / - -  
 # d e f i n e   T L O B J P R O P _ T I M E 1   8 0 1  
 # d e f i n e   O B J P R O P _ T L _ P R I C E _ B Y _ S H I F T   8 0 2  
 # d e f i n e   O B J P R O P _ T L _ S H I F T _ B Y _ P R I C E   8 0 3  
 # d e f i n e   O B J P R O P _ F I B O V A L U E   8 0 4  
 # d e f i n e   O B J P R O P _ F I B O P R I C E V A L U E   8 0 5  
 # d e f i n e   O B J P R O P _ F I R S T L E V E L   8 0 6  
 # d e f i n e   O B J P R O P _ T I M E 1   8 0 7  
 # d e f i n e   O B J P R O P _ T I M E 2   8 0 8  
 # d e f i n e   O B J P R O P _ T I M E 3   8 0 9  
 # d e f i n e   O B J P R O P _ P R I C E 1   8 1 0  
 # d e f i n e   O B J P R O P _ P R I C E 2   8 1 1  
 # d e f i n e   O B J P R O P _ P R I C E 3   8 1 2  
 # d e f i n e   O B J P R O P _ B A R S H I F T 1   8 1 3  
 # d e f i n e   O B J P R O P _ B A R S H I F T 2   8 1 4  
 # d e f i n e   O B J P R O P _ B A R S H I F T 3   8 1 5  
 # d e f i n e   S E L _ C U R R E N T   0  
 # d e f i n e   S E L _ I N I T I A L   1  
  
 / / V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V / /  
 / /   I m p o r t s ,   C o n s t a n t s ,   V a r i a b l e s   / /  
 / / ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ / /  
 / / - -  
 / /   C o n s t a n t s   ( I n p u t   P a r a m e t e r s )  
 i n p u t   s t r i n g   s y m _ 1   =   " " ; i n p u t   s t r i n g   s y m _ 2   =   " " ; i n p u t   s t r i n g   s y m _ 3   =   " " ; i n p u t   d o u b l e   g r o u p   =   1 ; i n p u t   d o u b l e   p r o f i t _ l e v e l   =   0 ; i n p u t   i n t   M a g i c S t a r t   =   2 0 5 8 ;   / /   M a g i c   N u m b e r ,   k i n d   o f . . .  
 c l a s s   c  
 {  
 	 p u b l i c :  
 	 s t a t i c   s t r i n g   s y m _ 1 ;  
 	 s t a t i c   s t r i n g   s y m _ 2 ;  
 	 s t a t i c   s t r i n g   s y m _ 3 ;  
 	 s t a t i c   d o u b l e   g r o u p ;  
 	 s t a t i c   d o u b l e   p r o f i t _ l e v e l ;  
 	 s t a t i c   i n t   M a g i c S t a r t ;  
 } ;  
 s t r i n g   c : : s y m _ 1 ;  
 s t r i n g   c : : s y m _ 2 ;  
 s t r i n g   c : : s y m _ 3 ;  
 d o u b l e   c : : g r o u p ;  
 d o u b l e   c : : p r o f i t _ l e v e l ;  
 i n t   c : : M a g i c S t a r t ;  
  
 / / - -  
 / /   V a r i a b l e s   ( G l o b a l   V a r i a b l e s )  
 c l a s s   v  
 {  
 	 p u b l i c :  
 	 s t a t i c   d o u b l e   s i n t h _ a s k ;  
 } ;  
 d o u b l e   v : : s i n t h _ a s k ;  
  
 / / - -  
 / /   E x t e r n s   ( G l o b a l   V a r i a b l e s )  
 i n p u t   s t r i n g   i n p 4   =   " ( 4 )   B u y   n o w " ;  
 i n p u t   d o u b l e   i n p 4 _ V o l u m e S i z e   =   0 . 1 ;  
 i n p u t   s t r i n g   i n p 5   =   " ( 5 )   S e l l   n o w " ;  
 i n p u t   d o u b l e   i n p 5 _ V o l u m e S i z e   =   0 . 1 ;  
 i n p u t   s t r i n g   i n p 6   =   " ( 6 )   S e l l   n o w " ;  
 i n p u t   d o u b l e   i n p 6 _ V o l u m e S i z e   =   0 . 1 ;  
 i n p u t   s t r i n g   i n p 7   =   " ( 7 )   T i m e   f i l t e r " ;  
 i n p u t   s t r i n g   i n p 7 _ T i m e S t a r t   =   " 0 0 : 0 0 " ;  
 i n p u t   s t r i n g   i n p 7 _ T i m e E n d   =   " 0 0 : 0 1 " ;  
 c l a s s   _ e x t e r n s  
 {  
 	 p u b l i c :  
 	 s t a t i c   s t r i n g   i n p 4 ;  
 	 s t a t i c   d o u b l e   i n p 4 _ V o l u m e S i z e ;  
 	 s t a t i c   s t r i n g   i n p 5 ;  
 	 s t a t i c   d o u b l e   i n p 5 _ V o l u m e S i z e ;  
 	 s t a t i c   s t r i n g   i n p 6 ;  
 	 s t a t i c   d o u b l e   i n p 6 _ V o l u m e S i z e ;  
 	 s t a t i c   s t r i n g   i n p 7 ;  
 	 s t a t i c   s t r i n g   i n p 7 _ T i m e S t a r t ;  
 	 s t a t i c   s t r i n g   i n p 7 _ T i m e E n d ;  
 } ;  
 s t r i n g   _ e x t e r n s : : i n p 4   =   i n p 4 ;  
 d o u b l e   _ e x t e r n s : : i n p 4 _ V o l u m e S i z e   =   i n p 4 _ V o l u m e S i z e ;  
 s t r i n g   _ e x t e r n s : : i n p 5   =   i n p 5 ;  
 d o u b l e   _ e x t e r n s : : i n p 5 _ V o l u m e S i z e   =   i n p 5 _ V o l u m e S i z e ;  
 s t r i n g   _ e x t e r n s : : i n p 6   =   i n p 6 ;  
 d o u b l e   _ e x t e r n s : : i n p 6 _ V o l u m e S i z e   =   i n p 6 _ V o l u m e S i z e ;  
 s t r i n g   _ e x t e r n s : : i n p 7   =   i n p 7 ;  
 s t r i n g   _ e x t e r n s : : i n p 7 _ T i m e S t a r t   =   i n p 7 _ T i m e S t a r t ;  
 s t r i n g   _ e x t e r n s : : i n p 7 _ T i m e E n d   =   i n p 7 _ T i m e E n d ;  
  
 / / V V V V V V V V V V V V V V V V V V V V V V V V V / /  
 / /   S y s t e m   g l o b a l   v a r i a b l e s   / /  
 / / ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ / /  
 / / - -  
 i n t   F X D _ C U R R E N T _ F U N C T I O N _ I D   =   0 ;  
 d o u b l e   F X D _ M I L S _ I N I T _ E N D         =   0 ;  
 i n t   F X D _ T I C K S _ F R O M _ S T A R T         =   0 ;  
 i n t   F X D _ M O R E _ S H I F T                     =   0 ;  
 b o o l   F X D _ D R A W _ S P R E A D _ I N F O       =   f a l s e ;  
 b o o l   F X D _ F I R S T _ T I C K _ P A S S E D     =   f a l s e ;  
 b o o l   F X D _ B R E A K                             =   f a l s e ;  
 b o o l   F X D _ C O N T I N U E                       =   f a l s e ;  
 s t r i n g   F X D _ C U R R E N T _ S Y M B O L       =   " " ;  
 i n t   F X D _ B L O C K S _ C O U N T                 =   8 ;  
  
 / / -   f o r   u s e   i n   O n C h a r t ( )   e v e n t  
 s t r u c t   f x d _ o n c h a r t  
 {  
 	 i n t   i d ;  
 	 l o n g   l p a r a m ;  
 	 d o u b l e   d p a r a m ;  
 	 s t r i n g   s p a r a m ;  
 } ;  
 f x d _ o n c h a r t   F X D _ O N C H A R T ;  
  
 / / V V V V V V V V V V V V V V V V V V V / /  
 / /   S y s t e m   s t r u c t u r e s   / /  
 / / ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ / /  
 s t r u c t   p o s i t i o n  
 {  
       u l o n g         p o s i t i o n _ i d ;  
       l o n g           t y p e ,  
                         m a g i c ;  
       d a t e t i m e   t i m e ;  
       d o u b l e       v o l u m e ,  
                         p r i c e _ o p e n ,  
                         s l ,  
                         t p ,  
                         p r i c e _ c u r r e n t ,  
                         c o m i s s i o n ,  
                         s w a p ,  
                         p r o f i t ;  
       s t r i n g       s y m b o l ,  
                         c o m m e n t ;  
 } ;  
 s t r u c t   o r d e r  
 {  
       d a t e t i m e   t i m e _ s e t u p ,  
                         t i m e _ e x p i r a t i o n ,  
                         t i m e _ d o n e ;  
       l o n g           t y p e ,  
                         s t a t e ,  
                         t y p e _ f i l l i n g ,  
                         t y p e _ t i m e ,  
                         m a g i c ,  
                         p o s i t i o n _ i d ;  
       u l o n g         t i c k e t ;  
       d o u b l e       v o l u m e _ i n i t i a l ,  
                         v o l u m e _ c u r r e n t ,  
                         p r i c e _ o p e n ,  
                         s l ,  
                         t p ,  
                         p r i c e _ c u r r e n t ,  
                         p r i c e _ s t o p l i m i t ;  
       s t r i n g       s y m b o l ,  
                         c o m m e n t ;  
 } ;  
  
 p o s i t i o n     E G V _ P o s i t i o n s L i s t [ ] ;  
 p o s i t i o n     E G V _ P o s i t i o n s L i s t 0 [ ] ;  
 o r d e r           E G V _ O r d e r L i s t [ ] ;  
 o r d e r           E G V _ O r d e r L i s t 0 [ ] ;  
  
 / / - -  
 / /   V a r i a b l e s   f o r   O n / O f f  
 b o o l   d i s a b l e d [ 8 ] ;  
  
 / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /  
 / /   + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +   / /  
 / /   |                                                                                                   E V E N T   F U N C T I O N S                                                                                                     |   / /  
 / /   |                                                       T h e s e   a r e   t h e   m a i n   f u n c t i o n s   t h a t   c o n t r o l s   t h e   w h o l e   p r o j e c t                                                       |   / /  
 / /   + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +   / /  
 / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /  
  
 / / V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V / /  
 / /   T h i s   f u n c t i o n   i s   e x e c u t e d   o n c e   w h e n   t h e   p r o g r a m   s t a r t s   / /  
 / / ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ / /  
 i n t   O n I n i t ( )  
 {  
 	 / /   I n i t i a t e   C o n s t a n t s  
 	 c : : s y m _ 1   =   s y m _ 1 ;  
 c : : s y m _ 2   =   s y m _ 2 ;  
 c : : s y m _ 3   =   s y m _ 3 ;  
 c : : g r o u p   =   g r o u p ;  
 c : : p r o f i t _ l e v e l   =   p r o f i t _ l e v e l ;  
 c : : M a g i c S t a r t   =   M a g i c S t a r t ;  
  
 	 / /   I n i t i a t e   E x t e r n s  
 	 _ e x t e r n s : : i n p 4   =   i n p 4 ;  
 _ e x t e r n s : : i n p 4 _ V o l u m e S i z e   =   i n p 4 _ V o l u m e S i z e ;  
 _ e x t e r n s : : i n p 5   =   i n p 5 ;  
 _ e x t e r n s : : i n p 5 _ V o l u m e S i z e   =   i n p 5 _ V o l u m e S i z e ;  
 _ e x t e r n s : : i n p 6   =   i n p 6 ;  
 _ e x t e r n s : : i n p 6 _ V o l u m e S i z e   =   i n p 6 _ V o l u m e S i z e ;  
 _ e x t e r n s : : i n p 7   =   i n p 7 ;  
 _ e x t e r n s : : i n p 7 _ T i m e S t a r t   =   i n p 7 _ T i m e S t a r t ;  
 _ e x t e r n s : : i n p 7 _ T i m e E n d   =   i n p 7 _ T i m e E n d ;  
  
 	 / /   d o   o r   d o   n o t   n o t   i n i t i l i a l i z e   o n   r e l o a d  
 	 i f   ( U n i n i t i a l i z e R e a s o n ( )   ! =   0 )  
 	 {  
 	 	 i f   ( U n i n i t i a l i z e R e a s o n ( )   = =   R E A S O N _ C H A R T C H A N G E )  
 	 	 {  
 	 	 	 / /   i f   t h e   s y m b o l   i s   t h e   s a m e ,   d o   n o t   r e l o a d ,   o t h e r w i s e   c o n t i n u e   b e l o w  
 	 	 	 i f   ( F X D _ C U R R E N T _ S Y M B O L   = =   S y m b o l ( ) )   { r e t u r n   I N I T _ S U C C E E D E D ; }  
 	 	 }  
 	 	 e l s e  
 	 	 {  
 	 	 	 r e t u r n   I N I T _ S U C C E E D E D ;  
 	 	 }  
 	 }  
 	 F X D _ C U R R E N T _ S Y M B O L   =   S y m b o l ( ) ;  
  
 v : : s i n t h _ a s k   =   0 ;  
  
 	 C o m m e n t ( " " ) ;  
 	 f o r   ( i n t   i = O b j e c t s T o t a l ( C h a r t I D ( ) ) ;   i > = 0 ;   i - - )  
 	 {  
 	 	 s t r i n g   n a m e   =   O b j e c t N a m e ( C h a r t I D ( ) ,   i ) ;  
 	 	 i f   ( S t r i n g S u b s t r ( n a m e , 0 , 8 )   = =   " f x d _ c m n t " )   { O b j e c t D e l e t e ( C h a r t I D ( ) ,   n a m e ) ; }  
 	 }  
 	 C h a r t R e d r a w ( ) ;  
  
  
 	 / /   T h i s   i s   n e e d e d   f o r   O n T r a d e   e v e n t  
 	 B u i l d P o s i t i o n s L i s t ( E G V _ P o s i t i o n s L i s t 0 ) ;  
 	 B u i l d O r d e r s L i s t ( E G V _ O r d e r L i s t 0 ) ;  
  
 	 / / - -   s e t   i n i t i a l   l o c a l   a n d   s e r v e r   t i m e  
 	 T i m e A t S t a r t ( " s e t " ) ;  
  
 	 / / - -   s e t   i n i t i a l   b a l a n c e  
 	 A c c o u n t B a l a n c e A t S t a r t ( ) ;  
  
 	 / / - -   d r a w   t h e   i n i t i a l   s p r e a d   i n f o   m e t e r  
 	 F X D _ D R A W _ S P R E A D _ I N F O   =   ! ( M Q L I n f o I n t e g e r ( M Q L _ T E S T E R )   & &   ! M Q L I n f o I n t e g e r ( M Q L _ V I S U A L _ M O D E ) ) ;  
 	 i f   ( F X D _ D R A W _ S P R E A D _ I N F O )   D r a w S p r e a d I n f o ( ) ;  
  
 	 / / - -   d r a w   i n i t i a l   s t a t u s  
 	 D r a w S t a t u s ( " w a i t i n g   f o r   t i c k . . . " ) ;  
  
 	 i f   ( E N A B L E _ E V E N T _ T I M E R )   {  
 	 	 O n T i m e r S e t ( O N _ T I M E R _ P E R I O D ) ;  
 	 }  
  
  
 	 F X D _ M I L S _ I N I T _ E N D 	 	 	 =   ( d o u b l e ) G e t T i c k C o u n t ( ) ;  
 	 F X D _ F I R S T _ T I C K _ P A S S E D 	 =   f a l s e ;   / /   r e s e t   i s   n e e d e d   w h e n   c h a n g i n g   i n p u t s  
  
 	 r e t u r n ( I N I T _ S U C C E E D E D ) ;  
 }  
  
 / / V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V / /  
 / /   T h i s   f u n c t i o n   i s   e x e c u t e d   o n   e v e r y   i n c o m i n g   t i c k   / /  
 / / ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ / /  
 / /   T h i s   i s   t h e   n a t i v e   M Q L 4   o n - t i c k   f u n c t i o n  
 v o i d   O n T i c k ( )  
 {  
 	 F X D _ T I C K S _ F R O M _ S T A R T + + ;  
  
 	 i f   ( F X D _ T I C K S _ F R O M _ S T A R T   = =   1 )   D r a w S t a t u s ( " w o r k i n g " ) ;  
  
 	 / / - -   s p e c i a l   s y s t e m   a c t i o n s  
 	 i f   ( F X D _ D R A W _ S P R E A D _ I N F O )   D r a w S p r e a d I n f o ( ) ;  
 	 T i c k s D a t a ( " " ) ;   / /   C o l l e c t   t i c k s   ( i f   n e e d e d )  
 	 T i c k s P e r S e c o n d ( f a l s e ,   t r u e ) ;   / /   C o l l e c t   t i c k s   p e r   s e c o n d  
 	 O C O D r i v e r ( ) ;   / /   C h e c k   a n d   c l o s e   O C O   o r d e r s  
  
 	 b l o c k 1 ( 0 ) ;  
 	 b l o c k 7 ( 0 ) ;  
  
 	 r e t u r n ;  
 }  
  
 / / V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V / /  
 / /   T h i s   f u n c t i o n   i s   e x e c u t e d   o n   t r a d e   e v e n t s   -   o p e n ,   c l o s e ,   m o d i f y   / /  
 / / ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ / /  
 v o i d   O n T r a d e ( )  
 {  
 	 O n T r a d e Q u e u e ( 1 ) ;  
  
 	 O n T r a d e Q u e u e ( - 1 ) ;  
 }  
  
 / / V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V / /  
 / /   T h i s   f u n c t i o n   i s   e x e c u t e d   o n   a   p e r i o d   b a s i s   / /  
 / / ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ / /  
 v o i d   O n T i m e r ( )  
 {  
 }  
  
 / / V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V / /  
 / /   T h i s   f u n c t i o n   i s   e x e c u t e d   w h e n   c h a r t   e v e n t   h a p p e n s   / /  
 / / ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ / /  
 v o i d   O n C h a r t E v e n t (  
 	 c o n s t   i n t   i d ,                   / /   E v e n t   I D  
 	 c o n s t   l o n g &   l p a r a m ,       / /   P a r a m e t e r   o f   t y p e   l o n g   e v e n t  
 	 c o n s t   d o u b l e &   d p a r a m ,   / /   P a r a m e t e r   o f   t y p e   d o u b l e   e v e n t  
 	 c o n s t   s t r i n g &   s p a r a m     / /   P a r a m e t e r   o f   t y p e   s t r i n g   e v e n t s  
 )  
 {  
 	 / / - -   w r i t e   p a r a m e t e r   t o   t h e   s y s t e m   g l o b a l   v a r i a b l e s  
 	 F X D _ O N C H A R T . i d           =   i d ;  
 	 F X D _ O N C H A R T . l p a r a m   =   l p a r a m ;  
 	 F X D _ O N C H A R T . d p a r a m   =   d p a r a m ;  
 	 F X D _ O N C H A R T . s p a r a m   =   s p a r a m ;  
  
 	 r e t u r n ;  
 }  
  
 / / V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V / /  
 / /   T h i s   f u n c t i o n   i s   e x e c u t e d   o n c e   w h e n   t h e   p r o g r a m   e n d s   / /  
 / / ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ / /  
 v o i d   O n D e i n i t ( c o n s t   i n t   r e a s o n )  
 {  
 	 i n t   r e s o n   =   U n i n i t i a l i z e R e a s o n ( ) ;  
       i f   ( r e s o n   = =   R E A S O N _ C H A R T C H A N G E   | |   r e s o n   = =   R E A S O N _ P A R A M E T E R S   | |   r e a s o n   = =   R E A S O N _ T E M P L A T E )   { r e t u r n ; }  
  
 	 / / - -   i f   T i m e r   w a s   s e t ,   k i l l   i t   h e r e  
 	 E v e n t K i l l T i m e r ( ) ;  
  
 	 D r a w S t a t u s ( " S t o p p e d " ) ;  
 	 D r a w S p r e a d I n f o ( ) ;  
  
  
 	 i f   ( M Q L I n f o I n t e g e r ( M Q L _ T E S T E R ) )   {  
 	 	 P r i n t ( " B a c k t e s t e d   i n   " + D o u b l e T o S t r i n g ( ( G e t T i c k C o u n t ( ) - F X D _ M I L S _ I N I T _ E N D ) / 1 0 0 0 ,   2 ) + "   s e c o n d s " ) ;  
 	 	 d o u b l e   t c   =   G e t T i c k C o u n t ( ) - F X D _ M I L S _ I N I T _ E N D ;  
 	 	 i f   ( t c   >   0 )  
 	 	 {  
 	 	 	 P r i n t ( " A v e r a g e   t i c k s   p e r   s e c o n d :   " + D o u b l e T o S t r i n g ( F X D _ T I C K S _ F R O M _ S T A R T / t c ,   0 ) ) ;  
 	 	 }  
 	 }  
  
 	 i f   ( M Q L I n f o I n t e g e r ( M Q L _ P R O G R A M _ T Y P E )   = =   P R O G R A M _ E X P E R T )  
 	 {  
 	 	 s w i t c h ( U n i n i t i a l i z e R e a s o n ( ) )  
 	 	 {  
 	 	 	 c a s e   R E A S O N _ P R O G R A M 	 	 :   P r i n t ( " E x p e r t   A d v i s o r   s e l f   t e r m i n a t e d " ) ;   b r e a k ;  
 	 	 	 c a s e   R E A S O N _ R E M O V E 	 	 :   P r i n t ( " E x p e r t   A d v i s o r   r e m o v e d   f r o m   t h e   c h a r t " ) ;   b r e a k ;  
 	 	 	 c a s e   R E A S O N _ R E C O M P I L E 	 :   P r i n t ( " E x p e r t   A d v i s o r h a s   b e e n   r e c o m p i l e d " ) ;   b r e a k ;  
 	 	 	 c a s e   R E A S O N _ C H A R T C H A N G E 	 :   P r i n t ( " S y m b o l   o r   c h a r t   p e r i o d   h a s   b e e n   c h a n g e d " ) ;   b r e a k ;  
         	 	 c a s e   R E A S O N _ C H A R T C L O S E 	 :   P r i n t ( " C h a r t   h a s   b e e n   c l o s e d " ) ;   b r e a k ;  
         	 	 c a s e   R E A S O N _ P A R A M E T E R S 	 :   P r i n t ( " I n p u t   p a r a m e t e r s   h a v e   b e e n   c h a n g e d   b y   a   u s e r " ) ;   b r e a k ;  
         	 	 c a s e   R E A S O N _ A C C O U N T 	 	 :   P r i n t ( " A n o t h e r   a c c o u n t   h a s   b e e n   a c t i v a t e d   o r   r e c o n n e c t i o n   t o   t h e   t r a d e   s e r v e r   h a s   o c c u r r e d   d u e   t o   c h a n g e s   i n   t h e   a c c o u n t   s e t t i n g s " ) ;   b r e a k ;  
 	 	 	 c a s e   R E A S O N _ T E M P L A T E 	 	 :   P r i n t ( " A   n e w   t e m p l a t e   h a s   b e e n   a p p l i e d " ) ;   b r e a k ;  
 	 	 	 c a s e   R E A S O N _ I N I T F A I L E D 	 :   P r i n t ( " O n I n i t ( )   h a n d l e r   h a s   r e t u r n e d   a   n o n z e r o   v a l u e " ) ;   b r e a k ;  
 	 	 	 c a s e   R E A S O N _ C L O S E 	 	 	 :   P r i n t ( " T e r m i n a l   h a s   b e e n   c l o s e d " ) ;   b r e a k ;  
 	 	 }  
 	 }  
  
 	 r e t u r n ;  
 }  
  
 / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /  
 / /   + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +   / /  
 / /   |                                                                                           F u n c t i o n s   o f   b l o c k s                                                                                                     |   / /  
 / /   |                             F u n c t i o n s   t h a t   c o n t a i n   t h e   a c t u a l   c o d e   o f   t h e   b l o c k s   a n d   t h e i r   i n p u t   p a r a m e t e r s   a s   w e l l                           |   / /  
 / /   + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +   / /  
 / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /  
  
 / /   B l o c k   3  
 v o i d   b l o c k 0 ( i n t   _ p a r e n t _ = 0 )  
 {  
 	 i f   ( d i s a b l e d [ 0 ]   | |   F X D _ B R E A K )   { r e t u r n ; }  
 	 F X D _ C U R R E N T _ F U N C T I O N _ I D = 0 ;  
 	  
 	 s t a t i c   s t r i n g   O r d e r s S c o p e   =   " g r o u p " ;  
 	 s t a t i c   s t r i n g   O r d e r s G r o u p ;   O r d e r s G r o u p   =   c : : g r o u p ;  
 	 s t a t i c   s t r i n g   S y m b o l S c o p e   =   " a l l " ;  
 	 s t a t i c   s t r i n g   S Y M B O L ;   S Y M B O L   =   C u r r e n t S y m b o l ( ) ;  
 	 s t a t i c   s t r i n g   B u y s O r S e l l s   =   " b o t h " ;  
 	  
 	  
 	 b o o l   e x i s t = f a l s e ;  
 	 f o r   ( i n t   p o s = P o s i t i o n s T o t a l ( ) - 1 ;   p o s > = 0 ;   p o s - - )   {  
 	       i f   ( L o a d O r d e r ( P o s i t i o n G e t S y m b o l ( p o s ) ) )   {  
 	             i f   ( F i l t e r O r d e r B y ( O r d e r s S c o p e , O r d e r s G r o u p ,   S y m b o l S c o p e , S Y M B O L ,   B u y s O r S e l l s ) )   {  
 	                   e x i s t = t r u e ;   b r e a k ;  
 	             }  
 	       }  
 	 }  
 	  
 	 i f   ( e x i s t = = f a l s e )   { 	 b l o c k 4 ( 0 ) ;  
 	   	 b l o c k 5 ( 0 ) ;  
 	   	 b l o c k 6 ( 0 ) ;  
 	 }   e l s e   { / *   Y e l l o w   O u t p u t   * / }  
 }  
  
 / /   B l o c k   7  
 v o i d   b l o c k 1 ( i n t   _ p a r e n t _ = 0 )  
 {  
 	 i f   ( d i s a b l e d [ 1 ]   | |   F X D _ B R E A K )   { r e t u r n ; }  
 	 F X D _ C U R R E N T _ F U N C T I O N _ I D = 1 ;  
 	  
 	 s t a t i c   s t r i n g   G r o u p M o d e   =   " g r o u p " ;  
 	 s t a t i c   s t r i n g   G r o u p ;   G r o u p   =   c : : g r o u p ;  
 	 s t a t i c   s t r i n g   M a r k e t M o d e   =   " a l l " ;  
 	 s t a t i c   s t r i n g   M a r k e t ;   M a r k e t   =   C u r r e n t S y m b o l ( ) ;  
 	 s t a t i c   s t r i n g   B u y s O r S e l l s   =   " b o t h " ;  
 	 s t a t i c   s t r i n g   P r o f i t M o d e   =   " m o n e y " ;  
 	 d o u b l e   P r o f i t A m o u n t   =   c : : p r o f i t _ l e v e l ;  
 	 d o u b l e   P r o f i t A m o u n t P i p s   =   1 0 ;  
 	  
 	  
 	 d o u b l e   a v g _ p r i c e = 0 ;  
 	 d o u b l e   a v g _ l o a d = 0 ;  
 	 d o u b l e   a v g _ l o t s = 0 ;   / /   A v e r a g e   s u m   o f   l o t s   -   i t   c a n   b e   n e g a t i v e  
 	 d o u b l e   p r o f i t _ m o n e y = 0 ;  
 	 d o u b l e   p r o f i t _ p i p s = 0 ;  
 	 d o u b l e   p i p s _ s u m = 0 ;  
 	 i n t   t r a d e s _ c o u n t = 0 ;  
 	  
 	 f o r   ( i n t   p o s = P o s i t i o n s T o t a l ( ) - 1 ;   p o s > = 0 ;   p o s - - )   {  
 	       i f   ( L o a d O r d e r ( P o s i t i o n G e t S y m b o l ( p o s ) ) )   {  
 	             i f   ( F i l t e r O r d e r B y ( G r o u p M o d e , G r o u p ,   M a r k e t M o d e , M a r k e t ,   B u y s O r S e l l s ) )   {                    
 	                   p r o f i t _ m o n e y = p r o f i t _ m o n e y + a t t r P r o f i t ( ) + a t t r S w a p ( ) + a t t r C o m m i s s i o n ( ) ;  
 	                   i f   ( I s O r d e r T y p e B u y ( ) = = t r u e )   {  
 	                         p i p s _ s u m = p i p s _ s u m + t o P i p s ( a t t r C l o s e P r i c e ( ) - a t t r O p e n P r i c e ( ) ) ;  
 	                         a v g _ l o a d = a v g _ l o a d + ( a t t r O p e n P r i c e ( ) * a t t r L o t s ( ) ) ;  
 	                         a v g _ l o t s = a v g _ l o t s + a t t r L o t s ( ) ;  
 	                   }   e l s e   {  
 	                         p i p s _ s u m = p i p s _ s u m + t o P i p s ( a t t r O p e n P r i c e ( ) - a t t r C l o s e P r i c e ( ) ) ;  
 	                         a v g _ l o a d = a v g _ l o a d - ( a t t r O p e n P r i c e ( ) * a t t r L o t s ( ) ) ;  
 	                         a v g _ l o t s = a v g _ l o t s - a t t r L o t s ( ) ;  
 	                   }  
 	                   t r a d e s _ c o u n t + + ;  
 	             }      
 	       }  
 	 }  
 	  
 	 i f   ( P r o f i t M o d e = = " m o n e y "   | |   P r o f i t M o d e = = " p i p s " )   {  
 	       a v g _ p r i c e = 0 ;  
 	       i f   ( a v g _ l o t s ! = 0 )   { a v g _ p r i c e = ( a v g _ l o a d / a v g _ l o t s ) ; }  
 	       i f   ( a v g _ p r i c e ! = 0 )   {  
 	             i f   ( a v g _ l o t s > 0 )   { p r o f i t _ p i p s = b i d ( ) - a v g _ p r i c e ; }  
 	             e l s e   { p r o f i t _ p i p s = a v g _ p r i c e - a s k ( ) ; }  
 	             p r o f i t _ p i p s = t o P i p s ( p r o f i t _ p i p s , S y m b o l ( ) ) ;  
 	       }  
 	 }  
 	  
 	 i f   (  
 	       ( P r o f i t M o d e = = " m o n e y "   & &   ( p r o f i t _ m o n e y > P r o f i t A m o u n t ) )  
 	       | |  
 	       ( P r o f i t M o d e = = " p i p s "   & &   ( p r o f i t _ p i p s > P r o f i t A m o u n t P i p s ) )  
 	       | |  
 	       ( P r o f i t M o d e = = " p i p s - s u m "   & &   ( p i p s _ s u m > P r o f i t A m o u n t P i p s ) )  
 	       )   { 	 b l o c k 2 ( 1 ) ;  
 	 }   e l s e   { / *   Y e l l o w   O u t p u t   * / }  
 }  
  
 / /   B l o c k   8  
 v o i d   b l o c k 2 ( i n t   _ p a r e n t _ = 0 )  
 {  
 	 i f   ( d i s a b l e d [ 2 ]   | |   F X D _ B R E A K )   { r e t u r n ; }  
 	 F X D _ C U R R E N T _ F U N C T I O N _ I D = 2 ;  
 	  
 	 s t a t i c   s t r i n g   O r d e r s S c o p e   =   " g r o u p " ;  
 	 s t a t i c   s t r i n g   O r d e r s G r o u p ;   O r d e r s G r o u p   =   c : : g r o u p ;  
 	 s t a t i c   s t r i n g   S y m b o l S c o p e   =   " a l l " ;  
 	 s t a t i c   s t r i n g   S Y M B O L ;   S Y M B O L   =   C u r r e n t S y m b o l ( ) ;  
 	 s t a t i c   s t r i n g   B u y s O r S e l l s   =   " b o t h " ;  
 	 i n t   O r d e r M i n u t e s   =   0 ;  
 	 s t a t i c   s t r i n g   M e a s u r e M o d e   =   " m o n e y " ;  
 	 d o u b l e   P i p s A m o u n t   =   0 ;  
 	 d o u b l e   M o n e y A m o u n t   =   0 ;  
 	 d o u b l e   D e v i a t i o n   =   4 ;  
 	 c o l o r   A r r o w C o l o r   =   c l r D e e p P i n k ;  
 	  
 	  
 	 i n t   c l o s e d _ c o u n t = 0 ;  
 	 b o o l   f i n i s h e d = f a l s e ;  
 	 w h i l e   ( f i n i s h e d = = f a l s e )   {  
 	       i n t   c o u n t = 0 ;  
 	       f o r   ( i n t   p o s = P o s i t i o n s T o t a l ( ) - 1 ;   p o s > = 0 ;   p o s - - )   {  
 	             i f   ( L o a d P o s i t i o n ( P o s i t i o n G e t T i c k e t ( p o s ) ) )   {  
 	                   i f   ( F i l t e r O r d e r B y ( O r d e r s S c o p e , O r d e r s G r o u p ,   S y m b o l S c o p e , S Y M B O L ,   B u y s O r S e l l s ) )   {  
 	                         d a t e t i m e   t i m e _ d i f f   =   T i m e C u r r e n t ( ) - a t t r O p e n T i m e ( ) ;  
 	                         i f   ( t i m e _ d i f f   <   0 )   { t i m e _ d i f f   =   0 ; }   / /   t h i s   a c t u a l l y   h a p p e n s   s o m e t i m e s  
 	                         i f   ( t i m e _ d i f f   > =   6 0 * O r d e r M i n u t e s )  
 	                         {  
 	                               S e t S y m b o l ( S Y M B O L ) ;  
 	                               i f   (  
 	                                     ( M e a s u r e M o d e = = " m o n e y "   & &   ( a t t r P r o f i t ( ) + a t t r C o m m i s s i o n ( ) + a t t r S w a p ( ) ) > M o n e y A m o u n t )  
 	                                     | |  
 	                                     ( M e a s u r e M o d e = = " p i p s "   & &   ( ( I s O r d e r T y p e B u y ( )   & &   S y m b o l B i d ( ) - a t t r O p e n P r i c e ( ) > t o D i g i t s ( P i p s A m o u n t ) )   | |   ( I s O r d e r T y p e S e l l ( )   & &   O r d e r O p e n P r i c e ( ) - S y m b o l A s k ( ) > t o D i g i t s ( P i p s A m o u n t ) ) ) )  
 	                                     )  
 	                               {  
 	                                     i f   ( C l o s e T r a d e ( a t t r T i c k e t ( ) , D e v i a t i o n ) )   { c l o s e d _ c o u n t + + ; }  
 	                                     c o u n t + + ;  
 	       }     }     }     }     }  
 	       i f   ( c o u n t = = 0 )   { f i n i s h e d = t r u e ; }  
 	 }  
 	  
 	 	 b l o c k 3 ( 2 ) ;  
 	  
 }  
  
 / /   B l o c k   9  
 v o i d   b l o c k 3 ( i n t   _ p a r e n t _ = 0 )  
 {  
 	 i f   ( d i s a b l e d [ 3 ]   | |   F X D _ B R E A K )   { r e t u r n ; }  
 	 F X D _ C U R R E N T _ F U N C T I O N _ I D = 3 ;  
 	  
 	 s t a t i c   s t r i n g   O r d e r s S c o p e   =   " g r o u p " ;  
 	 s t a t i c   s t r i n g   O r d e r s G r o u p ;   O r d e r s G r o u p   =   c : : g r o u p ;  
 	 s t a t i c   s t r i n g   S y m b o l S c o p e   =   " a l l " ;  
 	 s t a t i c   s t r i n g   S Y M B O L ;   S Y M B O L   =   C u r r e n t S y m b o l ( ) ;  
 	 s t a t i c   s t r i n g   B u y s O r S e l l s   =   " b o t h " ;  
 	 i n t   O r d e r M i n u t e s   =   0 ;  
 	 d o u b l e   D e v i a t i o n   =   4 ;  
 	  
 	  
 	 i n t   c l o s e d _ c o u n t = 0 ;  
 	 b o o l   f i n i s h e d   =   f a l s e ;  
 	  
 	 w h i l e   ( f i n i s h e d = = f a l s e )  
 	 {  
 	       i n t   c o u n t = 0 ;  
 	       i n t   t o t a l = P o s i t i o n s T o t a l ( ) ;  
 	 	  
 	       f o r   ( i n t   p o s = t o t a l - 1 ;   p o s > = 0 ;   p o s - - )  
 	 	 {  
 	             i f   ( L o a d P o s i t i o n ( P o s i t i o n G e t T i c k e t ( p o s ) ) )  
 	 	 	 {  
 	                   i f   ( F i l t e r O r d e r B y ( O r d e r s S c o p e , O r d e r s G r o u p ,   S y m b o l S c o p e , S Y M B O L ,   B u y s O r S e l l s ) )  
 	 	 	 	 {  
 	                         d a t e t i m e   t i m e _ d i f f   =   T i m e C u r r e n t ( ) - a t t r O p e n T i m e ( ) ;  
 	 	 	 	 	  
 	                         i f   ( t i m e _ d i f f   <   0 )   { t i m e _ d i f f   =   0 ; }   / /   t h i s   a c t u a l l y   h a p p e n s   s o m e t i m e s  
 	 	 	 	 	  
 	                         i f   ( t i m e _ d i f f   > =   6 0 * O r d e r M i n u t e s )  
 	                         {  
 	                               / / i n t   s u c c e s s   =   C l o s e O r d e r ( a t t r S y m b o l ( ) , D e v i a t i o n ) ;  
 	 	 	 	 	 	  
 	                               i f   ( C l o s e T r a d e ( a t t r T i c k e t ( ) ,   D e v i a t i o n ) )   {  
 	                                     c l o s e d _ c o u n t + + ;  
 	                               }  
 	                               e l s e   { P r i n t ( " P o s i t i o n   c l o s e   p r o b l e m   : ( " ) ; }  
 	                               c o u n t + + ;  
 	                         }  
 	                   }  
 	             }  
 	       }  
 	 	  
 	       i f   ( c o u n t   = =   0 )   { f i n i s h e d   =   t r u e ; }  
 	 }  
 	  
 	 / *   O r a n g e   O u t p u t   * /  
 }  
  
 / /   B l o c k   1 0  
 v o i d   b l o c k 4 ( i n t   _ p a r e n t _ = 0 )  
 {  
 	 i f   ( d i s a b l e d [ 4 ]   | |   F X D _ B R E A K )   { r e t u r n ; }  
 	 F X D _ C U R R E N T _ F U N C T I O N _ I D = 4 ;  
 	  
 	 s t a t i c   s t r i n g   O r d e r s G r o u p ;   O r d e r s G r o u p   =   c : : g r o u p ;  
 	 s t a t i c   s t r i n g   S Y M B O L ;   S Y M B O L   =   c : : s y m _ 1 ;  
 	 s t a t i c   s t r i n g   V o l u m e M o d e   =   " f i x e d " ;  
 	 d o u b l e   V o l u m e S i z e   =   _ e x t e r n s : : i n p 4 _ V o l u m e S i z e ;  
 	 d o u b l e   V o l u m e S i z e R i s k   =   5 0 ;  
 	 d o u b l e   V o l u m e R i s k   =   2 . 5 ;  
 	 d o u b l e   V o l u m e P e r c e n t   =   1 0 0 ;  
 	 d o u b l e   V o l u m e B l o c k P e r c e n t   =   3 ;  
 	 d o u b l e   F i x e d R a t i o U n i t S i z e   =   0 . 0 1 ;  
 	 d o u b l e   F i x e d R a t i o D e l t a   =   2 0 ;  
 	 d o u b l e   m m M g I n i t i a l L o t s   =   0 . 1 ;  
 	 d o u b l e   m m M g M u l t i p l y O n L o s s   =   2 ;  
 	 d o u b l e   m m M g M u l t i p l y O n P r o f i t   =   1 ;  
 	 d o u b l e   m m M g A d d L o t s O n L o s s   =   0 ;  
 	 d o u b l e   m m M g A d d L o t s O n P r o f i t   =   0 ;  
 	 i n t   m m M g R e s e t O n L o s s   =   0 ;  
 	 i n t   m m M g R e s e t O n P r o f i t   =   1 ;  
 	 d o u b l e   m m 1 3 2 6 I n i t i a l L o t s   =   0 . 1 ;  
 	 b o o l   m m 1 3 2 6 R e v e r s e   =   f a l s e ;  
 	 d o u b l e   m m F i b o I n i t i a l L o t s   =   0 . 1 ;  
 	 d o u b l e   m m D a l e m b e r t I n i t i a l L o t s   =   0 . 1 ;  
 	 b o o l   m m D a l e m b e r t R e v e r s e   =   f a l s e ;  
 	 d o u b l e   m m L a b o u c h e r e I n i t i a l L o t s   =   0 . 1 ;  
 	 s t a t i c   s t r i n g   m m L a b o u c h e r e L i s t   =   " 1 , 2 , 3 , 4 , 5 , 6 " ;  
 	 b o o l   m m L a b o u c h e r e R e v e r s e   =   f a l s e ;  
 	 d o u b l e   m m S e q B a s e L o t s   =   0 . 1 ;  
 	 s t a t i c   s t r i n g   m m S e q O n L o s s   =   " 3 , 2 , 6 " ;  
 	 s t a t i c   s t r i n g   m m S e q O n P r o f i t ;   m m S e q O n P r o f i t   =   " 1 " ;  
 	 d o u b l e   m m S e q R e v e r s e   =   f a l s e ;  
 	 d o u b l e   V o l u m e U p p e r L i m i t   =   0 ;  
 	 s t a t i c   s t r i n g   S t o p L o s s M o d e   =   " n o n e " ;  
 	 d o u b l e   S t o p L o s s P i p s   =   1 0 0 ;  
 	 d o u b l e   S t o p L o s s P e r c e n t T P   =   1 0 0 ;  
 	 s t a t i c   s t r i n g   T a k e P r o f i t M o d e   =   " n o n e " ;  
 	 d o u b l e   T a k e P r o f i t P i p s   =   1 0 0 ;  
 	 d o u b l e   T a k e P r o f i t P e r c e n t S L   =   1 0 0 ;  
 	 d o u b l e   S l i p p a g e   =   4 ;  
 	 s t a t i c   s t r i n g   M y C o m m e n t   =   " L o n g   p o s i t i o n " ;  
 	  
 	  
 	 S e t S y m b o l ( S Y M B O L ) ;  
 	  
 	 / / - -   s t o p s   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
 	 d o u b l e   s l l = 0 ,   s l p = 0 ,   t p l = 0 ,   t p p = 0 ;  
 	  
 	 i f   ( S t o p L o s s M o d e   = =   " p e r c e n t T P " )   {  
 	       i f   ( t p p   >   0 )   { s l p   =   t p p * S t o p L o s s P e r c e n t T P / 1 0 0 ; }  
 	       i f   ( t p l   >   0 )   { s l p   =   t o P i p s ( M a t h A b s ( S y m b o l A s k ( S Y M B O L )   -   t p l ) ,   S Y M B O L ) * S t o p L o s s P e r c e n t T P / 1 0 0 ; }  
 	 }  
 	 i f   ( T a k e P r o f i t M o d e   = =   " p e r c e n t S L " )   {  
 	       i f   ( s l p   >   0 )   { t p p   =   s l p * T a k e P r o f i t P e r c e n t S L / 1 0 0 ; }  
 	       i f   ( s l l   >   0 )   { t p p   =   t o P i p s ( M a t h A b s ( S y m b o l A s k ( S Y M B O L )   -   s l l ) ,   S Y M B O L ) * T a k e P r o f i t P e r c e n t S L / 1 0 0 ; }  
 	 }  
 	  
 	 / / - -   l o t s   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
 	 d o u b l e   l o t s = 0 ;  
 	 d o u b l e   p r e _ s l l = s l l ;   i f   ( p r e _ s l l = = 0 )   { p r e _ s l l = S y m b o l A s k ( S Y M B O L ) ; }  
 	 d o u b l e   p r e _ s l _ p i p s = t o P i p s ( S y m b o l A s k ( S Y M B O L ) - ( p r e _ s l l - t o D i g i t s ( s l p , S Y M B O L ) ) ) ;  
 	  
 	 l o t s = D y n a m i c L o t s ( V o l u m e M o d e ,   V o l u m e S i z e ) ;  
 	  
 	 l o t s   =   A l i g n L o t s ( l o t s ,   0 ,   V o l u m e U p p e r L i m i t ) ;  
 	  
 	 / / - -   s e n d   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
 	 b o o l   s u c c e s s = B u y N o w ( S Y M B O L ,   l o t s ,   s l l ,   t p l ,   s l p ,   t p p ,   S l i p p a g e ,   ( M a g i c S t a r t + ( i n t ) O r d e r s G r o u p ) ,   M y C o m m e n t ) ;  
 	  
 	 i f   ( s u c c e s s > 0 )   { / *   O r a n g e   O u t p u t   * / }   e l s e   { / *   G r a y   O u t p u t   * / }  
 }  
  
 / /   B l o c k   1 1  
 v o i d   b l o c k 5 ( i n t   _ p a r e n t _ = 0 )  
 {  
 	 i f   ( d i s a b l e d [ 5 ]   | |   F X D _ B R E A K )   { r e t u r n ; }  
 	 F X D _ C U R R E N T _ F U N C T I O N _ I D = 5 ;  
 	  
 	 s t a t i c   s t r i n g   O r d e r s G r o u p ;   O r d e r s G r o u p   =   c : : g r o u p ;  
 	 s t a t i c   s t r i n g   S Y M B O L ;   S Y M B O L   =   c : : s y m _ 2 ;  
 	 s t a t i c   s t r i n g   V o l u m e M o d e   =   " f i x e d " ;  
 	 d o u b l e   V o l u m e S i z e   =   _ e x t e r n s : : i n p 5 _ V o l u m e S i z e ;  
 	 d o u b l e   V o l u m e S i z e R i s k   =   5 0 ;  
 	 d o u b l e   V o l u m e R i s k   =   2 . 5 ;  
 	 d o u b l e   V o l u m e P e r c e n t   =   1 0 0 ;  
 	 d o u b l e   V o l u m e B l o c k P e r c e n t   =   3 ;  
 	 d o u b l e   F i x e d R a t i o U n i t S i z e   =   0 . 0 1 ;  
 	 d o u b l e   F i x e d R a t i o D e l t a   =   2 0 ;  
 	 d o u b l e   m m M g I n i t i a l L o t s   =   0 . 1 ;  
 	 d o u b l e   m m M g M u l t i p l y O n L o s s   =   2 ;  
 	 d o u b l e   m m M g M u l t i p l y O n P r o f i t   =   1 ;  
 	 d o u b l e   m m M g A d d L o t s O n L o s s   =   0 ;  
 	 d o u b l e   m m M g A d d L o t s O n P r o f i t   =   0 ;  
 	 i n t   m m M g R e s e t O n L o s s   =   0 ;  
 	 i n t   m m M g R e s e t O n P r o f i t   =   1 ;  
 	 d o u b l e   m m 1 3 2 6 I n i t i a l L o t s   =   0 . 1 ;  
 	 b o o l   m m 1 3 2 6 R e v e r s e   =   f a l s e ;  
 	 d o u b l e   m m F i b o I n i t i a l L o t s   =   0 . 1 ;  
 	 d o u b l e   m m D a l e m b e r t I n i t i a l L o t s   =   0 . 1 ;  
 	 b o o l   m m D a l e m b e r t R e v e r s e   =   f a l s e ;  
 	 d o u b l e   m m L a b o u c h e r e I n i t i a l L o t s   =   0 . 1 ;  
 	 s t a t i c   s t r i n g   m m L a b o u c h e r e L i s t   =   " 1 , 2 , 3 , 4 , 5 , 6 " ;  
 	 b o o l   m m L a b o u c h e r e R e v e r s e   =   f a l s e ;  
 	 d o u b l e   m m S e q B a s e L o t s   =   0 . 1 ;  
 	 s t a t i c   s t r i n g   m m S e q O n L o s s   =   " 3 , 2 , 6 " ;  
 	 s t a t i c   s t r i n g   m m S e q O n P r o f i t ;   m m S e q O n P r o f i t   =   " 1 " ;  
 	 b o o l   m m S e q R e v e r s e   =   f a l s e ;  
 	 d o u b l e   V o l u m e U p p e r L i m i t   =   0 ;  
 	 s t a t i c   s t r i n g   S t o p L o s s M o d e   =   " n o n e " ;  
 	 d o u b l e   S t o p L o s s P i p s   =   1 0 0 ;  
 	 d o u b l e   S t o p L o s s P e r c e n t T P   =   1 0 0 ;  
 	 s t a t i c   s t r i n g   T a k e P r o f i t M o d e   =   " n o n e " ;  
 	 d o u b l e   T a k e P r o f i t P i p s   =   1 0 0 ;  
 	 d o u b l e   T a k e P r o f i t P e r c e n t S L   =   1 0 0 ;  
 	 d o u b l e   S l i p p a g e   =   4 ;  
 	 s t a t i c   s t r i n g   M y C o m m e n t   =   " S h o r t   p o s i t i o n " ;  
 	  
 	  
 	 S e t S y m b o l ( S Y M B O L ) ;  
 	  
 	 / / - -   s t o p s   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
 	 d o u b l e   s l l = 0 ,   s l p = 0 ,   t p l = 0 ,   t p p = 0 ;  
 	  
 	 i f   ( S t o p L o s s M o d e   = =   " p e r c e n t T P " )   {  
 	       i f   ( t p p   >   0 )   { s l p   =   t p p * S t o p L o s s P e r c e n t T P / 1 0 0 ; }  
 	       i f   ( t p l   >   0 )   { s l p   =   t o P i p s ( M a t h A b s ( S y m b o l A s k ( S Y M B O L )   -   t p l ) ,   S Y M B O L ) * S t o p L o s s P e r c e n t T P / 1 0 0 ; }  
 	 }  
 	 i f   ( T a k e P r o f i t M o d e   = =   " p e r c e n t S L " )   {  
 	       i f   ( s l p   >   0 )   { t p p   =   s l p * T a k e P r o f i t P e r c e n t S L / 1 0 0 ; }  
 	       i f   ( s l l   >   0 )   { t p p   =   t o P i p s ( M a t h A b s ( S y m b o l A s k ( S Y M B O L )   -   s l l ) ,   S Y M B O L ) * T a k e P r o f i t P e r c e n t S L / 1 0 0 ; }  
 	 }  
 	  
 	 / / - -   l o t s   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
 	 d o u b l e   l o t s = 0 ;  
 	 d o u b l e   p r e _ s l l = s l l ;   i f   ( p r e _ s l l = = 0 )   { p r e _ s l l = S y m b o l B i d ( S Y M B O L ) ; }  
 	 d o u b l e   p r e _ s l _ p i p s = t o P i p s ( ( p r e _ s l l + t o D i g i t s ( s l p , S Y M B O L ) ) - S y m b o l B i d ( S Y M B O L ) ) ;  
 	  
 	 l o t s = D y n a m i c L o t s ( V o l u m e M o d e ,   V o l u m e S i z e ) ;  
 	  
 	 l o t s   =   A l i g n L o t s ( l o t s ,   0 ,   V o l u m e U p p e r L i m i t ) ;  
 	  
 	 / / - -   s e n d   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
 	 b o o l   s u c c e s s = S e l l N o w ( S Y M B O L ,   l o t s ,   s l l ,   t p l ,   s l p ,   t p p ,   S l i p p a g e ,   ( M a g i c S t a r t + ( i n t ) O r d e r s G r o u p ) ,   M y C o m m e n t ) ;  
 	  
 	 i f   ( s u c c e s s > 0 )   { / *   O r a n g e   O u t p u t   * / }   e l s e   { / *   G r a y   O u t p u t   * / }  
 }  
  
 / /   B l o c k   1 2  
 v o i d   b l o c k 6 ( i n t   _ p a r e n t _ = 0 )  
 {  
 	 i f   ( d i s a b l e d [ 6 ]   | |   F X D _ B R E A K )   { r e t u r n ; }  
 	 F X D _ C U R R E N T _ F U N C T I O N _ I D = 6 ;  
 	  
 	 s t a t i c   s t r i n g   O r d e r s G r o u p ;   O r d e r s G r o u p   =   c : : g r o u p ;  
 	 s t a t i c   s t r i n g   S Y M B O L ;   S Y M B O L   =   c : : s y m _ 3 ;  
 	 s t a t i c   s t r i n g   V o l u m e M o d e   =   " f i x e d " ;  
 	 d o u b l e   V o l u m e S i z e   =   _ e x t e r n s : : i n p 6 _ V o l u m e S i z e ;  
 	 d o u b l e   V o l u m e S i z e R i s k   =   5 0 ;  
 	 d o u b l e   V o l u m e R i s k   =   2 . 5 ;  
 	 d o u b l e   V o l u m e P e r c e n t   =   1 0 0 ;  
 	 d o u b l e   V o l u m e B l o c k P e r c e n t   =   3 ;  
 	 d o u b l e   F i x e d R a t i o U n i t S i z e   =   0 . 0 1 ;  
 	 d o u b l e   F i x e d R a t i o D e l t a   =   2 0 ;  
 	 d o u b l e   m m M g I n i t i a l L o t s   =   0 . 1 ;  
 	 d o u b l e   m m M g M u l t i p l y O n L o s s   =   2 ;  
 	 d o u b l e   m m M g M u l t i p l y O n P r o f i t   =   1 ;  
 	 d o u b l e   m m M g A d d L o t s O n L o s s   =   0 ;  
 	 d o u b l e   m m M g A d d L o t s O n P r o f i t   =   0 ;  
 	 i n t   m m M g R e s e t O n L o s s   =   0 ;  
 	 i n t   m m M g R e s e t O n P r o f i t   =   1 ;  
 	 d o u b l e   m m 1 3 2 6 I n i t i a l L o t s   =   0 . 1 ;  
 	 b o o l   m m 1 3 2 6 R e v e r s e   =   f a l s e ;  
 	 d o u b l e   m m F i b o I n i t i a l L o t s   =   0 . 1 ;  
 	 d o u b l e   m m D a l e m b e r t I n i t i a l L o t s   =   0 . 1 ;  
 	 b o o l   m m D a l e m b e r t R e v e r s e   =   f a l s e ;  
 	 d o u b l e   m m L a b o u c h e r e I n i t i a l L o t s   =   0 . 1 ;  
 	 s t a t i c   s t r i n g   m m L a b o u c h e r e L i s t   =   " 1 , 2 , 3 , 4 , 5 , 6 " ;  
 	 b o o l   m m L a b o u c h e r e R e v e r s e   =   f a l s e ;  
 	 d o u b l e   m m S e q B a s e L o t s   =   0 . 1 ;  
 	 s t a t i c   s t r i n g   m m S e q O n L o s s   =   " 3 , 2 , 6 " ;  
 	 s t a t i c   s t r i n g   m m S e q O n P r o f i t ;   m m S e q O n P r o f i t   =   " 1 " ;  
 	 b o o l   m m S e q R e v e r s e   =   f a l s e ;  
 	 d o u b l e   V o l u m e U p p e r L i m i t   =   0 ;  
 	 s t a t i c   s t r i n g   S t o p L o s s M o d e   =   " n o n e " ;  
 	 d o u b l e   S t o p L o s s P i p s   =   1 0 0 ;  
 	 d o u b l e   S t o p L o s s P e r c e n t T P   =   1 0 0 ;  
 	 s t a t i c   s t r i n g   T a k e P r o f i t M o d e   =   " n o n e " ;  
 	 d o u b l e   T a k e P r o f i t P i p s   =   1 0 0 ;  
 	 d o u b l e   T a k e P r o f i t P e r c e n t S L   =   1 0 0 ;  
 	 d o u b l e   S l i p p a g e   =   4 ;  
 	 s t a t i c   s t r i n g   M y C o m m e n t   =   " S h o r t   p o s i t i o n " ;  
 	  
 	  
 	 S e t S y m b o l ( S Y M B O L ) ;  
 	  
 	 / / - -   s t o p s   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
 	 d o u b l e   s l l = 0 ,   s l p = 0 ,   t p l = 0 ,   t p p = 0 ;  
 	  
 	 i f   ( S t o p L o s s M o d e   = =   " p e r c e n t T P " )   {  
 	       i f   ( t p p   >   0 )   { s l p   =   t p p * S t o p L o s s P e r c e n t T P / 1 0 0 ; }  
 	       i f   ( t p l   >   0 )   { s l p   =   t o P i p s ( M a t h A b s ( S y m b o l A s k ( S Y M B O L )   -   t p l ) ,   S Y M B O L ) * S t o p L o s s P e r c e n t T P / 1 0 0 ; }  
 	 }  
 	 i f   ( T a k e P r o f i t M o d e   = =   " p e r c e n t S L " )   {  
 	       i f   ( s l p   >   0 )   { t p p   =   s l p * T a k e P r o f i t P e r c e n t S L / 1 0 0 ; }  
 	       i f   ( s l l   >   0 )   { t p p   =   t o P i p s ( M a t h A b s ( S y m b o l A s k ( S Y M B O L )   -   s l l ) ,   S Y M B O L ) * T a k e P r o f i t P e r c e n t S L / 1 0 0 ; }  
 	 }  
 	  
 	 / / - -   l o t s   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
 	 d o u b l e   l o t s = 0 ;  
 	 d o u b l e   p r e _ s l l = s l l ;   i f   ( p r e _ s l l = = 0 )   { p r e _ s l l = S y m b o l B i d ( S Y M B O L ) ; }  
 	 d o u b l e   p r e _ s l _ p i p s = t o P i p s ( ( p r e _ s l l + t o D i g i t s ( s l p , S Y M B O L ) ) - S y m b o l B i d ( S Y M B O L ) ) ;  
 	  
 	 l o t s = D y n a m i c L o t s ( V o l u m e M o d e ,   V o l u m e S i z e ) ;  
 	  
 	 l o t s   =   A l i g n L o t s ( l o t s ,   0 ,   V o l u m e U p p e r L i m i t ) ;  
 	  
 	 / / - -   s e n d   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
 	 b o o l   s u c c e s s = S e l l N o w ( S Y M B O L ,   l o t s ,   s l l ,   t p l ,   s l p ,   t p p ,   S l i p p a g e ,   ( M a g i c S t a r t + ( i n t ) O r d e r s G r o u p ) ,   M y C o m m e n t ) ;  
 	  
 	 i f   ( s u c c e s s > 0 )   { / *   O r a n g e   O u t p u t   * / }   e l s e   { / *   G r a y   O u t p u t   * / }  
 }  
  
 / /   B l o c k   1 4  
 v o i d   b l o c k 7 ( i n t   _ p a r e n t _ = 0 )  
 {  
 	 i f   ( d i s a b l e d [ 7 ]   | |   F X D _ B R E A K )   { r e t u r n ; }  
 	 F X D _ C U R R E N T _ F U N C T I O N _ I D = 7 ;  
 	  
 	 s t a t i c   s t r i n g   S e r v e r O r L o c a l T i m e   =   " s e r v e r " ;  
 	 s t a t i c   s t r i n g   T i m e S t a r t M o d e   =   " t e x t " ;  
 	 s t a t i c   s t r i n g   T i m e S t a r t ;   T i m e S t a r t   =   _ e x t e r n s : : i n p 7 _ T i m e S t a r t ;  
 	 i n t   T i m e S t a r t Y e a r   =   0 ;  
 	 i n t   T i m e S t a r t M o n t h   =   0 ;  
 	 i n t   T i m e S t a r t D a y   =   0 ;  
 	 i n t   T i m e S t a r t H o u r   =   1 ;  
 	 i n t   T i m e S t a r t M i n u t e   =   0 ;  
 	 i n t   T i m e S t a r t S e c o n d   =   0 ;  
 	 s t a t i c   s t r i n g   T i m e E n d M o d e   =   " t e x t " ;  
 	 s t a t i c   s t r i n g   T i m e E n d ;   T i m e E n d   =   _ e x t e r n s : : i n p 7 _ T i m e E n d ;  
 	 i n t   T i m e E n d Y e a r   =   0 ;  
 	 i n t   T i m e E n d M o n t h   =   0 ;  
 	 i n t   T i m e E n d D a y   =   0 ;  
 	 i n t   T i m e E n d H o u r   =   1 ;  
 	 i n t   T i m e E n d M i n u t e   =   1 ;  
 	 i n t   T i m e E n d S e c o n d   =   0 ;  
 	 i n t   T i m e E n d R e l Y e a r s   =   0 ;  
 	 i n t   T i m e E n d R e l M o n t h s   =   0 ;  
 	 i n t   T i m e E n d R e l D a y s   =   0 ;  
 	 i n t   T i m e E n d R e l H o u r s   =   0 ;  
 	 i n t   T i m e E n d R e l M i n u t e s   =   1 ;  
 	 i n t   T i m e E n d R e l S e c o n d s   =   0 ;  
 	  
 	  
 	 d a t e t i m e   t 0 = 0 ;  
 	 d a t e t i m e   t 1 = 0 ;  
 	 d a t e t i m e   t x = 0 ;  
 	 d a t e t i m e   n o w = 0 ;  
 	 i n t   m o d e _ t i m e   =   0 ;  
 	  
 	 m o d e _ t i m e   =   0 ;   n o w = T i m e C u r r e n t ( ) ;  
 	  
 	 / / - -   s t a r t   t i m e  
 	  
 	  
 	 	 t 0 = T i m e F r o m S t r i n g ( m o d e _ t i m e ,   T i m e S t a r t ) ;  
 	  
 	 / / - -   e n d   t i m e  
 	  
 	  
 	 	 t 1 = T i m e F r o m S t r i n g ( m o d e _ t i m e ,   T i m e E n d ) ;  
 	  
 	 i f   ( T i m e E n d M o d e = = " r e l a t i v e " )  
 	 {  
 	 	 M q l D a t e T i m e   t m ;  
 	 	 T i m e T o S t r u c t ( t 0 ,   t m ) ;  
 	 	  
 	 	 t m . y e a r     + =   T i m e E n d R e l Y e a r s ;  
 	 	 t m . m o n 	 + =   T i m e E n d R e l M o n t h s ;  
 	 	 t m . d a y 	 + =   T i m e E n d R e l D a y s ;  
 	 	 t m . h o u r     + =   T i m e E n d R e l H o u r s ;  
 	 	 t m . m i n 	 + =   T i m e E n d R e l M i n u t e s ;  
 	 	 t m . s e c 	 + =   T i m e E n d R e l S e c o n d s ;  
 	 	  
 	 	 t 1   =   S t r u c t T o T i m e ( t m ) ;  
 	 	  
 	 	 i f   ( t 1   <   t 0 )   { t 1   =   t 1 + 8 6 4 0 0 ; }  
 	 }  
 	  
 	 i f   ( ( n o w > = t 0   & &   n o w < t 1 )   | |   ( t 0 > t 1   & &   ( n o w > = t 0   | |   n o w < t 1 ) ) )   { 	 b l o c k 0 ( 7 ) ;  
 	 }   e l s e   { / *   Y e l l o w   O u t p u t   * / }  
 }  
  
 d o u b l e   i c _ v a l u e _ v a l u e ( d o u b l e   V a l u e )  
 {  
 	 r e t u r n ( V a l u e ) ;  
 }  
  
 / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /  
 / /   + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +   / /  
 / /   |                                                                                                       F U N C T I O N S                                                                                                             |   / /  
 / /   |                                                                   S y s t e m   a n d   C u s t o m   f u n c t i o n s   u s e d   i n   t h e   p r o g r a m                                                                     |   / /  
 / /   + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +   / /  
 / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /  
  
 d o u b l e   A c c o u n t B a l a n c e ( )   { r e t u r n ( A c c o u n t I n f o D o u b l e ( A C C O U N T _ B A L A N C E ) ) ; }  
  
 d o u b l e   A c c o u n t B a l a n c e A t S t a r t ( )  
 {  
       / /   T h i s   f u n c t i o n   M U S T   b e   r u n   o n c e   a t   p o g r a m ' s   s t a r t  
       s t a t i c   d o u b l e   m e m o r y = 0 ;  
       i f   ( m e m o r y = = 0 )   { m e m o r y = A c c o u n t I n f o D o u b l e ( A C C O U N T _ B A L A N C E ) ; }  
       r e t u r n ( m e m o r y ) ;  
 }  
  
 d o u b l e   A c c o u n t E q u i t y ( )   { r e t u r n ( A c c o u n t I n f o D o u b l e ( A C C O U N T _ E Q U I T Y ) ) ; }  
  
 d o u b l e   A c c o u n t F r e e M a r g i n ( )   { r e t u r n ( A c c o u n t I n f o D o u b l e ( A C C O U N T _ F R E E M A R G I N ) ) ; }  
  
 d o u b l e   A l i g n L o t s ( d o u b l e   l o t s ,   d o u b l e   l o w e r l o t s = 0 ,   d o u b l e   u p p e r l o t s = 0 ) 
 { 
       s t r i n g   s y m b o l = G e t S y m b o l ( ) ; 
 
       d o u b l e   L o t S t e p = S y m b o l L o t S t e p ( s y m b o l ) ; 
       d o u b l e   L o t S i z e = S y m b o l L o t S i z e ( s y m b o l ) ; 
       d o u b l e   M i n L o t s = S y m b o l M i n L o t ( s y m b o l ) ; 
       d o u b l e   M a x L o t s = S y m b o l M a x L o t ( s y m b o l ) ; 
       
 	 i f   ( l o t s = = E M P T Y _ V A L U E )   { l o t s = 0 ; } 
 	 
       l o t s = M a t h R o u n d ( l o t s / L o t S t e p ) * L o t S t e p ; 
       
       i f   ( l o t s < M i n L o t s )   { l o t s = M i n L o t s ; } 
       i f   ( l o t s > M a x L o t s )   { l o t s = M a x L o t s ; } 
       
       i f   ( l o w e r l o t s   >   0 ) 
       { 
             l o w e r l o t s   =   M a t h R o u n d ( l o w e r l o t s / L o t S t e p ) * L o t S t e p ; 
             i f   ( l o t s   <   l o w e r l o t s )   { l o t s   =   l o w e r l o t s ; } 
       } 
       i f   ( u p p e r l o t s   >   0 ) 
       { 
             u p p e r l o t s   =   M a t h R o u n d ( u p p e r l o t s / L o t S t e p ) * L o t S t e p ; 
             i f   ( l o t s   >   u p p e r l o t s )   { l o t s   =   u p p e r l o t s ; } 
       } 
 
       r e t u r n   ( l o t s ) ; 
 }  
  
 d o u b l e   A l i g n S t o p L o s s ( 
       s t r i n g   s y m b o l , 
       i n t   t y p e , 
       d o u b l e   p r i c e , 
       d o u b l e   s l o = 0 ,   / /   o r i g i n a l   s l ,   u s e d   w h e n   m o d i f y i n g 
       d o u b l e   s l l = 0 , 
       d o u b l e   s l p = 0 , 
       b o o l   c o n s i d e r _ f r e e z e l e v e l = f a l s e 
       ) 
 { 
       d o u b l e   s l = 0 ; 
       
       i f   ( M a t h A b s ( s l l ) = = E M P T Y _ V A L U E )   { s l l = 0 ; } 
       i f   ( M a t h A b s ( s l p ) = = E M P T Y _ V A L U E )   { s l p = 0 ; } 
       i f   ( s l l = = 0   & &   s l p = = 0 )   { r e t u r n ( 0 ) ; }   / /   n o   s l   -   r e t u r n   0 
       i f   ( p r i c e < = 0 )   { P r i n t ( " A l i g n S t o p L o s s ( )   e r r o r :   N o   p r i c e   e n t e r e d " ) ; r e t u r n ( - 1 ) ; } 
       
       d o u b l e   p o i n t       = S y m b o l I n f o D o u b l e ( s y m b o l , S Y M B O L _ P O I N T ) ; 
       i n t   d i g i t s           = ( i n t ) S y m b o l I n f o I n t e g e r ( s y m b o l , S Y M B O L _ D I G I T S ) ; 
       s l p = s l p * P i p V a l u e ( s y m b o l ) * p o i n t ; 
 
       / / - -   b u y - s e l l   i d e n t i f i e r   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
       i n t   b s = 1 ; 
       i f   ( 
             t y p e = = O R D E R _ T Y P E _ B U Y 
             | |   t y p e = = O R D E R _ T Y P E _ B U Y _ S T O P 
             | |   t y p e = = O R D E R _ T Y P E _ B U Y _ L I M I T 
             | |   t y p e = = O R D E R _ T Y P E _ B U Y _ S T O P _ L I M I T 
             ) 
       { 
             b s = 1 ; 
       } 
       e l s e   i f   ( 
             t y p e = = O R D E R _ T Y P E _ S E L L 
             | |   t y p e = = O R D E R _ T Y P E _ S E L L _ S T O P 
             | |   t y p e = = O R D E R _ T Y P E _ S E L L _ L I M I T 
             | |   t y p e = = O R D E R _ T Y P E _ S E L L _ S T O P _ L I M I T 
             ) 
       { 
             b s = - 1 ; 
       } 
       
       / / - -   p r i c e s   t h a t   w i l l   b e   u s e d   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
       d o u b l e   a s k b i d = p r i c e ; 
       d o u b l e   b i d a s k = p r i c e ; 
       
       i f   ( t y p e = = O R D E R _ T Y P E _ B U Y   | |   t y p e = = O R D E R _ T Y P E _ S E L L ) 
       { 
             d o u b l e   a s k   = S y m b o l I n f o D o u b l e ( s y m b o l , S Y M B O L _ A S K ) ; 
             d o u b l e   b i d   = S y m b o l I n f o D o u b l e ( s y m b o l , S Y M B O L _ B I D ) ; 
             
             a s k b i d = a s k ; 
             b i d a s k = b i d ; 
             i f   ( b s < 0 )   { 
                 a s k b i d = b i d ; 
                 b i d a s k = a s k ; 
             } 
       } 
       
       / / - -   b u i l d   s l   l e v e l   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   
       i f   ( s l l = = 0   & &   s l p ! = 0 )   { s l l = p r i c e ; } 
       
       i f   ( s l l > 0 )   { s l = s l l - s l p * b s ; } 
       
       i f   ( s l < 0 )   { r e t u r n ( - 1 ) ; } 
             
       s l = N o r m a l i z e D o u b l e ( s l , d i g i t s ) ; 
       s l o   =   N o r m a l i z e D o u b l e ( s l o , d i g i t s ) ; 
       i f   ( s l   = =   s l o )   { r e t u r n   s l ; } 
       
       / / - -   b u i l d   l i m i t   l e v e l s   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
       d o u b l e   m i n s t o p s = ( d o u b l e ) S y m b o l I n f o I n t e g e r ( s y m b o l , S Y M B O L _ T R A D E _ S T O P S _ L E V E L ) ; 
       i f   ( c o n s i d e r _ f r e e z e l e v e l = = t r u e )   { 
             d o u b l e   f r e e z e l e v e l = ( d o u b l e ) S y m b o l I n f o I n t e g e r ( s y m b o l , S Y M B O L _ T R A D E _ F R E E Z E _ L E V E L ) ; 
             i f   ( f r e e z e l e v e l > m i n s t o p s )   { m i n s t o p s = f r e e z e l e v e l ; } 
       } 
       m i n s t o p s = N o r m a l i z e D o u b l e ( m i n s t o p s * p o i n t , d i g i t s ) ; 
             
       d o u b l e   s l l i m i t = b i d a s k - m i n s t o p s * b s ;   / /   S L   m i n   p r i c e   l e v e l 
       
       / / - -   c h e c k   a n d   a l i g n   s l ,   p r i n t   e r r o r s   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
       / / - -   d o   n o t   d o   i t   w h e n   t h e   s t o p   i s   t h e   s a m e   a s   t h e   o r i g i n a l 
       i f   ( s l > 0 )   { 
             / * i f   ( s l = = a s k b i d ) 
             { 
                   s l = 0 ; 
             } 
             e l s e   * / 
             i f   ( ( b s > 0   & &   s l > a s k b i d )   | |   ( b s < 0   & &   s l < a s k b i d ) ) 
             { 
                   s t r i n g   a b s t r = " " ; 
                   i f   ( b s > 0 )   { a b s t r = " B i d " ; }   e l s e   { a b s t r = " A s k " ; } 
                   P r i n t ( 
                         " E r r o r :   I n v a l i d   S L   r e q u e s t e d   ( " , 
                         D o u b l e T o S t r ( s l , d i g i t s ) , 
                         "   f o r   " , a b s t r , "   p r i c e   " , 
                         b i d a s k , 
                         " ) " 
                         ) ; 
                   r e t u r n ( - 1 ) ; 
             } 
             e l s e   i f   ( ( b s > 0   & &   s l > s l l i m i t )   | |   ( b s < 0   & &   s l < s l l i m i t ) ) 
             { 
                   P r i n t ( 
                         " W a r n i n g :   T o o   s h o r t   S L   r e q u e s t e d   ( " , 
                         D o u b l e T o S t r ( s l , d i g i t s ) , 
                         "   o r   " , 
                         D o u b l e T o S t r ( M a t h A b s ( s l - a s k b i d ) / p o i n t , 0 ) , 
                         "   p o i n t s ) ,   m i n i m u m   w i l l   b e   t a k e n   ( " , 
                         D o u b l e T o S t r ( s l l i m i t , d i g i t s ) , 
                         "   o r   " , 
                         D o u b l e T o S t r ( M a t h A b s ( a s k b i d - s l l i m i t ) / p o i n t , 0 ) , 
                         "   p o i n t s ) " 
                   ) ; 
                   s l = s l l i m i t ; 
                   r e t u r n ( s l ) ; 
             } 
       } 
       
       / /   a l i g n   b y   t h e   t i c k s i z e 
       d o u b l e   t i c k s i z e   =   S y m b o l I n f o D o u b l e ( s y m b o l ,   S Y M B O L _ T R A D E _ T I C K _ S I Z E ) ; 
       s l   =   M a t h R o u n d ( s l / t i c k s i z e ) * t i c k s i z e ; 
       
       r e t u r n ( s l ) ; 
 }  
  
 d o u b l e   A l i g n T a k e P r o f i t ( 
       s t r i n g   s y m b o l , 
       i n t   t y p e , 
       d o u b l e   p r i c e , 
       d o u b l e   t p o = 0 ,   / /   o r i g i n a l   t p ,   u s e d   w h e n   m o d i f y i n g 
       d o u b l e   t p l = 0 , 
       d o u b l e   t p p = 0 , 
       b o o l   c o n s i d e r _ f r e e z e l e v e l = f a l s e 
       ) 
 { 
       d o u b l e   t p = 0 ; 
       
       i f   ( M a t h A b s ( t p l ) = = E M P T Y _ V A L U E )   { t p l = 0 ; } 
       i f   ( M a t h A b s ( t p p ) = = E M P T Y _ V A L U E )   { t p p = 0 ; } 
       i f   ( t p l = = 0   & &   t p p = = 0 )   { r e t u r n ( 0 ) ; }   / /   n o   t p   -   r e t u r n   0 
       i f   ( p r i c e < = 0 )   { P r i n t ( " A l i g n T a k e P r o f i t ( )   e r r o r :   N o   p r i c e   e n t e r e d " ) ; r e t u r n ( - 1 ) ; } 
 
       d o u b l e   p o i n t       = S y m b o l I n f o D o u b l e ( s y m b o l , S Y M B O L _ P O I N T ) ; 
       i n t   d i g i t s           = ( i n t ) S y m b o l I n f o I n t e g e r ( s y m b o l , S Y M B O L _ D I G I T S ) ; 
       t p p = t p p * P i p V a l u e ( s y m b o l ) * p o i n t ; 
       
       / / - -   b u y - s e l l   i d e n t i f i e r   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
       i n t   b s = 1 ; 
       i f   ( 
             t y p e = = O R D E R _ T Y P E _ B U Y 
             | |   t y p e = = O R D E R _ T Y P E _ B U Y _ S T O P 
             | |   t y p e = = O R D E R _ T Y P E _ B U Y _ L I M I T 
             | |   t y p e = = O R D E R _ T Y P E _ B U Y _ S T O P _ L I M I T 
             ) 
       { 
             b s = 1 ; 
       } 
       e l s e   i f   ( 
             t y p e = = O R D E R _ T Y P E _ S E L L 
             | |   t y p e = = O R D E R _ T Y P E _ S E L L _ S T O P 
             | |   t y p e = = O R D E R _ T Y P E _ S E L L _ L I M I T 
             | |   t y p e = = O R D E R _ T Y P E _ S E L L _ S T O P _ L I M I T 
             ) 
       { 
             b s = - 1 ; 
       } 
       
       / / - -   p r i c e s   t h a t   w i l l   b e   u s e d   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
       d o u b l e   a s k b i d = p r i c e ; 
       d o u b l e   b i d a s k = p r i c e ; 
       
       i f   ( t y p e = = O R D E R _ T Y P E _ B U Y   | |   t y p e = = O R D E R _ T Y P E _ S E L L ) 
       { 
             d o u b l e   a s k   = S y m b o l I n f o D o u b l e ( s y m b o l , S Y M B O L _ A S K ) ; 
             d o u b l e   b i d   = S y m b o l I n f o D o u b l e ( s y m b o l , S Y M B O L _ B I D ) ; 
             
             a s k b i d = a s k ; 
             b i d a s k = b i d ; 
             i f   ( b s < 0 )   { 
                 a s k b i d = b i d ; 
                 b i d a s k = a s k ; 
             } 
       } 
       
       / / - -   b u i l d   t p   l e v e l   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   
       i f   ( t p l = = 0   & &   t p p ! = 0 )   { t p l = p r i c e ; } 
 
       i f   ( t p l > 0 )   { t p = t p l + t p p * b s ; } 
       
       i f   ( t p < 0 )   { r e t u r n ( - 1 ) ; } 
 
       t p = N o r m a l i z e D o u b l e ( t p , d i g i t s ) ; 
       t p o   =   N o r m a l i z e D o u b l e ( t p o , d i g i t s ) ; 
       i f   ( t p   = =   t p o )   { r e t u r n   t p ; } 
       
       / / - -   b u i l d   l i m i t   l e v e l s   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
       d o u b l e   m i n s t o p s = ( d o u b l e ) S y m b o l I n f o I n t e g e r ( s y m b o l , S Y M B O L _ T R A D E _ S T O P S _ L E V E L ) ; 
       i f   ( c o n s i d e r _ f r e e z e l e v e l = = t r u e )   { 
             d o u b l e   f r e e z e l e v e l = ( d o u b l e ) S y m b o l I n f o I n t e g e r ( s y m b o l , S Y M B O L _ T R A D E _ F R E E Z E _ L E V E L ) ; 
             i f   ( f r e e z e l e v e l > m i n s t o p s )   { m i n s t o p s = f r e e z e l e v e l ; } 
       } 
       m i n s t o p s = N o r m a l i z e D o u b l e ( m i n s t o p s * p o i n t , d i g i t s ) ; 
       
       d o u b l e   t p l i m i t = b i d a s k + m i n s t o p s * b s ;   / /   T P   m i n   p r i c e   l e v e l 
       
       / / - -   c h e c k   a n d   a l i g n   t p ,   p r i n t   e r r o r s   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
       / / - -   d o   n o t   d o   i t   w h e n   t h e   s t o p   i s   t h e   s a m e   a s   t h e   o r i g i n a l 
       i f   ( t p > 0   & &   t p   ! =   t p o )   { 
             / * i f   ( t p = = a s k b i d ) 
             { 
                   t p = 0 ; 
             } 
             e l s e   * / 
             i f   ( ( b s > 0   & &   t p < b i d a s k )   | |   ( b s < 0   & &   t p > b i d a s k ) ) 
             { 
                   s t r i n g   a b s t r = " " ; 
                   i f   ( b s > 0 )   { a b s t r = " B i d " ; }   e l s e   { a b s t r = " A s k " ; } 
                   P r i n t ( 
                         " E r r o r :   I n v a l i d   T P   r e q u e s t e d   ( " , 
                         D o u b l e T o S t r ( t p , d i g i t s ) , 
                         "   f o r   " , a b s t r , "   p r i c e   " , 
                         b i d a s k , 
                         " ) " 
                         ) ; 
                   r e t u r n ( - 1 ) ; 
             } 
             e l s e   i f   ( ( b s > 0   & &   t p < t p l i m i t )   | |   ( b s < 0   & &   t p > t p l i m i t ) ) 
             { 
                   P r i n t ( 
                         " W a r n i n g :   T o o   s h o r t   T P   r e q u e s t e d   ( " , 
                         D o u b l e T o S t r ( t p , d i g i t s ) , 
                         "   o r   " , 
                         D o u b l e T o S t r ( M a t h A b s ( t p - a s k b i d ) / p o i n t , 0 ) , 
                         "   p o i n t s ) ,   m i n i m u m   w i l l   b e   t a k e n   ( " , 
                         D o u b l e T o S t r ( t p l i m i t , d i g i t s ) , 
                         "   o r   " , 
                         D o u b l e T o S t r ( M a t h A b s ( a s k b i d - t p l i m i t ) / p o i n t , 0 ) , 
                         "   p o i n t s ) " 
                   ) ; 
                   t p = t p l i m i t ; 
                   r e t u r n ( t p ) ; 
             } 
       } 
       
       / /   a l i g n   b y   t h e   t i c k s i z e 
       d o u b l e   t i c k s i z e   =   S y m b o l I n f o D o u b l e ( s y m b o l ,   S Y M B O L _ T R A D E _ T I C K _ S I Z E ) ; 
       t p   =   M a t h R o u n d ( t p / t i c k s i z e ) * t i c k s i z e ; 
       
       r e t u r n ( t p ) ; 
 }  
  
 t e m p l a t e < t y p e n a m e   T > 
 i n t   A r r a y S e a r c h ( T   & a r r a y [ ] ,   T   v a l u e ) 
 { 
 	 s t a t i c   i n t   i n d e x ;         
 	 s t a t i c   i n t   s i z e ; 
 	 
 	 i n d e x   =   - 1 ; 
 	 s i z e     =   A r r a y S i z e ( a r r a y ) ; 
 
 	 f o r   ( i n t   i = 0 ;   i < s i z e ;   i + + ) 
 	 { 
 	 	 i f   ( a r r a y [ i ]   = =   v a l u e ) 
 	 	 { 
 	 	 	 i n d e x   =   i ; 
 	 	 	 b r e a k ; 
 	 	 }     
 	 } 
 
       r e t u r n   i n d e x ; 
 }  
  
 t e m p l a t e < t y p e n a m e   T > 
 b o o l   A r r a y S t r i p K e y ( T   & a r r a y [ ] ,   i n t   k e y ) 
 { 
 	 i n t   x         =   0 ; 
 	 i n t   s i z e   =   A r r a y S i z e ( a r r a y ) ; 
 	 
 	 f o r   ( i n t   i = 0 ;   i < s i z e ;   i + + ) 
 	 { 
 	 	 i f   ( i   ! =   k e y ) 
 	 	 { 
 	 	 	 a r r a y [ x ]   =   a r r a y [ i ] ; 
 	 	 	 x + + ; 
 	 	 } 
 	 } 
 	 	 
 	 i f   ( x   <   s i z e ) 
 	 { 
 	 	 A r r a y R e s i z e ( a r r a y ,   x ) ; 
 	 	 
 	 	 r e t u r n   t r u e ;   / /   s t r i p p e d 
 	 } 
 	 
 	 r e t u r n   f a l s e ;   / /   n o t   s t r i p p e d 
 }  
  
 i n t   B u i l d O r d e r s L i s t ( o r d e r   & l i s t [ ] )  
 {  
       i n t   l a s t _ e r r o r = 0 ;  
       i n t   t o t a l = O r d e r s T o t a l ( ) ;  
  
       i n t   t e m p _ v a l u e = ( i n t ) M a t h M a x ( t o t a l , 1 ) ;  
       A r r a y R e s i z e ( l i s t , t e m p _ v a l u e ) ;  
  
       i n t   o r d e r s _ c o u n t = 0 ;  
       f o r ( i n t   i = t o t a l - 1 ;   i > = 0 ;   i - - )  
           {  
             i f ( ! O r d e r G e t T i c k e t ( i ) )  
                 {  
                   l a s t _ e r r o r = G e t L a s t E r r o r ( ) ;  
                   P r i n t ( " B u i l d O r d e r s L i s t ( )   -   E r r o r   # " , l a s t _ e r r o r ) ;  
                   c o n t i n u e ;  
                 }  
             e l s e  
                 {  
                 l i s t [ i ] . t i c k e t                     = O r d e r G e t T i c k e t ( i ) ;  
                 l i s t [ i ] . t i m e _ s e t u p             = ( d a t e t i m e ) O r d e r G e t I n t e g e r ( O R D E R _ T I M E _ S E T U P ) ;  
                 l i s t [ i ] . t i m e _ e x p i r a t i o n   = ( d a t e t i m e ) O r d e r G e t I n t e g e r ( O R D E R _ T I M E _ E X P I R A T I O N ) ;  
                 l i s t [ i ] . t i m e _ d o n e               = ( d a t e t i m e ) O r d e r G e t I n t e g e r ( O R D E R _ T I M E _ D O N E ) ;  
                 l i s t [ i ] . t y p e                         = O r d e r G e t I n t e g e r ( O R D E R _ T Y P E ) ;  
                  
                 l i s t [ i ] . s t a t e                       = O r d e r G e t I n t e g e r ( O R D E R _ S T A T E ) ;  
                 l i s t [ i ] . t y p e _ f i l l i n g         = O r d e r G e t I n t e g e r ( O R D E R _ T Y P E _ F I L L I N G ) ;  
                 l i s t [ i ] . t y p e _ t i m e               = O r d e r G e t I n t e g e r ( O R D E R _ T Y P E _ T I M E ) ;  
                 l i s t [ i ] . m a g i c                       = O r d e r G e t I n t e g e r ( O R D E R _ M A G I C ) ;  
                 l i s t [ i ] . p o s i t i o n _ i d           = O r d e r G e t I n t e g e r ( O R D E R _ P O S I T I O N _ I D ) ;  
                  
                 l i s t [ i ] . v o l u m e _ i n i t i a l     = O r d e r G e t D o u b l e ( O R D E R _ V O L U M E _ I N I T I A L ) ;  
                 l i s t [ i ] . v o l u m e _ c u r r e n t     = O r d e r G e t D o u b l e ( O R D E R _ V O L U M E _ C U R R E N T ) ;  
                 l i s t [ i ] . p r i c e _ o p e n             = O r d e r G e t D o u b l e ( O R D E R _ P R I C E _ O P E N ) ;  
                 l i s t [ i ] . s l                             = O r d e r G e t D o u b l e ( O R D E R _ S L ) ;  
                 l i s t [ i ] . t p                             = O r d e r G e t D o u b l e ( O R D E R _ T P ) ;  
                 l i s t [ i ] . p r i c e _ c u r r e n t       = O r d e r G e t D o u b l e ( O R D E R _ P R I C E _ C U R R E N T ) ;  
                 l i s t [ i ] . p r i c e _ s t o p l i m i t   = O r d e r G e t D o u b l e ( O R D E R _ P R I C E _ S T O P L I M I T ) ;  
                  
                 l i s t [ i ] . s y m b o l                     = O r d e r G e t S t r i n g ( O R D E R _ S Y M B O L ) ;  
                 l i s t [ i ] . c o m m e n t                   = O r d e r G e t S t r i n g ( O R D E R _ C O M M E N T ) ;  
                  
                 o r d e r s _ c o u n t + + ;  
                 }  
           }  
  
       t e m p _ v a l u e = ( i n t ) M a t h M a x ( o r d e r s _ c o u n t , 1 ) ;  
       A r r a y R e s i z e ( l i s t , t e m p _ v a l u e ) ;  
       r e t u r n ( o r d e r s _ c o u n t ) ;  
 }  
  
 i n t   B u i l d P o s i t i o n s L i s t ( p o s i t i o n   & l i s t [ ] )  
 {  
       i n t   l a s t _ e r r o r = 0 ;  
       i n t   t o t a l = P o s i t i o n s T o t a l ( ) ;  
  
       i n t   t e m p _ v a l u e = ( i n t ) M a t h M a x ( t o t a l , 1 ) ;  
       A r r a y R e s i z e ( l i s t ,   t e m p _ v a l u e ) ;  
  
       i n t   p o s i t i o n s _ c o u n t = 0 ;  
       f o r ( i n t   i = t o t a l - 1 ;   i > = 0 ;   i - - )  
           {  
             i f ( ! P o s i t i o n S e l e c t ( P o s i t i o n G e t S y m b o l ( i ) ) )  
                 {  
                   l a s t _ e r r o r = G e t L a s t E r r o r ( ) ;  
                   P r i n t ( " P o s i t i o n S e l e c t ( )   -   E r r o r   # " , l a s t _ e r r o r ) ;  
                   c o n t i n u e ;  
                 }  
             e l s e  
                 {  
                         / /   I f   t h e   p o s i t i o n   i s   f o u n d ,   t h e n   p u t   i t s   i n f o   t o   t h e   a r r a y  
                         l i s t [ i ] . p o s i t i o n _ i d       = P o s i t i o n G e t I n t e g e r ( P O S I T I O N _ I D E N T I F I E R ) ;  
                         l i s t [ i ] . t y p e                     = P o s i t i o n G e t I n t e g e r ( P O S I T I O N _ T Y P E ) ;  
                         l i s t [ i ] . t i m e                     = ( d a t e t i m e ) P o s i t i o n G e t I n t e g e r ( P O S I T I O N _ T I M E ) ;  
                         l i s t [ i ] . m a g i c                   = P o s i t i o n G e t I n t e g e r ( P O S I T I O N _ M A G I C ) ;  
                         l i s t [ i ] . v o l u m e                 = P o s i t i o n G e t D o u b l e ( P O S I T I O N _ V O L U M E ) ;  
                         l i s t [ i ] . p r i c e _ o p e n         = P o s i t i o n G e t D o u b l e ( P O S I T I O N _ P R I C E _ O P E N ) ;  
                         l i s t [ i ] . s l                         = P o s i t i o n G e t D o u b l e ( P O S I T I O N _ S L ) ;  
                         l i s t [ i ] . t p                         = P o s i t i o n G e t D o u b l e ( P O S I T I O N _ T P ) ;  
                         l i s t [ i ] . p r i c e _ c u r r e n t   = P o s i t i o n G e t D o u b l e ( P O S I T I O N _ P R I C E _ C U R R E N T ) ;  
                         l i s t [ i ] . c o m i s s i o n           = P o s i t i o n G e t D o u b l e ( P O S I T I O N _ C O M M I S S I O N ) ;  
                         l i s t [ i ] . s w a p                     = P o s i t i o n G e t D o u b l e ( P O S I T I O N _ S W A P ) ;  
                         l i s t [ i ] . p r o f i t                 = P o s i t i o n G e t D o u b l e ( P O S I T I O N _ P R O F I T ) ;  
                         l i s t [ i ] . s y m b o l                 = P o s i t i o n G e t S t r i n g ( P O S I T I O N _ S Y M B O L ) ;  
                         l i s t [ i ] . c o m m e n t               = P o s i t i o n G e t S t r i n g ( P O S I T I O N _ C O M M E N T ) ;  
                         p o s i t i o n s _ c o u n t + + ;  
                 }  
           }  
  
       t e m p _ v a l u e = ( i n t ) M a t h M a x ( p o s i t i o n s _ c o u n t , 1 ) ;  
       A r r a y R e s i z e ( l i s t , t e m p _ v a l u e ) ;  
       r e t u r n ( p o s i t i o n s _ c o u n t ) ;  
 }  
  
 i n t   B u y N o w (  
       s t r i n g   s y m b o l ,  
       d o u b l e   l o t s ,  
       d o u b l e   s l l ,  
       d o u b l e   t p l ,  
       d o u b l e   s l p ,  
       d o u b l e   t p p ,  
       d o u b l e   s l i p p a g e = 0 ,  
       i n t   m a g i c = 0 ,  
       s t r i n g   c o m m e n t = " "  
       )  
 {  
       b o o l   s u c c e s s = O r d e r C r e a t e (  
             s y m b o l ,  
             P O S I T I O N _ T Y P E _ B U Y ,  
             l o t s ,  
             0 ,  
             s l l ,  
             t p l ,  
             s l p ,  
             t p p ,  
             s l i p p a g e ,  
             m a g i c ,  
             c o m m e n t ,  
             0  
             ) ;  
       r e t u r n ( s u c c e s s ) ;  
 }  
  
 i n t   C h e c k F o r T r a d i n g E r r o r ( i n t   e r r o r _ c o d e = - 1 ,   s t r i n g   m s g _ p r e f i x = " " )  
 {  
       / /   r e t u r n   0   - >   n o   e r r o r  
       / /   r e t u r n   1   - >   o v e r c o m a b l e   e r r o r  
       / /   r e t u r n   2   - >   f a t a l   e r r o r  
        
       i n t   r e t v a l = 0 ;  
       s t a t i c   i n t   t r y o u t s = 0 ;  
        
       / / - -   e r r o r   c h e c k   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
       s w i t c h ( e r r o r _ c o d e )  
       {  
             / / - -   n o   e r r o r  
             c a s e   0 :  
                   r e t v a l = 0 ;  
                   b r e a k ;  
             / / - -   o v e r c o m a b l e   e r r o r s  
             c a s e   T R A D E _ R E T C O D E _ R E Q U O T E :  
             c a s e   T R A D E _ R E T C O D E _ R E J E C T :  
             c a s e   T R A D E _ R E T C O D E _ E R R O R :  
             c a s e   T R A D E _ R E T C O D E _ T I M E O U T :  
             c a s e   T R A D E _ R E T C O D E _ I N V A L I D _ V O L U M E :  
             c a s e   T R A D E _ R E T C O D E _ I N V A L I D _ P R I C E :  
             c a s e   T R A D E _ R E T C O D E _ I N V A L I D _ S T O P S :  
             c a s e   T R A D E _ R E T C O D E _ I N V A L I D _ E X P I R A T I O N :  
             c a s e   T R A D E _ R E T C O D E _ P R I C E _ C H A N G E D :  
             c a s e   T R A D E _ R E T C O D E _ P R I C E _ O F F :  
             c a s e   T R A D E _ R E T C O D E _ T O O _ M A N Y _ R E Q U E S T S :  
             c a s e   T R A D E _ R E T C O D E _ N O _ C H A N G E S :  
             c a s e   T R A D E _ R E T C O D E _ C O N N E C T I O N :  
                   r e t v a l = 1 ;  
                   b r e a k ;  
             / / - -   c r i t i c a l   e r r o r s  
             d e f a u l t :  
                   r e t v a l = 2 ;  
                   b r e a k ;  
       }  
        
       i f   ( e r r o r _ c o d e   >   0 )  
       {  
             s t r i n g   m s g   =   " " ;  
             i f   ( r e t v a l   = =   1 )  
             {  
                   S t r i n g C o n c a t e n a t e ( m s g ,   m s g _ p r e f i x , " :   " , E r r o r M e s s a g e ( e r r o r _ c o d e ) , " .   R e t r y i n g   i n   5   s e c o n d s . . " ) ;  
                   S l e e p ( 5 0 0 ) ;    
             }  
             e l s e   i f   ( r e t v a l   = =   2 )  
             {  
                   S t r i n g C o n c a t e n a t e ( m s g ,   m s g _ p r e f i x , " :   " , E r r o r M e s s a g e ( e r r o r _ c o d e ) ) ;  
             }  
             P r i n t ( m s g ) ;  
       }  
        
       i f   ( r e t v a l = = 0 )  
       {  
             t r y o u t s = 0 ;  
       }  
       e l s e   i f   ( r e t v a l = = 1 )  
       {  
             t r y o u t s + + ;  
             i f   ( t r y o u t s > = 1 0 )  
             {  
                   t r y o u t s = 0 ;  
                   r e t v a l = 2 ;  
             }  
             e l s e  
             {  
                   P r i n t ( " r e t r y   # " + ( s t r i n g ) t r y o u t s + "   o f   1 0 " ) ;  
             }  
       }  
        
       r e t u r n ( r e t v a l ) ;  
 }  
  
 b o o l   C l o s e O r d e r ( s t r i n g   s y m b o l ,   d o u b l e   d e v i a t i o n = 0 )  
 {  
       b o o l   s u c c e s s = f a l s e ;  
       i f   ( P o s i t i o n S e l e c t ( s y m b o l ) )   {  
             s u c c e s s = C l o s e O r d e r ( s y m b o l , P o s i t i o n G e t D o u b l e ( P O S I T I O N _ V O L U M E ) , d e v i a t i o n ) ;  
       }  
        
       O n T r a d e ( ) ;  
       r e t u r n ( s u c c e s s ) ;  
 }  
 b o o l   C l o s e O r d e r ( s t r i n g   s y m b o l ,   d o u b l e   v o l u m e ,   d o u b l e   d e v i a t i o n )  
 {  
       v o l u m e = A l i g n L o t s ( v o l u m e ) ;  
  
       b o o l   s u c c e s s = f a l s e ;  
       i f   ( P o s i t i o n S e l e c t ( s y m b o l ) )  
       {  
             i n t   t o t a l = P o s i t i o n s T o t a l ( ) ;  
              
             d o u b l e   p r i c e = 0 ;  
             / / - -   t y p e   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
             E N U M _ P O S I T I O N _ T Y P E   C o n t r a T y p e = 0 ;  
             i f   ( P o s i t i o n G e t I n t e g e r ( P O S I T I O N _ T Y P E ) = = P O S I T I O N _ T Y P E _ B U Y )   {  
                   C o n t r a T y p e = P O S I T I O N _ T Y P E _ S E L L ;  
                   p r i c e = S y m b o l I n f o D o u b l e ( s y m b o l , S Y M B O L _ B I D ) ;  
             }  
             e l s e   i f   ( P o s i t i o n G e t I n t e g e r ( P O S I T I O N _ T Y P E ) = = P O S I T I O N _ T Y P E _ S E L L )   {  
                   C o n t r a T y p e = P O S I T I O N _ T Y P E _ B U Y ;  
                   p r i c e = S y m b o l I n f o D o u b l e ( s y m b o l , S Y M B O L _ A S K ) ;  
             }  
             / / - -   c o m m e n t   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
             s t r i n g   c o m m e n t = " " ;  
             i f   ( v o l u m e > P o s i t i o n G e t D o u b l e ( P O S I T I O N _ V O L U M E ) )   {  
                   v o l u m e = P o s i t i o n G e t D o u b l e ( P O S I T I O N _ V O L U M E ) ;  
             }  
             i f   ( v o l u m e = = P o s i t i o n G e t D o u b l e ( P O S I T I O N _ V O L U M E ) )   {  
                   c o m m e n t = " P o s i t i o n   # " + I n t e g e r T o S t r i n g ( P o s i t i o n G e t I n t e g e r ( P O S I T I O N _ I D E N T I F I E R ) ) + "   c l o s e d " ;  
             }  
             e l s e   {  
                   c o m m e n t = " P o s i t i o n   # " + I n t e g e r T o S t r i n g ( P o s i t i o n G e t I n t e g e r ( P O S I T I O N _ I D E N T I F I E R ) ) + "   p a r t i a l l y   c l o s e d " ;  
             }  
             / / - -   s e n d   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
             s u c c e s s = O r d e r C r e a t e (  
                   s y m b o l ,  
                   C o n t r a T y p e ,  
                   v o l u m e ,  
                   p r i c e ,  
                   0 ,  
                   0 ,  
                   0 ,  
                   0 ,  
                   d e v i a t i o n ,  
                   P o s i t i o n G e t I n t e g e r ( P O S I T I O N _ M A G I C ) ,  
                   c o m m e n t ,  
                   O R D E R _ T I M E _ G T C ,   / /   n o t   i m p o r t a n t  
                   0   / /   n o t   i n p o r t a n t  
                   ) ;  
       }  
       e l s e   {  
             P r i n t ( " C a n n o t   c l o s e   a   p o s i t i o n :   T h e r e   i s   n o   o p e n e d   p o s i t i o n   o n   " , s y m b o l ) ;      
       }  
       O n T r a d e ( ) ;  
       r e t u r n ( s u c c e s s ) ;  
 }  
  
 b o o l   C l o s e T r a d e ( u l o n g   t i c k e t ,   u l o n g   d e v i a t i o n = 0 ) 
 { 
 	 / / P r i n t ( " b e g i n   "   +   P o s i t i o n s T o t a l ( ) ) ; 
 	 
       b o o l   s u c c e s s = f a l s e ; 
       i f   ( ! P o s i t i o n S e l e c t B y T i c k e t ( t i c k e t ) )   { r e t u r n ( f a l s e ) ; } 
 	 
 	 s t r i n g   s y m b o l   =   P o s i t i o n G e t S t r i n g ( P O S I T I O N _ S Y M B O L ) ; 
 	 l o n g   m a g i c         =   P o s i t i o n G e t I n t e g e r ( P O S I T I O N _ M A G I C ) ; 
       
       w h i l e ( t r u e ) 
       { 
             / / - -   c l o s e   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 	 	 M q l T r a d e R e q u e s t   r e q u e s t ; 
             M q l T r a d e R e s u l t   r e s u l t ; 
             M q l T r a d e C h e c k R e s u l t   c h e c k _ r e s u l t ; 
             Z e r o M e m o r y ( r e q u e s t ) ; 
             Z e r o M e m o r y ( r e s u l t ) ; 
             Z e r o M e m o r y ( c h e c k _ r e s u l t ) ; 
 	 	 
 	 	 i f ( ( E N U M _ P O S I T I O N _ T Y P E ) P o s i t i o n G e t I n t e g e r ( P O S I T I O N _ T Y P E )   = =   P O S I T I O N _ T Y P E _ B U Y ) 
 	 	 { 
 	 	 	 / / - - -   p r e p a r e   r e q u e s t   f o r   c l o s e   B U Y   p o s i t i o n 
 	 	 	 r e q u e s t . t y p e     =   O R D E R _ T Y P E _ S E L L ; 
 	 	 	 r e q u e s t . p r i c e   =   S y m b o l I n f o D o u b l e ( s y m b o l , S Y M B O L _ B I D ) ; 
 	 	 } 
 	 	 e l s e 
 	 	 { 
 	 	 	 / / - - -   p r e p a r e   r e q u e s t   f o r   c l o s e   S E L L   p o s i t i o n 
 	 	 	 r e q u e s t . t y p e     =   O R D E R _ T Y P E _ B U Y ; 
 	 	 	 r e q u e s t . p r i c e   =   S y m b o l I n f o D o u b l e ( s y m b o l , S Y M B O L _ A S K ) ; 
 	 	 } 
 	 	 
 	 	 r e q u e s t . a c t i o n         =   T R A D E _ A C T I O N _ D E A L ; 
 	 	 r e q u e s t . p o s i t i o n     =   t i c k e t ; 
 	 	 r e q u e s t . s y m b o l         =   s y m b o l ; 
 	 	 r e q u e s t . v o l u m e         =   P o s i t i o n G e t D o u b l e ( P O S I T I O N _ V O L U M E ) ; 
 	 	 r e q u e s t . m a g i c           =   m a g i c ; 
 	 	 r e q u e s t . d e v i a t i o n   =   ( i n t ) ( d e v i a t i o n * P i p V a l u e ( s y m b o l ) ) ; 
 	 	 
 	 	 / /   f i l l i n g   t y p e 
 	 	 i f   ( I s F i l l i n g T y p e A l l o w e d ( s y m b o l ,   S Y M B O L _ F I L L I N G _ F O K ) ) 
 	             r e q u e s t . t y p e _ f i l l i n g   =   O R D E R _ F I L L I N G _ F O K ; 
 	 	 e l s e   i f   ( I s F i l l i n g T y p e A l l o w e d ( s y m b o l ,   S Y M B O L _ F I L L I N G _ I O C ) ) 
 	 	 	 r e q u e s t . t y p e _ f i l l i n g   =   O R D E R _ F I L L I N G _ I O C ; 
 	 	 e l s e   i f   ( I s F i l l i n g T y p e A l l o w e d ( s y m b o l ,   O R D E R _ F I L L I N G _ R E T U R N ) )   / /   j u s t   i n   c a s e 
 	 	 	 r e q u e s t . t y p e _ f i l l i n g   =   O R D E R _ F I L L I N G _ R E T U R N ; 
 	 	 
 	 	 i n t   s u c c e s s   =   O r d e r S e n d ( r e q u e s t ,   r e s u l t ) ; 
 	 	 
 	 	 / / - -   e r r o r   c h e c k   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
             i f   ( ! s u c c e s s   | |   ( r e s u l t . r e t c o d e ! = T R A D E _ R E T C O D E _ D O N E   & &   r e s u l t . r e t c o d e ! = T R A D E _ R E T C O D E _ P L A C E D   & &   r e s u l t . r e t c o d e ! = T R A D E _ R E T C O D E _ D O N E _ P A R T I A L ) ) 
             { 
                   s t r i n g   e r r m s g p f x = " C l o s i n g   p o s i t i o n / t r a d e   e r r o r " ; 
 
                   i n t   e r r a c t i o n = C h e c k F o r T r a d i n g E r r o r ( r e s u l t . r e t c o d e ,   e r r m s g p f x ) ; 
                   s w i t c h ( e r r a c t i o n ) 
                   { 
                         c a s e   0 :   b r e a k ;         / /   n o   e r r o r 
                         c a s e   1 :   c o n t i n u e ;   / /   o v e r c o m a b l e   e r r o r 
                         c a s e   2 :   b r e a k ;         / /   f a t a l   e r r o r 
                   } 
                   r e t u r n   f a l s e ; 
             } 
 	 	 
 	 	 / / - -   f i n i s h   w o r k   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
             i f   ( r e s u l t . r e t c o d e = = T R A D E _ R E T C O D E _ D O N E   | |   r e s u l t . r e t c o d e = = T R A D E _ R E T C O D E _ P L A C E D   | |   r e s u l t . r e t c o d e = = T R A D E _ R E T C O D E _ D O N E _ P A R T I A L ) 
             { 
 	 	 	 w h i l e   ( t r u e ) 
                   { 
                       	 i f   ( ! P o s i t i o n S e l e c t B y T i c k e t ( t i c k e t ) )   { b r e a k ; } 
             	 	 S l e e p ( 1 0 ) ; 
                   } 
 	 	 } 
 	 	 
             b r e a k ; 
       } 
 	 
 	 / / P r i n t ( " e n d   "   +   P o s i t i o n s T o t a l ( ) ) ; 
 	 
 	 O n T r a d e ( ) ; 
       r e t u r n   t r u e ; 
 }  
  
 s t r i n g   C u r r e n t S y m b o l ( s t r i n g   s y m b o l = " " )  
 {  
       s t a t i c   s t r i n g   m e m o r y = " " ;  
       i f   ( s y m b o l ! = " " )   { m e m o r y = s y m b o l ; }   e l s e  
       i f   ( m e m o r y = = " " )   { m e m o r y = S y m b o l ( ) ; }  
       r e t u r n ( m e m o r y ) ;  
 }  
  
 b o o l   D e l e t e O r d e r ( u l o n g   t i c k e t )  
 {  
       w h i l e ( t r u e )  
       {  
             M q l T r a d e R e q u e s t   r e q u e s t ;  
             M q l T r a d e R e s u l t   r e s u l t ;  
             M q l T r a d e C h e c k R e s u l t   c h e c k _ r e s u l t ;  
             Z e r o M e m o r y ( r e q u e s t ) ;  
             Z e r o M e m o r y ( r e s u l t ) ;  
             Z e r o M e m o r y ( c h e c k _ r e s u l t ) ;  
        
             r e q u e s t . o r d e r = t i c k e t ;  
             r e q u e s t . a c t i o n = T R A D E _ A C T I O N _ R E M O V E ;  
             r e q u e s t . c o m m e n t = " P e n d i n g   o r d e r   c a n c e l e d " ;  
        
             i f   ( ! O r d e r C h e c k ( r e q u e s t , c h e c k _ r e s u l t ) )     {  
                   P r i n t ( " O r d e r C h e c k ( )   f a i l e d :   " + ( s t r i n g ) c h e c k _ r e s u l t . c o m m e n t + "   ( " + ( s t r i n g ) c h e c k _ r e s u l t . r e t c o d e + " ) " ) ;  
                   r e t u r n   f a l s e ;  
             }  
              
             b o o l   s u c c e s s   =   O r d e r S e n d ( r e q u e s t , r e s u l t ) ;  
              
             / / - -   e r r o r   c h e c k   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
             i f   ( ! s u c c e s s   | |   r e s u l t . r e t c o d e ! = T R A D E _ R E T C O D E _ D O N E )  
             {  
                   s t r i n g   e r r m s g p f x = " D e l e t e   o r d e r   e r r o r " ;  
                   i n t   e r r a c t i o n = C h e c k F o r T r a d i n g E r r o r ( r e s u l t . r e t c o d e ,   e r r m s g p f x ) ;  
                   s w i t c h ( e r r a c t i o n )  
                   {  
                         c a s e   0 :   b r e a k ;         / /   n o   e r r o r  
                         c a s e   1 :   c o n t i n u e ;   / /   o v e r c o m a b l e   e r r o r  
                         c a s e   2 :   b r e a k ;         / /   f a t a l   e r r o r  
                   }  
                   r e t u r n ( f a l s e ) ;  
             }  
              
             / / - -   f i n i s h   w o r k   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
             i f   ( r e s u l t . r e t c o d e = = T R A D E _ R E T C O D E _ D O N E )  
             {  
                   / / = =   W a i t   u n t i l   M T 5   u p d a t e s   i t ' s   c a c h e  
                   i n t   w ;  
                   f o r   ( w = 0 ;   w < 5 0 0 0 ;   w + + )  
                   {  
                         i f   ( ! O r d e r S e l e c t ( t i c k e t ) )   { b r e a k ; }  
                         S l e e p ( 1 ) ;  
                   }  
                   i f   ( w = = 5 0 0 0 )   {  
                         P r i n t ( " C h e c k   e r r o r :   D e l e t e   o r d e r " ) ;      
                   }  
                   i f   ( O r d e r S e l e c t ( t i c k e t ) )   {  
                         P r i n t ( " S o m e t h i n g   w e n t   w r o n g   w i t h   t h e   o r d e r " ) ;  
                         r e t u r n   f a l s e ;  
                   }  
             }  
             b r e a k ;  
       }  
       O n T r a d e ( ) ;  
       r e t u r n ( t r u e ) ;  
 }  
  
 s t r i n g   D o u b l e T o S t r ( d o u b l e   d ,   i n t   d i g ) { r e t u r n ( D o u b l e T o S t r i n g ( d , d i g ) ) ; }  
  
 v o i d   D r a w S p r e a d I n f o ( ) 
 { 
       s t a t i c   b o o l   a l l o w _ d r a w   =   t r u e ; 
       i f   ( a l l o w _ d r a w = = f a l s e )   { r e t u r n ; } 
       i f   ( M Q L I n f o I n t e g e r ( M Q L _ T E S T E R )   & &   ! M Q L I n f o I n t e g e r ( M Q L _ V I S U A L _ M O D E ) )   { a l l o w _ d r a w = f a l s e ; }   / /   A l l o w e d   t o   d r a w   o n l y   o n c e   i n   t e s t i n g   m o d e 
 
       s t a t i c   b o o l   p a s s e d                   =   f a l s e ; 
       s t a t i c   d o u b l e   m a x _ s p r e a d       =   0 ; 
       s t a t i c   d o u b l e   m i n _ s p r e a d       =   E M P T Y _ V A L U E ; 
       s t a t i c   d o u b l e   a v g _ s p r e a d       =   0 ; 
       s t a t i c   d o u b l e   a v g _ a d d             =   0 ; 
       s t a t i c   d o u b l e   a v g _ c n t             =   0 ; 
 
       d o u b l e   c u s t o m _ p o i n t   =   C u s t o m P o i n t ( S y m b o l ( ) ) ; 
       d o u b l e   c u r r e n t _ s p r e a d   =   0 ; 
       i f   ( c u s t o m _ p o i n t   >   0 )   { 
             c u r r e n t _ s p r e a d   =   ( S y m b o l I n f o D o u b l e ( S y m b o l ( ) , S Y M B O L _ A S K ) - S y m b o l I n f o D o u b l e ( S y m b o l ( ) , S Y M B O L _ B I D ) ) / c u s t o m _ p o i n t ; 
       } 
       i f   ( c u r r e n t _ s p r e a d   >   m a x _ s p r e a d )   { m a x _ s p r e a d   =   c u r r e n t _ s p r e a d ; } 
       i f   ( c u r r e n t _ s p r e a d   <   m i n _ s p r e a d )   { m i n _ s p r e a d   =   c u r r e n t _ s p r e a d ; } 
       
       a v g _ c n t + + ; 
       a v g _ a d d           =   a v g _ a d d   +   c u r r e n t _ s p r e a d ; 
       a v g _ s p r e a d     =   a v g _ a d d   /   a v g _ c n t ; 
 
       i n t   x = 0 ;   i n t   y = 0 ; 
       s t r i n g   n a m e ; 
 
       / /   c r e a t e   o b j e c t s 
       i f   ( p a s s e d   = =   f a l s e ) 
       { 
             p a s s e d = t r u e ; 
             
             n a m e = " f x d _ s p r e a d _ c u r r e n t _ l a b e l " ; 
             i f   ( O b j e c t F i n d ( 0 ,   n a m e ) = = - 1 )   { 
                   O b j e c t C r e a t e ( 0 ,   n a m e ,   O B J _ L A B E L ,   0 ,   0 ,   0 ) ; 
                   O b j e c t S e t I n t e g e r ( 0 ,   n a m e ,   O B J P R O P _ X D I S T A N C E ,   x + 1 ) ; 
                   O b j e c t S e t I n t e g e r ( 0 ,   n a m e ,   O B J P R O P _ Y D I S T A N C E ,   y + 1 ) ; 
                   O b j e c t S e t I n t e g e r ( 0 ,   n a m e ,   O B J P R O P _ C O R N E R ,   C O R N E R _ L E F T _ L O W E R ) ; 
                   O b j e c t S e t I n t e g e r ( 0 ,   n a m e ,   O B J P R O P _ A N C H O R ,   A N C H O R _ L E F T _ L O W E R ) ; 
                   O b j e c t S e t I n t e g e r ( 0 ,   n a m e ,   O B J P R O P _ H I D D E N ,   t r u e ) ; 
                   O b j e c t S e t I n t e g e r ( 0 ,   n a m e ,   O B J P R O P _ F O N T S I Z E ,   1 8 ) ; 
                   O b j e c t S e t I n t e g e r ( 0 ,   n a m e ,   O B J P R O P _ C O L O R ,   c l r D a r k O r a n g e ) ; 
                   O b j e c t S e t S t r i n g ( 0 ,   n a m e ,   O B J P R O P _ F O N T ,   " A r i a l " ) ; 
                   O b j e c t S e t S t r i n g ( 0 ,   n a m e ,   O B J P R O P _ T E X T ,   " S p r e a d : " ) ; 
             } 
             n a m e = " f x d _ s p r e a d _ m a x _ l a b e l " ; 
             i f   ( O b j e c t F i n d ( 0 ,   n a m e ) = = - 1 )   { 
                   O b j e c t C r e a t e ( 0 ,   n a m e ,   O B J _ L A B E L ,   0 ,   0 ,   0 ) ; 
                   O b j e c t S e t I n t e g e r ( 0 ,   n a m e ,   O B J P R O P _ X D I S T A N C E ,   x + 1 4 8 ) ; 
                   O b j e c t S e t I n t e g e r ( 0 ,   n a m e ,   O B J P R O P _ Y D I S T A N C E ,   y + 1 7 ) ; 
                   O b j e c t S e t I n t e g e r ( 0 ,   n a m e ,   O B J P R O P _ C O R N E R ,   C O R N E R _ L E F T _ L O W E R ) ; 
                   O b j e c t S e t I n t e g e r ( 0 ,   n a m e ,   O B J P R O P _ A N C H O R ,   A N C H O R _ L E F T _ L O W E R ) ; 
                   O b j e c t S e t I n t e g e r ( 0 ,   n a m e ,   O B J P R O P _ H I D D E N ,   t r u e ) ; 
                   O b j e c t S e t I n t e g e r ( 0 ,   n a m e ,   O B J P R O P _ F O N T S I Z E ,   7 ) ; 
                   O b j e c t S e t I n t e g e r ( 0 ,   n a m e ,   O B J P R O P _ C O L O R ,   c l r O r a n g e R e d ) ; 
                   O b j e c t S e t S t r i n g ( 0 ,   n a m e ,   O B J P R O P _ F O N T ,   " A r i a l " ) ; 
                   O b j e c t S e t S t r i n g ( 0 ,   n a m e ,   O B J P R O P _ T E X T ,   " m a x : " ) ; 
             } 
             n a m e = " f x d _ s p r e a d _ a v g _ l a b e l " ; 
             i f   ( O b j e c t F i n d ( 0 ,   n a m e ) = = - 1 )   { 
                   O b j e c t C r e a t e ( 0 ,   n a m e ,   O B J _ L A B E L ,   0 ,   0 ,   0 ) ; 
                   O b j e c t S e t I n t e g e r ( 0 ,   n a m e ,   O B J P R O P _ X D I S T A N C E ,   x + 1 4 8 ) ; 
                   O b j e c t S e t I n t e g e r ( 0 ,   n a m e ,   O B J P R O P _ Y D I S T A N C E ,   y + 9 ) ; 
                   O b j e c t S e t I n t e g e r ( 0 ,   n a m e ,   O B J P R O P _ C O R N E R ,   C O R N E R _ L E F T _ L O W E R ) ; 
                   O b j e c t S e t I n t e g e r ( 0 ,   n a m e ,   O B J P R O P _ A N C H O R ,   A N C H O R _ L E F T _ L O W E R ) ; 
                   O b j e c t S e t I n t e g e r ( 0 ,   n a m e ,   O B J P R O P _ H I D D E N ,   t r u e ) ; 
                   O b j e c t S e t I n t e g e r ( 0 ,   n a m e ,   O B J P R O P _ F O N T S I Z E ,   7 ) ; 
                   O b j e c t S e t I n t e g e r ( 0 ,   n a m e ,   O B J P R O P _ C O L O R ,   c l r D a r k O r a n g e ) ; 
                   O b j e c t S e t S t r i n g ( 0 ,   n a m e ,   O B J P R O P _ F O N T ,   " A r i a l " ) ; 
                   O b j e c t S e t S t r i n g ( 0 ,   n a m e ,   O B J P R O P _ T E X T ,   " a v g : " ) ; 
             } 
             n a m e = " f x d _ s p r e a d _ m i n _ l a b e l " ; 
             i f   ( O b j e c t F i n d ( 0 ,   n a m e ) = = - 1 )   { 
                   O b j e c t C r e a t e ( 0 ,   n a m e ,   O B J _ L A B E L ,   0 ,   0 ,   0 ) ; 
                   O b j e c t S e t I n t e g e r ( 0 ,   n a m e ,   O B J P R O P _ X D I S T A N C E ,   x + 1 4 8 ) ; 
                   O b j e c t S e t I n t e g e r ( 0 ,   n a m e ,   O B J P R O P _ Y D I S T A N C E ,   y + 1 ) ; 
                   O b j e c t S e t I n t e g e r ( 0 ,   n a m e ,   O B J P R O P _ C O R N E R ,   C O R N E R _ L E F T _ L O W E R ) ; 
                   O b j e c t S e t I n t e g e r ( 0 ,   n a m e ,   O B J P R O P _ A N C H O R ,   A N C H O R _ L E F T _ L O W E R ) ; 
                   O b j e c t S e t I n t e g e r ( 0 ,   n a m e ,   O B J P R O P _ H I D D E N ,   t r u e ) ; 
                   O b j e c t S e t I n t e g e r ( 0 ,   n a m e ,   O B J P R O P _ F O N T S I Z E ,   7 ) ; 
                   O b j e c t S e t I n t e g e r ( 0 ,   n a m e ,   O B J P R O P _ C O L O R ,   c l r G o l d ) ; 
                   O b j e c t S e t S t r i n g ( 0 ,   n a m e ,   O B J P R O P _ F O N T ,   " A r i a l " ) ; 
                   O b j e c t S e t S t r i n g ( 0 ,   n a m e ,   O B J P R O P _ T E X T ,   " m i n : " ) ; 
             } 
             n a m e = " f x d _ s p r e a d _ c u r r e n t " ; 
             i f   ( O b j e c t F i n d ( 0 ,   n a m e ) = = - 1 )   { 
                   O b j e c t C r e a t e ( 0 ,   n a m e ,   O B J _ L A B E L ,   0 ,   0 ,   0 ) ; 
                   O b j e c t S e t I n t e g e r ( 0 ,   n a m e ,   O B J P R O P _ X D I S T A N C E ,   x + 9 3 ) ; 
                   O b j e c t S e t I n t e g e r ( 0 ,   n a m e ,   O B J P R O P _ Y D I S T A N C E ,   y + 1 ) ; 
                   O b j e c t S e t I n t e g e r ( 0 ,   n a m e ,   O B J P R O P _ C O R N E R ,   C O R N E R _ L E F T _ L O W E R ) ; 
                   O b j e c t S e t I n t e g e r ( 0 ,   n a m e ,   O B J P R O P _ A N C H O R ,   A N C H O R _ L E F T _ L O W E R ) ; 
                   O b j e c t S e t I n t e g e r ( 0 ,   n a m e ,   O B J P R O P _ H I D D E N ,   t r u e ) ; 
                   O b j e c t S e t I n t e g e r ( 0 ,   n a m e ,   O B J P R O P _ F O N T S I Z E ,   1 8 ) ; 
                   O b j e c t S e t I n t e g e r ( 0 ,   n a m e ,   O B J P R O P _ C O L O R ,   c l r D a r k O r a n g e ) ; 
                   O b j e c t S e t S t r i n g ( 0 ,   n a m e ,   O B J P R O P _ F O N T ,   " A r i a l " ) ; 
                   O b j e c t S e t S t r i n g ( 0 ,   n a m e ,   O B J P R O P _ T E X T ,   " 0 " ) ; 
             } 
             n a m e = " f x d _ s p r e a d _ m a x " ; 
             i f   ( O b j e c t F i n d ( 0 ,   n a m e ) = = - 1 )   { 
                   O b j e c t C r e a t e ( 0 ,   n a m e ,   O B J _ L A B E L ,   0 ,   0 ,   0 ) ; 
                   O b j e c t S e t I n t e g e r ( 0 ,   n a m e ,   O B J P R O P _ X D I S T A N C E ,   x + 1 7 3 ) ; 
                   O b j e c t S e t I n t e g e r ( 0 ,   n a m e ,   O B J P R O P _ Y D I S T A N C E ,   y + 1 7 ) ; 
                   O b j e c t S e t I n t e g e r ( 0 ,   n a m e ,   O B J P R O P _ C O R N E R ,   C O R N E R _ L E F T _ L O W E R ) ; 
                   O b j e c t S e t I n t e g e r ( 0 ,   n a m e ,   O B J P R O P _ A N C H O R ,   A N C H O R _ L E F T _ L O W E R ) ; 
                   O b j e c t S e t I n t e g e r ( 0 ,   n a m e ,   O B J P R O P _ H I D D E N ,   t r u e ) ; 
                   O b j e c t S e t I n t e g e r ( 0 ,   n a m e ,   O B J P R O P _ F O N T S I Z E ,   7 ) ; 
                   O b j e c t S e t I n t e g e r ( 0 ,   n a m e ,   O B J P R O P _ C O L O R ,   c l r O r a n g e R e d ) ; 
                   O b j e c t S e t S t r i n g ( 0 ,   n a m e ,   O B J P R O P _ F O N T ,   " A r i a l " ) ; 
                   O b j e c t S e t S t r i n g ( 0 ,   n a m e ,   O B J P R O P _ T E X T ,   " 0 " ) ; 
             } 
             n a m e = " f x d _ s p r e a d _ a v g " ; 
             i f   ( O b j e c t F i n d ( 0 ,   n a m e ) = = - 1 )   { 
                   O b j e c t C r e a t e ( 0 ,   n a m e ,   O B J _ L A B E L ,   0 ,   0 ,   0 ) ; 
                   O b j e c t S e t I n t e g e r ( 0 ,   n a m e ,   O B J P R O P _ X D I S T A N C E ,   x + 1 7 3 ) ; 
                   O b j e c t S e t I n t e g e r ( 0 ,   n a m e ,   O B J P R O P _ Y D I S T A N C E ,   y + 9 ) ; 
                   O b j e c t S e t I n t e g e r ( 0 ,   n a m e ,   O B J P R O P _ C O R N E R ,   C O R N E R _ L E F T _ L O W E R ) ; 
                   O b j e c t S e t I n t e g e r ( 0 ,   n a m e ,   O B J P R O P _ A N C H O R ,   A N C H O R _ L E F T _ L O W E R ) ; 
                   O b j e c t S e t I n t e g e r ( 0 ,   n a m e ,   O B J P R O P _ H I D D E N ,   t r u e ) ; 
                   O b j e c t S e t I n t e g e r ( 0 ,   n a m e ,   O B J P R O P _ F O N T S I Z E ,   7 ) ; 
                   O b j e c t S e t I n t e g e r ( 0 ,   n a m e ,   O B J P R O P _ C O L O R ,   c l r D a r k O r a n g e ) ; 
                   O b j e c t S e t S t r i n g ( 0 ,   n a m e ,   O B J P R O P _ F O N T ,   " A r i a l " ) ; 
                   O b j e c t S e t S t r i n g ( 0 ,   n a m e ,   O B J P R O P _ T E X T ,   " 0 " ) ; 
             } 
             n a m e = " f x d _ s p r e a d _ m i n " ; 
             i f   ( O b j e c t F i n d ( 0 ,   n a m e ) = = - 1 )   { 
                   O b j e c t C r e a t e ( 0 ,   n a m e ,   O B J _ L A B E L ,   0 ,   0 ,   0 ) ; 
                   O b j e c t S e t I n t e g e r ( 0 ,   n a m e ,   O B J P R O P _ X D I S T A N C E ,   x + 1 7 3 ) ; 
                   O b j e c t S e t I n t e g e r ( 0 ,   n a m e ,   O B J P R O P _ Y D I S T A N C E ,   y + 1 ) ; 
                   O b j e c t S e t I n t e g e r ( 0 ,   n a m e ,   O B J P R O P _ C O R N E R ,   C O R N E R _ L E F T _ L O W E R ) ; 
                   O b j e c t S e t I n t e g e r ( 0 ,   n a m e ,   O B J P R O P _ A N C H O R ,   A N C H O R _ L E F T _ L O W E R ) ; 
                   O b j e c t S e t I n t e g e r ( 0 ,   n a m e ,   O B J P R O P _ H I D D E N ,   t r u e ) ; 
                   O b j e c t S e t I n t e g e r ( 0 ,   n a m e ,   O B J P R O P _ F O N T S I Z E ,   7 ) ; 
                   O b j e c t S e t I n t e g e r ( 0 ,   n a m e ,   O B J P R O P _ C O L O R ,   c l r G o l d ) ; 
                   O b j e c t S e t S t r i n g ( 0 ,   n a m e ,   O B J P R O P _ F O N T ,   " A r i a l " ) ; 
                   O b j e c t S e t S t r i n g ( 0 ,   n a m e ,   O B J P R O P _ T E X T ,   " 0 " ) ; 
             } 
       } 
       
       O b j e c t S e t S t r i n g ( 0 ,   " f x d _ s p r e a d _ c u r r e n t " ,   O B J P R O P _ T E X T ,   D o u b l e T o S t r ( c u r r e n t _ s p r e a d , 2 ) ) ; 
       O b j e c t S e t S t r i n g ( 0 ,   " f x d _ s p r e a d _ m a x " ,   O B J P R O P _ T E X T ,   D o u b l e T o S t r ( m a x _ s p r e a d , 2 ) ) ; 
       O b j e c t S e t S t r i n g ( 0 ,   " f x d _ s p r e a d _ a v g " ,   O B J P R O P _ T E X T ,   D o u b l e T o S t r ( a v g _ s p r e a d , 2 ) ) ; 
       O b j e c t S e t S t r i n g ( 0 ,   " f x d _ s p r e a d _ m i n " ,   O B J P R O P _ T E X T ,   D o u b l e T o S t r ( m i n _ s p r e a d , 2 ) ) ; 
 }  
  
 s t r i n g   D r a w S t a t u s ( s t r i n g   t e x t = " " )  
 {  
       s t a t i c   s t r i n g   m e m o r y ;  
       i f   ( t e x t = = " " )   {  
             r e t u r n ( m e m o r y ) ;  
       }  
        
       s t a t i c   b o o l   p a s s e d   =   f a l s e ;  
       i n t   x = 2 1 0 ;   i n t   y = 0 ;  
       s t r i n g   n a m e ;  
  
       / / - -   d r a w   t h e   o b j e c t s   o n c e  
       i f   ( p a s s e d   = =   f a l s e )  
       {  
             p a s s e d   =   t r u e ;  
             n a m e = " f x d _ s t a t u s _ t i t l e " ;  
             O b j e c t C r e a t e ( 0 , n a m e ,   O B J _ L A B E L ,   0 ,   0 ,   0 ) ;  
             O b j e c t S e t I n t e g e r ( 0 , n a m e ,   O B J P R O P _ B A C K ,   f a l s e ) ;  
             O b j e c t S e t I n t e g e r ( 0 ,   n a m e ,   O B J P R O P _ C O R N E R ,   C O R N E R _ L E F T _ L O W E R ) ;  
             O b j e c t S e t I n t e g e r ( 0 ,   n a m e ,   O B J P R O P _ A N C H O R ,   A N C H O R _ L E F T _ L O W E R ) ;  
             O b j e c t S e t I n t e g e r ( 0 ,   n a m e ,   O B J P R O P _ H I D D E N ,   t r u e ) ;  
             O b j e c t S e t I n t e g e r ( 0 , n a m e ,   O B J P R O P _ X D I S T A N C E ,   x ) ;  
             O b j e c t S e t I n t e g e r ( 0 , n a m e ,   O B J P R O P _ Y D I S T A N C E ,   y + 1 7 ) ;  
             O b j e c t S e t S t r i n g ( 0 , n a m e ,   O B J P R O P _ T E X T ,   " S t a t u s " ) ;  
             O b j e c t S e t S t r i n g ( 0 , n a m e ,   O B J P R O P _ F O N T ,   " A r i a l " ) ;  
             O b j e c t S e t I n t e g e r ( 0 , n a m e ,   O B J P R O P _ F O N T S I Z E ,   7 ) ;  
             O b j e c t S e t I n t e g e r ( 0 , n a m e ,   O B J P R O P _ C O L O R ,   c l r G r a y ) ;  
              
             n a m e = " f x d _ s t a t u s _ t e x t " ;  
             O b j e c t C r e a t e ( 0 , n a m e ,   O B J _ L A B E L ,   0 ,   0 ,   0 ) ;  
             O b j e c t S e t I n t e g e r ( 0 , n a m e ,   O B J P R O P _ B A C K ,   f a l s e ) ;  
             O b j e c t S e t I n t e g e r ( 0 ,   n a m e ,   O B J P R O P _ C O R N E R ,   C O R N E R _ L E F T _ L O W E R ) ;  
             O b j e c t S e t I n t e g e r ( 0 ,   n a m e ,   O B J P R O P _ A N C H O R ,   A N C H O R _ L E F T _ L O W E R ) ;  
             O b j e c t S e t I n t e g e r ( 0 ,   n a m e ,   O B J P R O P _ H I D D E N ,   t r u e ) ;  
             O b j e c t S e t I n t e g e r ( 0 , n a m e ,   O B J P R O P _ X D I S T A N C E ,   x + 2 ) ;  
             O b j e c t S e t I n t e g e r ( 0 , n a m e ,   O B J P R O P _ Y D I S T A N C E ,   y + 1 ) ;  
             O b j e c t S e t S t r i n g ( 0 , n a m e ,   O B J P R O P _ F O N T ,   " A r i a l " ) ;  
             O b j e c t S e t I n t e g e r ( 0 , n a m e ,   O B J P R O P _ F O N T S I Z E ,   1 2 ) ;  
             O b j e c t S e t I n t e g e r ( 0 , n a m e ,   O B J P R O P _ C O L O R ,   c l r A q u a ) ;  
       }  
  
       / / - -   u p d a t e   t h e   t e x t   w h e n   n e e d e d  
       i f   ( t e x t   ! =   m e m o r y )   {  
             m e m o r y = t e x t ;  
             O b j e c t S e t S t r i n g ( 0 , " f x d _ s t a t u s _ t e x t " ,   O B J P R O P _ T E X T ,   t e x t ) ;  
       }  
        
       r e t u r n ( t e x t ) ;  
 }  
  
 d o u b l e   D y n a m i c L o t s ( s t r i n g   m o d e = " b a l a n c e " ,   d o u b l e   v a l u e = 0 ,   d o u b l e   s l = 0 ,   s t r i n g   a l i g n = " a l i g n " ) 
 { 
       d o u b l e   s i z e = 0 ; 
       s t r i n g   s y m b o l = G e t S y m b o l ( ) ; 
       d o u b l e   L o t S t e p = S y m b o l L o t S t e p ( s y m b o l ) ; 
       d o u b l e   L o t S i z e = S y m b o l L o t S i z e ( s y m b o l ) ; 
       d o u b l e   M i n L o t s = S y m b o l M i n L o t ( s y m b o l ) ; 
       d o u b l e   M a x L o t s = S y m b o l M a x L o t ( s y m b o l ) ; 
       d o u b l e   T i c k V a l u e = S y m b o l I n f o D o u b l e ( s y m b o l , S Y M B O L _ T R A D E _ T I C K _ V A L U E ) ; 
       d o u b l e   m a r g i n _ r e q u i r e d = 0 ; 
       b o o l   o c m   =   O r d e r C a l c M a r g i n ( O R D E R _ T Y P E _ B U Y , s y m b o l , 1 , a s k ( s y m b o l ) , m a r g i n _ r e q u i r e d ) ;   / /   T h i s   i s   t h e   M O D E _ M A R G I N R E Q U I R E D   a n a l o g   i n   M Q L 5 
       / / i f   ( v a l u e > M a x L o t s )   { v a l u e = v a l u e / L o t S i z e ; }   / /   M o n e y - t o - L o t   c o n v e r s i o n 
       
                 i f   ( m o d e = = " f i x e d "   | |   m o d e = = " l o t s " )   { s i z e = v a l u e ; } 
       e l s e   i f   ( m o d e = = " b l o c k - e q u i t y " )           { s i z e = ( v a l u e / 1 0 0 ) * A c c o u n t E q u i t y ( ) / m a r g i n _ r e q u i r e d ; } 
       e l s e   i f   ( m o d e = = " b l o c k - b a l a n c e " )         { s i z e = ( v a l u e / 1 0 0 ) * A c c o u n t B a l a n c e ( ) / m a r g i n _ r e q u i r e d ; } 
       e l s e   i f   ( m o d e = = " b l o c k - f r e e m a r g i n " )   { s i z e = ( v a l u e / 1 0 0 ) * A c c o u n t F r e e M a r g i n ( ) / m a r g i n _ r e q u i r e d ; } 
       e l s e   i f   ( m o d e = = " e q u i t y " )           { s i z e = ( v a l u e / 1 0 0 ) * A c c o u n t E q u i t y ( ) / ( L o t S i z e * T i c k V a l u e ) ; } 
       e l s e   i f   ( m o d e = = " b a l a n c e " )         { s i z e = ( v a l u e / 1 0 0 ) * A c c o u n t B a l a n c e ( ) / ( L o t S i z e * T i c k V a l u e ) ; } 
       e l s e   i f   ( m o d e = = " f r e e m a r g i n " )   { s i z e = ( v a l u e / 1 0 0 ) * A c c o u n t F r e e M a r g i n ( ) / ( L o t S i z e * T i c k V a l u e ) ; } 
       e l s e   i f   ( m o d e = = " e q u i t y R i s k " )   { s i z e = ( ( v a l u e / 1 0 0 ) * A c c o u n t E q u i t y ( ) ) / ( s l * T i c k V a l u e * P i p V a l u e ( s y m b o l ) ) ; } 
       e l s e   i f   ( m o d e = = " b a l a n c e R i s k " ) { s i z e = ( ( v a l u e / 1 0 0 ) * A c c o u n t B a l a n c e ( ) ) / ( s l * T i c k V a l u e * P i p V a l u e ( s y m b o l ) ) ; } 
       e l s e   i f   ( m o d e = = " f r e e m a r g i n R i s k " )   { s i z e = ( ( v a l u e / 1 0 0 ) * A c c o u n t F r e e M a r g i n ( ) ) / ( s l * T i c k V a l u e * P i p V a l u e ( s y m b o l ) ) ; } 
       e l s e   i f   ( m o d e = = " f i x e d R i s k " )       { s i z e = ( v a l u e ) / ( s l * T i c k V a l u e * P i p V a l u e ( s y m b o l ) ) ; } 
       e l s e   i f   ( m o d e = = " f i x e d R a t i o "   | |   m o d e = = " R J F R " )   {   
             / / / / / 
             / /   R y a n   J o n e s   F i x e d   R a t i o   M M   s t a t i c   d a t a 
             s t a t i c   d o u b l e   R J F R _ s t a r t _ l o t s = 0 ; 
             s t a t i c   d o u b l e   R J F R _ d e l t a = 0 ; 
             s t a t i c   d o u b l e   R J F R _ u n i t s = 1 ; 
             s t a t i c   d o u b l e   R J F R _ t a r g e t _ l o w e r = 0 ; 
             s t a t i c   d o u b l e   R J F R _ t a r g e t _ u p p e r = 0 ; 
             / / / / / 
             
             i f   ( R J F R _ s t a r t _ l o t s < = 0 )   { R J F R _ s t a r t _ l o t s = v a l u e ; } 
             i f   ( R J F R _ s t a r t _ l o t s < M i n L o t s )   { R J F R _ s t a r t _ l o t s = M i n L o t s ; } 
             i f   ( R J F R _ d e l t a < = 0 )   { R J F R _ d e l t a = s l ; } 
             i f   ( R J F R _ t a r g e t _ u p p e r < = 0 )   { 
                   R J F R _ t a r g e t _ u p p e r = A c c o u n t E q u i t y ( ) + ( R J F R _ u n i t s * R J F R _ d e l t a ) ; 
                   P r i n t ( " F i x e d   R a t i o   M M :   U n i t s = > " , R J F R _ u n i t s , " ;   D e l t a = " , R J F R _ d e l t a , " ;   U p p e r   T a r g e t   E q u i t y = > " , R J F R _ t a r g e t _ u p p e r ) ; 
             } 
             i f   ( A c c o u n t E q u i t y ( ) > = R J F R _ t a r g e t _ u p p e r ) 
             { 
                   w h i l e ( t r u e )   { 
                         P r i n t ( " F i x e d   R a t i o   M M   g o i n g   u p   t o   " , ( R J F R _ s t a r t _ l o t s * ( R J F R _ u n i t s + 1 ) ) , "   l o t s :   E q u i t y   i s   a b o v e   U p p e r   T a r g e t   E q u i t y   ( " , A c c o u n t E q u i t y ( ) , " > = " , R J F R _ t a r g e t _ u p p e r , " ) " ) ; 
                         R J F R _ u n i t s + + ; 
                         R J F R _ t a r g e t _ l o w e r = R J F R _ t a r g e t _ u p p e r ; 
                         R J F R _ t a r g e t _ u p p e r = R J F R _ t a r g e t _ u p p e r + ( R J F R _ u n i t s * R J F R _ d e l t a ) ; 
                         P r i n t ( " F i x e d   R a t i o   M M :   U n i t s = > " , R J F R _ u n i t s , " ;   D e l t a = " , R J F R _ d e l t a , " ;   L o w e r   T a r g e t   E q u i t y = > " , R J F R _ t a r g e t _ l o w e r , " ;   U p p e r   T a r g e t   E q u i t y = > " , R J F R _ t a r g e t _ u p p e r ) ; 
                         i f   ( A c c o u n t E q u i t y ( ) < R J F R _ t a r g e t _ u p p e r )   { b r e a k ; } 
                   } 
             } 
             e l s e   i f   ( A c c o u n t E q u i t y ( ) < = R J F R _ t a r g e t _ l o w e r ) 
             { 
                   w h i l e ( t r u e )   { 
                   i f   ( A c c o u n t E q u i t y ( ) > R J F R _ t a r g e t _ l o w e r )   { b r e a k ; } 
                         i f   ( R J F R _ u n i t s > 1 )   {                   
                               P r i n t ( " F i x e d   R a t i o   M M   g o i n g   d o w n   t o   " , ( R J F R _ s t a r t _ l o t s * ( R J F R _ u n i t s - 1 ) ) , "   l o t s :   E q u i t y   i s   b e l o w   L o w e r   T a r g e t   E q u i t y   |   " ,   A c c o u n t E q u i t y ( ) , "   < =   " , R J F R _ t a r g e t _ l o w e r , " ) " ) ; 
                               R J F R _ t a r g e t _ u p p e r = R J F R _ t a r g e t _ l o w e r ; 
                               R J F R _ t a r g e t _ l o w e r = R J F R _ t a r g e t _ l o w e r - ( ( R J F R _ u n i t s - 1 ) * R J F R _ d e l t a ) ; 
                               R J F R _ u n i t s - - ; 
                               P r i n t ( " F i x e d   R a t i o   M M :   U n i t s = > " , R J F R _ u n i t s , " ;   D e l t a = " , R J F R _ d e l t a , " ;   L o w e r   T a r g e t   E q u i t y = > " , R J F R _ t a r g e t _ l o w e r , " ;   U p p e r   T a r g e t   E q u i t y = > " , R J F R _ t a r g e t _ u p p e r ) ; 
                         }   e l s e   { b r e a k ; } 
                   } 
             } 
             s i z e = R J F R _ s t a r t _ l o t s * R J F R _ u n i t s ; 
       } 
 	 	 
 	 i f   ( s i z e = = E M P T Y _ V A L U E )   { s i z e = 0 ; } 
       
       s t a t i c   b o o l   a l e r t _ m i n _ l o t s = f a l s e ; 
       i f   ( s i z e < M i n L o t s   & &   a l e r t _ m i n _ l o t s = = f a l s e )   { a l e r t _ m i n _ l o t s = t r u e ; 
             A l e r t ( " Y o u   w a n t   t o   t r a d e   " , s i z e , "   l o t ,   b u t   y o u r   b r o k e r ' s   m i n i m u m   i s   " , M i n L o t s , "   l o t .   T h e   t r a d e / o r d e r   w i l l   c o n t i n u e   w i t h   " , M i n L o t s , "   l o t   i n s t e a d   o f   " , s i z e , "   l o t .   T h e   s a m e   r u l e   w i l l   b e   a p p l i e d   f o r   n e x t   t r a d e s / o r d e r s   w i t h   d e s i r e d   l o t   s i z e   l o w e r   t h a n   t h e   m i n i m u m .   Y o u   w i l l   n o t   s e e   t h i s   m e s s a g e   a g a i n   u n t i l   y o u   r e s t a r t   t h e   p r o g r a m . " ) ; 
       } 
 
       s i z e = M a t h R o u n d ( s i z e / L o t S t e p ) * L o t S t e p ; 
       
       i f   ( a l i g n = = " a l i g n " )   { 
             i f   ( s i z e < M i n L o t s )   { s i z e = M i n L o t s ; } 
             i f   ( s i z e > M a x L o t s )   { s i z e = M a x L o t s ; } 
       } 
       
       r e t u r n   ( s i z e ) ; 
 }  
  
 s t r i n g   E r r o r M e s s a g e ( i n t   e r r o r _ c o d e = - 1 ) 
 { 
 	 s t r i n g   e   =   " " ; 
 	 i f   ( e r r o r _ c o d e < 0 )   { e r r o r _ c o d e = G e t L a s t E r r o r ( ) ; } 
 	 
 
 	 s w i t c h ( e r r o r _ c o d e ) 
 	 { 
 	 	 / / - - -   s u c c e s s 
 	 	 c a s e   0 :   r e t u r n ( " T h e   o p e r a t i o n   c o m p l e t e d   s u c c e s s f u l l y " ) ; 
 	 	 
 	 	 / / - - -   R u n t i m e 
 	 	 c a s e   4 0 0 1 :   e   =   " U n e x p e c t e d   i n t e r n a l   e r r o r " ;   b r e a k ; 
 	 	 c a s e   4 0 0 2 :   e   =   " W r o n g   p a r a m e t e r   i n   t h e   i n n e r   c a l l   o f   t h e   c l i e n t   t e r m i n a l   f u n c t i o n " ;   b r e a k ; 
 	 	 c a s e   4 0 0 3 :   e   =   " W r o n g   p a r a m e t e r   w h e n   c a l l i n g   t h e   s y s t e m   f u n c t i o n " ;   b r e a k ; 
 	 	 c a s e   4 0 0 4 :   e   =   " N o t   e n o u g h   m e m o r y   t o   p e r f o r m   t h e   s y s t e m   f u n c t i o n " ;   b r e a k ; 
 	 	 c a s e   4 0 0 5 :   e   =   " T h e   s t r u c t u r e   c o n t a i n s   o b j e c t s   o f   s t r i n g s   a n d / o r   d y n a m i c   a r r a y s   a n d / o r   s t r u c t u r e   o f   s u c h   o b j e c t s   a n d / o r   c l a s s e s " ;   b r e a k ; 
 	 	 c a s e   4 0 0 6 :   e   =   " A r r a y   o f   a   w r o n g   t y p e ,   w r o n g   s i z e ,   o r   a   d a m a g e d   o b j e c t   o f   a   d y n a m i c   a r r a y " ;   b r e a k ; 
 	 	 c a s e   4 0 0 7 :   e   =   " N o t   e n o u g h   m e m o r y   f o r   t h e   r e l o c a t i o n   o f   a n   a r r a y ,   o r   a n   a t t e m p t   t o   c h a n g e   t h e   s i z e   o f   a   s t a t i c   a r r a y " ;   b r e a k ; 
 	 	 c a s e   4 0 0 8 :   e   =   " N o t   e n o u g h   m e m o r y   f o r   t h e   r e l o c a t i o n   o f   s t r i n g " ;   b r e a k ; 
 	 	 c a s e   4 0 0 9 :   e   =   " N o t   i n i t i a l i z e d   s t r i n g " ;   b r e a k ; 
 	 	 c a s e   4 0 1 0 :   e   =   " I n v a l i d   d a t e   a n d / o r   t i m e " ;   b r e a k ; 
 	 	 c a s e   4 0 1 1 :   e   =   " R e q u e s t e d   a r r a y   s i z e   e x c e e d s   2   G B " ;   b r e a k ; 
 	 	 c a s e   4 0 1 2 :   e   =   " W r o n g   p o i n t e r " ;   b r e a k ; 
 	 	 c a s e   4 0 1 3 :   e   =   " W r o n g   t y p e   o f   p o i n t e r " ;   b r e a k ; 
 	 	 c a s e   4 0 1 4 :   e   =   " S y s t e m   f u n c t i o n   i s   n o t   a l l o w e d   t o   c a l l " ;   b r e a k ; 
 	 	 c a s e   4 0 1 5 :   e   =   " T h e   n a m e s   o f   t h e   d y n a m i c   a n d   t h e   s t a t i c   r e s o u r c e   m a t c h " ;   b r e a k ; 
 	 	 c a s e   4 0 1 6 :   e   =   " R e s o u r c e   w i t h   t h i s   n a m e   h a s   n o t   b e e n   f o u n d   i n   E X 5 " ;   b r e a k ; 
 	 	 c a s e   4 0 1 7 :   e   =   " U n s u p p o r t e d   r e s o u r c e   t y p e   o r   i t s   s i z e   e x c e e d s   1 6   M b " ;   b r e a k ; 
 	 	 c a s e   4 0 1 8 :   e   =   " T h e   r e s o u r c e   n a m e   e x c e e d s   6 3   c h a r a c t e r s " ;   b r e a k ; 
 	 	 
 	 	 / / - -   C h a r t s 
 	 	 c a s e   4 1 0 1 :   e   =   " W r o n g   c h a r t   I D " ;   b r e a k ; 
 	 	 c a s e   4 1 0 2 :   e   =   " C h a r t   d o e s   n o t   r e s p o n d " ;   b r e a k ; 
 	 	 c a s e   4 1 0 3 :   e   =   " C h a r t   n o t   f o u n d " ;   b r e a k ; 
 	 	 c a s e   4 1 0 4 :   e   =   " N o   E x p e r t   A d v i s o r   i n   t h e   c h a r t   t h a t   c o u l d   h a n d l e   t h e   e v e n t " ;   b r e a k ; 
 	 	 c a s e   4 1 0 5 :   e   =   " C h a r t   o p e n i n g   e r r o r " ;   b r e a k ; 
 	 	 c a s e   4 1 0 6 :   e   =   " F a i l e d   t o   c h a n g e   c h a r t   s y m b o l   a n d   p e r i o d " ;   b r e a k ; 
 	 	 c a s e   4 1 0 7 :   e   =   " W r o n g   p a r a m e t e r   f o r   t i m e r " ;   b r e a k ; 
 	 	 c a s e   4 1 0 8 :   e   =   " F a i l e d   t o   c r e a t e   t i m e r " ;   b r e a k ; 
 	 	 c a s e   4 1 0 9 :   e   =   " W r o n g   c h a r t   p r o p e r t y   I D " ;   b r e a k ; 
 	 	 c a s e   4 1 1 0 :   e   =   " E r r o r   c r e a t i n g   s c r e e n s h o t s " ;   b r e a k ; 
 	 	 c a s e   4 1 1 1 :   e   =   " E r r o r   n a v i g a t i n g   t h r o u g h   c h a r t " ;   b r e a k ; 
 	 	 c a s e   4 1 1 2 :   e   =   " E r r o r   a p p l y i n g   t e m p l a t e " ;   b r e a k ; 
 	 	 c a s e   4 1 1 3 :   e   =   " S u b w i n d o w   c o n t a i n i n g   t h e   i n d i c a t o r   w a s   n o t   f o u n d " ;   b r e a k ; 
 	 	 c a s e   4 1 1 4 :   e   =   " E r r o r   a d d i n g   a n   i n d i c a t o r   t o   c h a r t " ;   b r e a k ; 
 	 	 c a s e   4 1 1 5 :   e   =   " E r r o r   d e l e t i n g   a n   i n d i c a t o r   f r o m   t h e   c h a r t " ;   b r e a k ; 
 	 	 c a s e   4 1 1 6 :   e   =   " I n d i c a t o r   n o t   f o u n d   o n   t h e   s p e c i f i e d   c h a r t " ;   b r e a k ; 
 
 	 	 / / - -   G r a p h i c a l   O b j e c t s 
 	 	 c a s e   4 2 0 1 :   e   =   " E r r o r   w o r k i n g   w i t h   a   g r a p h i c a l   o b j e c t " ;   b r e a k ; 
 	 	 c a s e   4 2 0 2 :   e   =   " G r a p h i c a l   o b j e c t   w a s   n o t   f o u n d " ;   b r e a k ; 
 	 	 c a s e   4 2 0 3 :   e   =   " W r o n g   I D   o f   a   g r a p h i c a l   o b j e c t   p r o p e r t y " ;   b r e a k ; 
 	 	 c a s e   4 2 0 4 :   e   =   " U n a b l e   t o   g e t   d a t e   c o r r e s p o n d i n g   t o   t h e   v a l u e " ;   b r e a k ; 
 	 	 c a s e   4 2 0 5 :   e   =   " U n a b l e   t o   g e t   v a l u e   c o r r e s p o n d i n g   t o   t h e   d a t e " ;   b r e a k ; 
 
 	 	 / / - -   M a r k e t   I n f o 
 	 	 c a s e   4 3 0 1 :   e   =   " U n k n o w n   s y m b o l " ;   b r e a k ; 
 	 	 c a s e   4 3 0 2 :   e   =   " S y m b o l   i s   n o t   s e l e c t e d   i n   M a r k e t W a t c h " ;   b r e a k ; 
 	 	 c a s e   4 3 0 3 :   e   =   " W r o n g   i d e n t i f i e r   o f   a   s y m b o l   p r o p e r t y " ;   b r e a k ; 
 	 	 c a s e   4 3 0 4 :   e   =   " T i m e   o f   t h e   l a s t   t i c k   i s   n o t   k n o w n   ( n o   t i c k s ) " ;   b r e a k ; 
 	 	 c a s e   4 3 0 5 :   e   =   " E r r o r   a d d i n g   o r   d e l e t i n g   a   s y m b o l   i n   M a r k e t W a t c h " ;   b r e a k ; 
 
 	 	 / / - -   H i s t o r y   A c c e s s 
 	 	 c a s e   4 4 0 1 :   e   =   " R e q u e s t e d   h i s t o r y   n o t   f o u n d " ;   b r e a k ; 
 	 	 c a s e   4 4 0 2 :   e   =   " W r o n g   I D   o f   t h e   h i s t o r y   p r o p e r t y " ;   b r e a k ; 
 
 	 	 / / - -   G l o b a l   V a r i a b l e s 
 	 	 c a s e   4 5 0 1 :   e   =   " G l o b a l   v a r i a b l e   o f   t h e   c l i e n t   t e r m i n a l   i s   n o t   f o u n d " ;   b r e a k ; 
 	 	 c a s e   4 5 0 2 :   e   =   " G l o b a l   v a r i a b l e   o f   t h e   c l i e n t   t e r m i n a l   w i t h   t h e   s a m e   n a m e   a l r e a d y   e x i s t s " ;   b r e a k ; 
 	 	 c a s e   4 5 1 0 :   e   =   " E m a i l   s e n d i n g   f a i l e d " ;   b r e a k ; 
 	 	 c a s e   4 5 1 1 :   e   =   " S o u n d   p l a y i n g   f a i l e d " ;   b r e a k ; 
 	 	 c a s e   4 5 1 2 :   e   =   " W r o n g   i d e n t i f i e r   o f   t h e   p r o g r a m   p r o p e r t y " ;   b r e a k ; 
 	 	 c a s e   4 5 1 3 :   e   =   " W r o n g   i d e n t i f i e r   o f   t h e   t e r m i n a l   p r o p e r t y " ;   b r e a k ; 
 	 	 c a s e   4 5 1 4 :   e   =   " F i l e   s e n d i n g   v i a   f t p   f a i l e d " ;   b r e a k ; 
 	 	 c a s e   4 5 1 5 :   e   =   " F a i l e d   t o   s e n d   a   n o t i f i c a t i o n " ;   b r e a k ; 
 	 	 c a s e   4 5 1 6 :   e   =   " I n v a l i d   p a r a m e t e r   f o r   s e n d i n g   a   n o t i f i c a t i o n   -   a n   e m p t y   s t r i n g   o r   N U L L   h a s   b e e n   p a s s e d   t o   t h e   S e n d N o t i f i c a t i o n ( )   f u n c t i o n " ;   b r e a k ; 
 	 	 c a s e   4 5 1 7 :   e   =   " W r o n g   s e t t i n g s   o f   n o t i f i c a t i o n s   i n   t h e   t e r m i n a l   ( I D   i s   n o t   s p e c i f i e d   o r   p e r m i s s i o n   i s   n o t   s e t ) " ;   b r e a k ; 
 	 	 c a s e   4 5 1 8 :   e   =   " T o o   f r e q u e n t   s e n d i n g   o f   n o t i f i c a t i o n s " ;   b r e a k ; 
 
 	 	 / / - -   C u s t o m   I n d i c a t o r   B u f f e r s 
 	 	 c a s e   4 6 0 1 :   e   =   " N o t   e n o u g h   m e m o r y   f o r   t h e   d i s t r i b u t i o n   o f   i n d i c a t o r   b u f f e r s " ;   b r e a k ; 
 	 	 c a s e   4 6 0 2 :   e   =   " W r o n g   i n d i c a t o r   b u f f e r   i n d e x " ;   b r e a k ; 
 
 	 	 / / - -   C u s t o m   I n d i c a t o r   P r o p e r t i e s 
 	 	 c a s e   4 6 0 3 :   e   =   " W r o n g   I D   o f   t h e   c u s t o m   i n d i c a t o r   p r o p e r t y " ;   b r e a k ; 
 
 	 	 / / - -   A c c o u n t 
 	 	 c a s e   4 7 0 1 :   e   =   " W r o n g   a c c o u n t   p r o p e r t y   I D " ;   b r e a k ; 
 	 	 c a s e   4 7 5 1 :   e   =   " W r o n g   t r a d e   p r o p e r t y   I D " ;   b r e a k ; 
 	 	 c a s e   4 7 5 2 :   e   =   " T r a d i n g   b y   E x p e r t   A d v i s o r s   p r o h i b i t e d " ;   b r e a k ; 
 	 	 c a s e   4 7 5 3 :   e   =   " P o s i t i o n   n o t   f o u n d " ;   b r e a k ; 
 	 	 c a s e   4 7 5 4 :   e   =   " O r d e r   n o t   f o u n d " ;   b r e a k ; 
 	 	 c a s e   4 7 5 5 :   e   =   " D e a l   n o t   f o u n d " ;   b r e a k ; 
 	 	 c a s e   4 7 5 6 :   e   =   " T r a d e   r e q u e s t   s e n d i n g   f a i l e d " ;   b r e a k ; 
 
 	 	 / / - -   I n d i c a t o r s 
 	 	 c a s e   4 8 0 1 :   e   =   " U n k n o w n   s y m b o l " ;   b r e a k ; 
 	 	 c a s e   4 8 0 2 :   e   =   " I n d i c a t o r   c a n n o t   b e   c r e a t e d " ;   b r e a k ; 
 	 	 c a s e   4 8 0 3 :   e   =   " N o t   e n o u g h   m e m o r y   t o   a d d   t h e   i n d i c a t o r " ;   b r e a k ; 
 	 	 c a s e   4 8 0 4 :   e   =   " T h e   i n d i c a t o r   c a n n o t   b e   a p p l i e d   t o   a n o t h e r   i n d i c a t o r " ;   b r e a k ; 
 	 	 c a s e   4 8 0 5 :   e   =   " E r r o r   a p p l y i n g   a n   i n d i c a t o r   t o   c h a r t " ;   b r e a k ; 
 	 	 c a s e   4 8 0 6 :   e   =   " R e q u e s t e d   d a t a   n o t   f o u n d " ;   b r e a k ; 
 	 	 c a s e   4 8 0 7 :   e   =   " W r o n g   i n d i c a t o r   h a n d l e " ;   b r e a k ; 
 	 	 c a s e   4 8 0 8 :   e   =   " W r o n g   n u m b e r   o f   p a r a m e t e r s   w h e n   c r e a t i n g   a n   i n d i c a t o r " ;   b r e a k ; 
 	 	 c a s e   4 8 0 9 :   e   =   " N o   p a r a m e t e r s   w h e n   c r e a t i n g   a n   i n d i c a t o r " ;   b r e a k ; 
 	 	 c a s e   4 8 1 0 :   e   =   " T h e   f i r s t   p a r a m e t e r   i n   t h e   a r r a y   m u s t   b e   t h e   n a m e   o f   t h e   c u s t o m   i n d i c a t o r " ;   b r e a k ; 
 	 	 c a s e   4 8 1 1 :   e   =   " I n v a l i d   p a r a m e t e r   t y p e   i n   t h e   a r r a y   w h e n   c r e a t i n g   a n   i n d i c a t o r " ;   b r e a k ; 
 	 	 c a s e   4 8 1 2 :   e   =   " W r o n g   i n d e x   o f   t h e   r e q u e s t e d   i n d i c a t o r   b u f f e r " ;   b r e a k ; 
 
 	 	 / / - -   D e p t h   o f   M a r k e t 
 	 	 c a s e   4 9 0 1 :   e   =   " D e p t h   O f   M a r k e t   c a n   n o t   b e   a d d e d " ;   b r e a k ; 
 	 	 c a s e   4 9 0 2 :   e   =   " D e p t h   O f   M a r k e t   c a n   n o t   b e   r e m o v e d " ;   b r e a k ; 
 	 	 c a s e   4 9 0 3 :   e   =   " T h e   d a t a   f r o m   D e p t h   O f   M a r k e t   c a n   n o t   b e   o b t a i n e d " ;   b r e a k ; 
 	 	 c a s e   4 9 0 4 :   e   =   " E r r o r   i n   s u b s c r i b i n g   t o   r e c e i v e   n e w   d a t a   f r o m   D e p t h   O f   M a r k e t " ;   b r e a k ; 
 
 	 	 / / - -   F i l e   O p e r a t i o n s 
 	 	 c a s e   5 0 0 1 :   e   =   " M o r e   t h a n   6 4   f i l e s   c a n n o t   b e   o p e n e d   a t   t h e   s a m e   t i m e " ;   b r e a k ; 
 	 	 c a s e   5 0 0 2 :   e   =   " I n v a l i d   f i l e   n a m e " ;   b r e a k ; 
 	 	 c a s e   5 0 0 3 :   e   =   " T o o   l o n g   f i l e   n a m e " ;   b r e a k ; 
 	 	 c a s e   5 0 0 4 :   e   =   " F i l e   o p e n i n g   e r r o r " ;   b r e a k ; 
 	 	 c a s e   5 0 0 5 :   e   =   " N o t   e n o u g h   m e m o r y   f o r   c a c h e   t o   r e a d " ;   b r e a k ; 
 	 	 c a s e   5 0 0 6 :   e   =   " F i l e   d e l e t i n g   e r r o r " ;   b r e a k ; 
 	 	 c a s e   5 0 0 7 :   e   =   " A   f i l e   w i t h   t h i s   h a n d l e   w a s   c l o s e d ,   o r   w a s   n o t   o p e n i n g   a t   a l l " ;   b r e a k ; 
 	 	 c a s e   5 0 0 8 :   e   =   " W r o n g   f i l e   h a n d l e " ;   b r e a k ; 
 	 	 c a s e   5 0 0 9 :   e   =   " T h e   f i l e   m u s t   b e   o p e n e d   f o r   w r i t i n g " ;   b r e a k ; 
 	 	 c a s e   5 0 1 0 :   e   =   " T h e   f i l e   m u s t   b e   o p e n e d   f o r   r e a d i n g " ;   b r e a k ; 
 	 	 c a s e   5 0 1 1 :   e   =   " T h e   f i l e   m u s t   b e   o p e n e d   a s   a   b i n a r y   o n e " ;   b r e a k ; 
 	 	 c a s e   5 0 1 2 :   e   =   " T h e   f i l e   m u s t   b e   o p e n e d   a s   a   t e x t " ;   b r e a k ; 
 	 	 c a s e   5 0 1 3 :   e   =   " T h e   f i l e   m u s t   b e   o p e n e d   a s   a   t e x t   o r   C S V " ;   b r e a k ; 
 	 	 c a s e   5 0 1 4 :   e   =   " T h e   f i l e   m u s t   b e   o p e n e d   a s   C S V " ;   b r e a k ; 
 	 	 c a s e   5 0 1 5 :   e   =   " F i l e   r e a d i n g   e r r o r " ;   b r e a k ; 
 	 	 c a s e   5 0 1 6 :   e   =   " S t r i n g   s i z e   m u s t   b e   s p e c i f i e d ,   b e c a u s e   t h e   f i l e   i s   o p e n e d   a s   b i n a r y " ;   b r e a k ; 
 	 	 c a s e   5 0 1 7 :   e   =   " A   t e x t   f i l e   m u s t   b e   f o r   s t r i n g   a r r a y s ,   f o r   o t h e r   a r r a y s   -   b i n a r y " ;   b r e a k ; 
 	 	 c a s e   5 0 1 8 :   e   =   " T h i s   i s   n o t   a   f i l e ,   t h i s   i s   a   d i r e c t o r y " ;   b r e a k ; 
 	 	 c a s e   5 0 1 9 :   e   =   " F i l e   d o e s   n o t   e x i s t " ;   b r e a k ; 
 	 	 c a s e   5 0 2 0 :   e   =   " F i l e   c a n   n o t   b e   r e w r i t t e n " ;   b r e a k ; 
 	 	 c a s e   5 0 2 1 :   e   =   " W r o n g   d i r e c t o r y   n a m e " ;   b r e a k ; 
 	 	 c a s e   5 0 2 2 :   e   =   " D i r e c t o r y   d o e s   n o t   e x i s t " ;   b r e a k ; 
 	 	 c a s e   5 0 2 3 :   e   =   " T h i s   i s   a   f i l e ,   n o t   a   d i r e c t o r y " ;   b r e a k ; 
 	 	 c a s e   5 0 2 4 :   e   =   " T h e   d i r e c t o r y   c a n n o t   b e   r e m o v e d " ;   b r e a k ; 
 	 	 c a s e   5 0 2 5 :   e   =   " F a i l e d   t o   c l e a r   t h e   d i r e c t o r y   ( p r o b a b l y   o n e   o r   m o r e   f i l e s   a r e   b l o c k e d   a n d   r e m o v a l   o p e r a t i o n   f a i l e d ) " ;   b r e a k ; 
 	 	 c a s e   5 0 2 6 :   e   =   " F a i l e d   t o   w r i t e   a   r e s o u r c e   t o   a   f i l e " ;   b r e a k ; 
 
 	 	 / / - -   S t r i n g   C a s t i n g 
 	 	 c a s e   5 0 3 0 :   e   =   " N o   d a t e   i n   t h e   s t r i n g " ;   b r e a k ; 
 	 	 c a s e   5 0 3 1 :   e   =   " W r o n g   d a t e   i n   t h e   s t r i n g " ;   b r e a k ; 
 	 	 c a s e   5 0 3 2 :   e   =   " W r o n g   t i m e   i n   t h e   s t r i n g " ;   b r e a k ; 
 	 	 c a s e   5 0 3 3 :   e   =   " E r r o r   c o n v e r t i n g   s t r i n g   t o   d a t e " ;   b r e a k ; 
 	 	 c a s e   5 0 3 4 :   e   =   " N o t   e n o u g h   m e m o r y   f o r   t h e   s t r i n g " ;   b r e a k ; 
 	 	 c a s e   5 0 3 5 :   e   =   " T h e   s t r i n g   l e n g t h   i s   l e s s   t h a n   e x p e c t e d " ;   b r e a k ; 
 	 	 c a s e   5 0 3 6 :   e   =   " T o o   l a r g e   n u m b e r ,   m o r e   t h a n   U L O N G _ M A X " ;   b r e a k ; 
 	 	 c a s e   5 0 3 7 :   e   =   " I n v a l i d   f o r m a t   s t r i n g " ;   b r e a k ; 
 	 	 c a s e   5 0 3 8 :   e   =   " A m o u n t   o f   f o r m a t   s p e c i f i e r s   m o r e   t h a n   t h e   p a r a m e t e r s " ;   b r e a k ; 
 	 	 c a s e   5 0 3 9 :   e   =   " A m o u n t   o f   p a r a m e t e r s   m o r e   t h a n   t h e   f o r m a t   s p e c i f i e r s " ;   b r e a k ; 
 	 	 c a s e   5 0 4 0 :   e   =   " D a m a g e d   p a r a m e t e r   o f   s t r i n g   t y p e " ;   b r e a k ; 
 	 	 c a s e   5 0 4 1 :   e   =   " P o s i t i o n   o u t s i d e   t h e   s t r i n g " ;   b r e a k ; 
 	 	 c a s e   5 0 4 2 :   e   =   " 0   a d d e d   t o   t h e   s t r i n g   e n d ,   a   u s e l e s s   o p e r a t i o n " ;   b r e a k ; 
 	 	 c a s e   5 0 4 3 :   e   =   " U n k n o w n   d a t a   t y p e   w h e n   c o n v e r t i n g   t o   a   s t r i n g " ;   b r e a k ; 
 	 	 c a s e   5 0 4 4 :   e   =   " D a m a g e d   s t r i n g   o b j e c t " ;   b r e a k ; 
 
 	 	 / / - -   O p e r a t i o n s   w i t h   A r r a y s 
 	 	 c a s e   5 0 5 0 :   e   =   " C o p y i n g   i n c o m p a t i b l e   a r r a y s .   S t r i n g   a r r a y   c a n   b e   c o p i e d   o n l y   t o   a   s t r i n g   a r r a y ,   a n d   a   n u m e r i c   a r r a y   -   i n   n u m e r i c   a r r a y   o n l y " ;   b r e a k ; 
 	 	 c a s e   5 0 5 1 :   e   =   " T h e   r e c e i v i n g   a r r a y   i s   d e c l a r e d   a s   A S _ S E R I E S ,   a n d   i t   i s   o f   i n s u f f i c i e n t   s i z e " ;   b r e a k ; 
 	 	 c a s e   5 0 5 2 :   e   =   " T o o   s m a l l   a r r a y ,   t h e   s t a r t i n g   p o s i t i o n   i s   o u t s i d e   t h e   a r r a y " ;   b r e a k ; 
 	 	 c a s e   5 0 5 3 :   e   =   " A n   a r r a y   o f   z e r o   l e n g t h " ;   b r e a k ; 
 	 	 c a s e   5 0 5 4 :   e   =   " M u s t   b e   a   n u m e r i c   a r r a y " ;   b r e a k ; 
 	 	 c a s e   5 0 5 5 :   e   =   " M u s t   b e   a   o n e - d i m e n s i o n a l   a r r a y " ;   b r e a k ; 
 	 	 c a s e   5 0 5 6 :   e   =   " T i m e s e r i e s   c a n n o t   b e   u s e d " ;   b r e a k ; 
 	 	 c a s e   5 0 5 7 :   e   =   " M u s t   b e   a n   a r r a y   o f   t y p e   d o u b l e " ;   b r e a k ; 
 	 	 c a s e   5 0 5 8 :   e   =   " M u s t   b e   a n   a r r a y   o f   t y p e   f l o a t " ;   b r e a k ; 
 	 	 c a s e   5 0 5 9 :   e   =   " M u s t   b e   a n   a r r a y   o f   t y p e   l o n g " ;   b r e a k ; 
 	 	 c a s e   5 0 6 0 :   e   =   " M u s t   b e   a n   a r r a y   o f   t y p e   i n t " ;   b r e a k ; 
 	 	 c a s e   5 0 6 1 :   e   =   " M u s t   b e   a n   a r r a y   o f   t y p e   s h o r t " ;   b r e a k ; 
 	 	 c a s e   5 0 6 2 :   e   =   " M u s t   b e   a n   a r r a y   o f   t y p e   c h a r " ;   b r e a k ; 
 	 	 
 	 	 / / - -   O p e r a t i o n s   w i t h   O p e n C L 
 	 	 c a s e   5 1 0 0 :   e   =   " O p e n C L   f u n c t i o n s   a r e   n o t   s u p p o r t e d   o n   t h i s   c o m p u t e r " ;   b r e a k ; 
 	 	 c a s e   5 1 0 1 :   e   =   " I n t e r n a l   e r r o r   o c c u r r e d   w h e n   r u n n i n g   O p e n C L " ;   b r e a k ; 
 	 	 c a s e   5 1 0 2 :   e   =   " I n v a l i d   O p e n C L   h a n d l e " ;   b r e a k ; 
 	 	 c a s e   5 1 0 3 :   e   =   " E r r o r   c r e a t i n g   t h e   O p e n C L   c o n t e x t " ;   b r e a k ; 
 	 	 c a s e   5 1 0 4 :   e   =   " F a i l e d   t o   c r e a t e   a   r u n   q u e u e   i n   O p e n C L " ;   b r e a k ; 
 	 	 c a s e   5 1 0 5 :   e   =   " E r r o r   o c c u r r e d   w h e n   c o m p i l i n g   a n   O p e n C L   p r o g r a m " ;   b r e a k ; 
 	 	 c a s e   5 1 0 6 :   e   =   " T o o   l o n g   k e r n e l   n a m e   ( O p e n C L   k e r n e l ) " ;   b r e a k ; 
 	 	 c a s e   5 1 0 7 :   e   =   " E r r o r   c r e a t i n g   a n   O p e n C L   k e r n e l " ;   b r e a k ; 
 	 	 c a s e   5 1 0 8 :   e   =   " E r r o r   o c c u r r e d   w h e n   s e t t i n g   p a r a m e t e r s   f o r   t h e   O p e n C L   k e r n e l " ;   b r e a k ; 
 	 	 c a s e   5 1 0 9 :   e   =   " O p e n C L   p r o g r a m   r u n t i m e   e r r o r " ;   b r e a k ; 
 	 	 c a s e   5 1 1 0 :   e   =   " I n v a l i d   s i z e   o f   t h e   O p e n C L   b u f f e r " ;   b r e a k ; 
 	 	 c a s e   5 1 1 1 :   e   =   " I n v a l i d   o f f s e t   i n   t h e   O p e n C L   b u f f e r " ;   b r e a k ; 
 	 	 c a s e   5 1 1 2 :   e   =   " F a i l e d   t o   c r e a t e   a n   O p e n C L   b u f f e r " ;   b r e a k ; 
 	 	 
 	 	 / / - -   O p e r a t i o n s   w i t h   W e b R e q u e s t 
 	 	 c a s e   5 2 0 0 :   e   =   " I n v a l i d   U R L " ;   b r e a k ; 
 	 	 c a s e   5 2 0 1 :   e   =   " F a i l e d   t o   c o n n e c t   t o   s p e c i f i e d   U R L " ;   b r e a k ; 
 	 	 c a s e   5 2 0 2 :   e   =   " T i m e o u t   e x c e e d e d " ;   b r e a k ; 
 	 	 c a s e   5 2 0 3 :   e   =   " H T T P   r e q u e s t   f a i l e d " ;   b r e a k ; 
 
 	 	 / / - -   t r a d i n g   e r r o r s 
 	 	 c a s e   1 0 0 0 4 :   e   =   " R e q u o t e   o c c u r e d " ;   b r e a k ; 
 	 	 c a s e   1 0 0 0 6 :   e   =   " O r d e r   i s   n o t   a c c e p t e d   b y   t h e   s e r v e r " ;   b r e a k ; 
 	 	 c a s e   1 0 0 0 7 :   e   =   " R e q u e s t   c a n c e l e d   b y   t r a d e r " ;   b r e a k ; 
 	 	 c a s e   1 0 0 1 0 :   e   =   " O n l y   p a r t   o f   t h e   r e q u e s t   w a s   c o m p l e t e d " ;   b r e a k ; 
 	 	 c a s e   1 0 0 1 1 :   e   =   " R e q u e s t   p r o c e s s i n g   e r r o r " ;   b r e a k ; 
 	 	 c a s e   1 0 0 1 2 :   e   =   " R e q u e s t   c a n c e l e d   b y   t i m e o u t " ;   b r e a k ; 
 	 	 c a s e   1 0 0 1 3 :   e   =   " I n v a l i d   r e q u e s t " ;   b r e a k ; 
 	 	 c a s e   1 0 0 1 4 :   e   =   " I n v a l i d   v o l u m e " ;   b r e a k ; 
 	 	 c a s e   1 0 0 1 5 :   e   =   " I n v a l i d   p r i c e " ;   b r e a k ; 
 	 	 c a s e   1 0 0 1 6 :   e   =   " I n v a l i d   S L   o r   T P " ;   b r e a k ; 
 	 	 c a s e   1 0 0 1 7 :   e   =   " T r a d i n g   i s   d i s a b l e d " ;   b r e a k ; 
 	 	 c a s e   1 0 0 1 8 :   e   =   " M a r k e t   i s   c l o s e d " ;   b r e a k ; 
 	 	 c a s e   1 0 0 1 9 :   e   =   " N o t   e n o u g h   m o n e y   t o   t r a d e " ;   b r e a k ; 
 	 	 c a s e   1 0 0 2 0 :   e   =   " P r i c e s   c h a n g e d " ;   b r e a k ; 
 	 	 c a s e   1 0 0 2 1 :   e   =   " T h e r e   a r e   n o   q u o t e s   t o   p r o c e s s   t h e   r e q u e s t " ;   b r e a k ; 
 	 	 c a s e   1 0 0 2 2 :   e   =   " I n v a l i d   e x p i r a t i o n   d a t e   i n   t h e   o r d e r   r e q u e s t " ;   b r e a k ; 
 	 	 c a s e   1 0 0 2 3 :   e   =   " O r d e r   s t a t e   c h a n g e d " ;   b r e a k ; 
 	 	 c a s e   1 0 0 2 4 :   e   =   " T o o   f r e q u e n t   r e q u e s t s " ;   b r e a k ; 
 	 	 c a s e   1 0 0 2 5 :   e   =   " N o   c h a n g e s   i n   r e q u e s t " ;   b r e a k ; 
 	 	 c a s e   1 0 0 2 6 :   e   =   " A u t o t r a d i n g   i s   d i s a b l e d   b y   t h e   s e r v e r " ;   b r e a k ; 
 	 	 c a s e   1 0 0 2 7 :   e   =   " A u t o t r a d i n g   i s   d i s a b l e d   b y   t h e   c l i e n t   t e r m i n a l " ;   b r e a k ; 
 	 	 c a s e   1 0 0 2 8 :   e   =   " R e q u e s t   l o c k e d   f o r   p r o c e s s i n g " ;   b r e a k ; 
 	 	 c a s e   1 0 0 2 9 :   e   =   " O r d e r   o r   t r a d e   f r o z e n " ;   b r e a k ; 
 	 	 c a s e   1 0 0 3 0 :   e   =   " I n v a l i d   o r d e r   f i l l i n g   t y p e " ;   b r e a k ; 
 	 	 c a s e   1 0 0 3 1 :   e   =   " N o   c o n n e c t i o n   w i t h   t h e   t r a d e   s e r v e r " ;   b r e a k ; 
 	 	 c a s e   1 0 0 3 2 :   e   =   " O p e r a t i o n   i s   a l l o w e d   o n l y   f o r   l i v e   a c c o u n t s " ;   b r e a k ; 
 	 	 c a s e   1 0 0 3 3 :   e   =   " T h e   n u m b e r   o f   p e n d i n g   o r d e r s   h a s   r e a c h e d   t h e   l i m i t " ;   b r e a k ; 
 	 	 c a s e   1 0 0 3 4 :   e   =   " T h e   v o l u m e   o f   o r d e r s   a n d   t r a d e s   f o r   t h e   s y m b o l   h a s   r e a c h e d   t h e   l i m i t " ;   b r e a k ; 
 	 	 c a s e   1 0 0 3 5 :   e   =   " I n c o r r e c t   o r   p r o h i b i t e d   o r d e r   t y p e " ;   b r e a k ; 
 	 	 c a s e   1 0 0 3 6 :   e   =   " P o s i t i o n   w i t h   t h e   s p e c i f i e d   P O S I T I O N _ I D E N T I F I E R   h a s   a l r e a d y   b e e n   c l o s e d " ;   b r e a k ; 
 	 	 / / - -   U s e r - D e f i n e d   E r r o r s 
 	 	 c a s e   6 5 5 3 6 :   e   =   " U s e r   d e f i n e d   e r r o r s " ;   b r e a k ; 
 	 	 d e f a u l t : 	 e   =   " U n k n o w n   e r r o r " ; 
 	 } 
 
 	 S t r i n g C o n c a t e n a t e ( e ,   e , "   ( " , e r r o r _ c o d e , " ) " ) ; 
 	 
 	 r e t u r n   e ; 
 }  
  
 b o o l   F i l t e r O r d e r B y ( s t r i n g   g r o u p _ m o d e = " a l l " ,   s t r i n g   g r o u p = " 0 " ,   s t r i n g   m a r k e t _ m o d e = " a l l " ,   s t r i n g   m a r k e t = " " ,   s t r i n g   B u y s O r S e l l s = " b o t h " ,   s t r i n g   L i m i t s O r S t o p s = " " ,   i n t   u n u s e d   =   0 ,   b o o l   o n T r a d e   =   f a l s e ) 
 { 
 	 / / - -   d b 
 	 s t a t i c   s t r i n g   m a r k e t s [ ] ; 
 	 s t a t i c   s t r i n g   m a r k e t 0 	 =   " - " ; 
 	 s t a t i c   i n t   m a r k e t s _ s i z e   =   0 ; 
 	 
 	 s t a t i c   s t r i n g   g r o u p s [ ] ; 
 	 s t a t i c   s t r i n g   g r o u p 0 	 =   " - " ; 
 	 s t a t i c   i n t   g r o u p s _ s i z e   =   0 ; 
 	 
 	 / / - -   l o c a l   v a r i a b l e s 
 	 b o o l   t y p e _ p a s s 	 =   f a l s e ; 
 	 b o o l   m a r k e t _ p a s s   =   f a l s e ; 
 	 b o o l   g r o u p _ p a s s     =   f a l s e ; 
 
 	 i n t   i ; 
 	 l o n g   t y p e ; 
 	 u l o n g   m a g i c _ n u m b e r ; 
 	 s t r i n g   s y m b o l ; 
 	 
 	 / /   T r a d e s 
 	 i f   ( o n T r a d e   = =   f a l s e )   { 
 	 	 t y p e   =   O r d e r T y p e ( ) ; 
 	 	 m a g i c _ n u m b e r   =   O r d e r M a g i c N u m b e r ( ) ; 
 	 	 s y m b o l   =   O r d e r S y m b o l ( ) ; 
 	 } 
 	 e l s e   { 
 	 	 t y p e   =   e _ a t t r T y p e ( ) ; 
 	 	 m a g i c _ n u m b e r   =   e _ a t t r M a g i c N u m b e r ( ) ; 
 	 	 s y m b o l   =   e _ a t t r S y m b o l ( ) ; 
 	 } 
 	 
 	 / /   T r a d e s   & &   H i s t o r y   t r a d e s 
 	 i f   ( L i m i t s O r S t o p s = = " " ) 
 	 { 
 	 	 i f   ( 
 	 	 	 	 ( B u y s O r S e l l s = = " b o t h "     & &   ( t y p e = = O R D E R _ T Y P E _ B U Y   | |   t y p e = = O R D E R _ T Y P E _ S E L L ) ) 
 	 	 	 | |   ( B u y s O r S e l l s = = " b u y s "     & &   t y p e = = O R D E R _ T Y P E _ B U Y ) 
 	 	 	 | |   ( B u y s O r S e l l s = = " s e l l s "   & &   t y p e = = O R D E R _ T Y P E _ S E L L ) 
 	 	 	 ) 
 	 	 { 
 	 	 	 t y p e _ p a s s   =   t r u e ; 
 	 	 } 
 	 } 
 	 / /   P e n d i n g   o r d e r s 
 	 e l s e 
 	 { 
 	 	 t y p e   =   O r d e r G e t I n t e g e r ( O R D E R _ T Y P E ) ; 
 	 	 i f   ( 
 	 	 	 	 ( B u y s O r S e l l s = = " b o t h "   & &   ( t y p e = = O R D E R _ T Y P E _ B U Y _ L I M I T   | |   t y p e = = O R D E R _ T Y P E _ B U Y _ S T O P   | |   t y p e = = O R D E R _ T Y P E _ S E L L _ L I M I T   | |   t y p e = = O R D E R _ T Y P E _ S E L L _ S T O P ) ) 
 	 	 	 | | 	 ( B u y s O r S e l l s = = " b u y s "   & &   ( t y p e = = O R D E R _ T Y P E _ B U Y _ L I M I T   | |   t y p e = = O R D E R _ T Y P E _ B U Y _ S T O P ) ) 
 	 	 	 | |   ( B u y s O r S e l l s = = " s e l l s "   & &   ( t y p e = = O R D E R _ T Y P E _ S E L L _ L I M I T   | |   t y p e = = O R D E R _ T Y P E _ S E L L _ S T O P ) ) 
 	 	 	 ) 
 	 	 { 
 	 	 	 i f   ( 
 	 	 	 	 	 ( L i m i t s O r S t o p s = = " b o t h "   & &   ( t y p e = = O R D E R _ T Y P E _ B U Y _ S T O P   | |   t y p e = = O R D E R _ T Y P E _ S E L L _ S T O P   | |   t y p e = = O R D E R _ T Y P E _ B U Y _ L I M I T   | |   t y p e = = O R D E R _ T Y P E _ S E L L _ L I M I T ) ) 
 	 	 	 	 | | 	 ( L i m i t s O r S t o p s = = " s t o p s "   & &   ( t y p e = = O R D E R _ T Y P E _ B U Y _ S T O P   | |   t y p e = = O R D E R _ T Y P E _ S E L L _ S T O P ) ) 
 	 	 	 	 | |   ( L i m i t s O r S t o p s = = " l i m i t s "   & &   ( t y p e = = O R D E R _ T Y P E _ B U Y _ L I M I T   | |   t y p e = = O R D E R _ T Y P E _ S E L L _ L I M I T ) ) 	 
 	 	 	 	 ) 
 	 	 	 { 
 	 	 	 	 t y p e _ p a s s   =   t r u e ; 
 	 	 	 } 
 	 	 } 
 	 } 
 	 i f   ( t y p e _ p a s s   = =   f a l s e )   { r e t u r n   f a l s e ; } 
 	 
 	 / / - -   c h e c k   g r o u p 
 	 i f   ( g r o u p _ m o d e = = " g r o u p " ) 
 	 { 
 	 	 i f   ( g r o u p   = =   " " ) 
 	 	 { 
 	 	 	 i f   ( m a g i c _ n u m b e r = = M a g i c S t a r t ) 
 	 	 	 { 
 	 	 	 	 g r o u p _ p a s s = t r u e ; 
 	 	 	 } 
 	 	 } 
 	 	 e l s e 
 	 	 { 
 	 	 	 i f   ( g r o u p 0 ! = g r o u p ) 
 	 	 	 { 
 	 	 	 	 g r o u p 0 = g r o u p ; 
 	 	 	 	 S t r i n g E x p l o d e ( " , " , g r o u p , g r o u p s ) ; 
 	 	 	 	 g r o u p s _ s i z e   =   A r r a y S i z e ( g r o u p s ) ; 
 	 	 	 	 f o r ( i = 0 ;   i < g r o u p s _ s i z e ;   i + + ) 
 	 	 	 	 { 
 	 	 	 	 	 g r o u p s [ i ] = S t r i n g T r i m ( g r o u p s [ i ] ) ; 
 	 	 	 	 	 i f   ( g r o u p s [ i ] = = " " )   { g r o u p s [ i ] = " 0 " ; } 
 	 	 	 	 } 
 	 	 	 } 
 	 	 	 f o r ( i = 0 ;   i < g r o u p s _ s i z e ;   i + + ) 
 	 	 	 { 
 	 	 	 	 i f   ( m a g i c _ n u m b e r = = ( M a g i c S t a r t + ( i n t ) g r o u p s [ i ] ) ) 
 	 	 	 	 { 
 	 	 	 	 	 g r o u p _ p a s s = t r u e ; 
 	 	 	 	 	 b r e a k ; 
 	 	 	 	 } 
 	 	 	 } 
 	 	 } 
 	 } 
 	 e l s e   i f   ( g r o u p _ m o d e = = " a l l "   | |   ( g r o u p _ m o d e = = " m a n u a l "   & &   m a g i c _ n u m b e r = = 0 ) )   { 
 	 	 g r o u p _ p a s s   =   t r u e ;     
 	 } 
 	 i f   ( g r o u p _ p a s s   = =   f a l s e )   { r e t u r n   f a l s e ; } 
 	 
 	 / /   c h e c k   m a r k e t 
 	 i f   ( m a r k e t _ m o d e = = " a l l " )   { 
 	 	 m a r k e t _ p a s s = t r u e ; 
 	 	 
 	 } 
 	 e l s e   { 
 	 	 i f   ( s y m b o l   = =   m a r k e t ) 
 	 	 { 
 	 	 	 m a r k e t _ p a s s   =   t r u e ; 
 	 	 } 
 	 	 e l s e 
 	 	 { 
 	 	 	 i f   ( m a r k e t 0 ! = m a r k e t ) 
 	 	 	 { 
 	 	 	 	 m a r k e t 0 = m a r k e t ; 
 	 	 	 	 i f   ( m a r k e t = = " " ) 
 	 	 	 	 { 
 	 	 	 	 	 m a r k e t s _ s i z e   =   1 ; 
 	 	 	 	 	 A r r a y R e s i z e ( m a r k e t s , 1 ) ; 
 	 	 	 	 	 m a r k e t s [ 0 ] = S y m b o l ( ) ; 
 	 	 	 	 } 
 	 	 	 	 e l s e 
 	 	 	 	 { 
 	 	 	 	 	 S t r i n g E x p l o d e ( " , " , m a r k e t , m a r k e t s ) ; 
 	 	 	 	 	 m a r k e t s _ s i z e   =   A r r a y S i z e ( m a r k e t s ) ; 
 	 	 	 	 	 f o r ( i = 0 ;   i < m a r k e t s _ s i z e ;   i + + ) 
 	 	 	 	 	 { 
 	 	 	 	 	 	 m a r k e t s [ i ] = S t r i n g T r i m ( m a r k e t s [ i ] ) ; 
 	 	 	 	 	 	 i f   ( m a r k e t s [ i ] = = " " )   { m a r k e t s [ i ] = S y m b o l ( ) ; } 
 	 	 	 	 	 } 
 	 	 	 	 } 
 	 	 	 } 
 	 	 	 f o r ( i = 0 ;   i < m a r k e t s _ s i z e ;   i + + )   { 
 	 	 	 	 i f   ( s y m b o l = = m a r k e t s [ i ] )   { 
 	 	 	 	 	 m a r k e t _ p a s s   =   t r u e ; 
 	 	 	 	 	 b r e a k ; 
 	 	 	 	 } 
 	 	 	 } 
 	 	 } 
 	 } 
 	 i f   ( m a r k e t _ p a s s   = =   f a l s e )   { r e t u r n   f a l s e ; } 
   
 	 r e t u r n ( t r u e ) ; 
 }  
  
 s t r i n g   G e t S y m b o l ( s t r i n g   s y m b o l = " " )  
 {  
       s t a t i c   s t r i n g   m e m o r y = " " ;  
       i f   ( s y m b o l = = " " )   {  
             i f   ( m e m o r y = = " " )   { m e m o r y = S y m b o l ( ) ; }  
       }  
       e l s e   { m e m o r y = s y m b o l ; }  
       r e t u r n ( m e m o r y ) ;  
 }  
  
 b o o l   I s F i l l i n g T y p e A l l o w e d ( s t r i n g   s y m b o l , i n t   f i l l _ t y p e )  
 {  
 / / - - -   O b t a i n   t h e   v a l u e   o f   t h e   p r o p e r t y   t h a t   d e s c r i b e s   a l l o w e d   f i l l i n g   m o d e s  
       i n t   f i l l i n g = ( i n t ) S y m b o l I n f o I n t e g e r ( s y m b o l , S Y M B O L _ F I L L I N G _ M O D E ) ;  
 / / - - -   R e t u r n   t r u e ,   i f   m o d e   f i l l _ t y p e   i s   a l l o w e d  
       r e t u r n ( ( f i l l i n g   &   f i l l _ t y p e ) = = f i l l _ t y p e ) ;  
 }  
  
 b o o l   I s O r d e r T y p e B u y ( )   {  
       i f   ( L o a d e d T y p e ( ) = = 1 ) {  
             i f   ( P o s i t i o n G e t I n t e g e r ( P O S I T I O N _ T Y P E ) = = P O S I T I O N _ T Y P E _ B U Y )   { r e t u r n ( t r u e ) ; }   e l s e   { r e t u r n ( f a l s e ) ; }  
       }  
       i f   ( L o a d e d T y p e ( ) = = 3 )   {  
             i f   (  
             H i s t o r y O r d e r G e t I n t e g e r ( O r d e r T i c k e t ( ) , O R D E R _ T Y P E ) = = O R D E R _ T Y P E _ B U Y  
             )   { r e t u r n ( t r u e ) ; }   e l s e   { r e t u r n ( f a l s e ) ; }  
       }  
       i f   ( L o a d e d T y p e ( ) = = 4 )   {  
             i f   (  
             H i s t o r y O r d e r G e t I n t e g e r ( O r d e r T i c k e t ( ) , O R D E R _ T Y P E ) = = O R D E R _ T Y P E _ B U Y _ L I M I T  
             | |  
             H i s t o r y O r d e r G e t I n t e g e r ( O r d e r T i c k e t ( ) , O R D E R _ T Y P E ) = = O R D E R _ T Y P E _ B U Y _ S T O P  
             )   { r e t u r n ( t r u e ) ; }   e l s e   { r e t u r n ( f a l s e ) ; }  
       }  
       i f   (  
             O r d e r G e t I n t e g e r ( O R D E R _ T Y P E ) = = O R D E R _ T Y P E _ B U Y _ L I M I T  
             | |  
             O r d e r G e t I n t e g e r ( O R D E R _ T Y P E ) = = O R D E R _ T Y P E _ B U Y _ S T O P  
             )   { r e t u r n ( t r u e ) ; }   e l s e   { r e t u r n ( f a l s e ) ; }  
       r e t u r n ( f a l s e ) ;  
 }  
  
 b o o l   I s O r d e r T y p e S e l l ( )   {  
       i f   ( L o a d e d T y p e ( ) = = 1 ) { i f   ( P o s i t i o n G e t I n t e g e r ( P O S I T I O N _ T Y P E ) = = P O S I T I O N _ T Y P E _ S E L L )   { r e t u r n ( t r u e ) ; }   e l s e   { r e t u r n ( f a l s e ) ; } }  
       i f   ( L o a d e d T y p e ( ) = = 3 )   {  
             i f   (  
             H i s t o r y O r d e r G e t I n t e g e r ( O r d e r T i c k e t ( ) , O R D E R _ T Y P E ) = = O R D E R _ T Y P E _ S E L L  
             )   { r e t u r n ( t r u e ) ; }   e l s e   { r e t u r n ( f a l s e ) ; }  
       }  
       i f   ( L o a d e d T y p e ( ) = = 4 )   {  
             i f   (  
             H i s t o r y O r d e r G e t I n t e g e r ( O r d e r T i c k e t ( ) , O R D E R _ T Y P E ) = = O R D E R _ T Y P E _ S E L L _ L I M I T  
             | |  
             H i s t o r y O r d e r G e t I n t e g e r ( O r d e r T i c k e t ( ) , O R D E R _ T Y P E ) = = O R D E R _ T Y P E _ S E L L _ S T O P  
             )   { r e t u r n ( t r u e ) ; }   e l s e   { r e t u r n ( f a l s e ) ; }  
       }  
       i f   (  
             O r d e r G e t I n t e g e r ( O R D E R _ T Y P E ) = = O R D E R _ T Y P E _ S E L L _ L I M I T  
             | |  
             O r d e r G e t I n t e g e r ( O R D E R _ T Y P E ) = = O R D E R _ T Y P E _ S E L L _ S T O P  
             )   { r e t u r n ( t r u e ) ; }   e l s e   { r e t u r n ( f a l s e ) ; }  
       r e t u r n ( f a l s e ) ;  
 }  
  
 b o o l   L o a d O r d e r ( s t r i n g   s y m b o l ) 
 { 
       b o o l   s u c c e s s   =   P o s i t i o n S e l e c t ( s y m b o l ) ; 
 	 
       i f   ( s u c c e s s )   { 
 	 	 L o a d e d T y p e ( 1 ) ; 
 	 	 O r d e r T i c k e t ( ( u l o n g ) P o s i t i o n G e t I n t e g e r ( P O S I T I O N _ I D E N T I F I E R ) ) ; 
 	 } 
 	 
       r e t u r n   s u c c e s s ; 
 } 
 b o o l   L o a d O r d e r ( u l o n g   t i c k e t ) 
 { 
       b o o l   s u c c e s s   =   O r d e r S e l e c t ( t i c k e t ) ; 
 	 
       i f   ( s u c c e s s )   { 
 	 	 L o a d e d T y p e ( 2 ) ; 
 	 	 O r d e r T i c k e t ( t i c k e t ) ; 
 	 } 
 	 
       r e t u r n   s u c c e s s ; 
 }  
  
 b o o l   L o a d P o s i t i o n ( u l o n g   t i c k e t ) 
 { 
       b o o l   s u c c e s s   =   P o s i t i o n S e l e c t B y T i c k e t ( t i c k e t ) ; 
 	 
       i f   ( s u c c e s s )   { 
 	 	 L o a d e d T y p e ( 1 ) ; 
 	 	 O r d e r T i c k e t ( t i c k e t ) ; 
 	 } 
 	 
       r e t u r n   s u c c e s s ; 
 }  
  
 i n t   L o a d e d T y p e ( i n t   t y p e = 0 )  
 {  
       / /   1   -   p o s i t i o n  
       / /   2   -   p e n d i n g   o r d e r  
       / /   3   -   h i s t o r y   p o s i t i o n  
       / /   4   -   h i s t o r y   p e n d i n g   o r d e r  
 	 s t a t i c   i n t   m e m o r y ;  
       i f   ( t y p e > 0 )   { m e m o r y = t y p e ; }  
       r e t u r n ( m e m o r y ) ;  
 }  
  
 i n t   O C O D r i v e r ( )  
 {  
       s t a t i c   u l o n g   l a s t _ k n o w n _ t i c k e t   =   0 ;  
       s t a t i c   u l o n g   o r d e r s 1 [ ] ;  
       s t a t i c   u l o n g   o r d e r s 2 [ ] ;  
       i n t   i ,   s i z e ;  
        
       i n t   t o t a l   =   O r d e r s T o t a l ( ) ;  
        
       f o r   ( i n t   p o s = t o t a l - 1 ;   p o s > = 0 ;   p o s - - )  
       {  
             i f   ( L o a d O r d e r ( O r d e r G e t T i c k e t ( p o s ) ) )  
             {  
                   u l o n g   t i c k e t   =   O r d e r T i c k e t ( ) ;  
                    
                   / / - -   e n d   h e r e   i f   w e   r e a c h   t h e   l a s t   k n o w n   t i c k e t  
                   i f   ( t i c k e t   = =   l a s t _ k n o w n _ t i c k e t )   { b r e a k ; }  
                    
                   / / - -   s e t   t h e   l a s t   k n o w n   t i c k e t ,   o n l y   i f   t h i s   i s   t h e   f i r s t   i t e r a t i o n  
                   i f   ( p o s   = =   t o t a l - 1 )   {  
                         l a s t _ k n o w n _ t i c k e t   =   t i c k e t ;  
                   }  
                    
                   / / - -   w e   a r e   s e a r c h i n g   f o r   p e n d i n g   o r d e r s ,   s k i p   t r a d e s  
                   i f   ( O r d e r T y p e ( )   < =   O R D E R _ T Y P E _ S E L L )   { c o n t i n u e ; }  
                    
                   / / - -  
                   i f   ( S t r i n g S u b s t r ( O r d e r C o m m e n t ( ) ,   0 ,   5 )   = =   " [ o c o : " )  
                   {  
                         i n t   t i c k e t _ o c o   =   S t r T o I n t e g e r ( S t r i n g S u b s t r ( O r d e r C o m m e n t ( ) ,   5 ,   S t r i n g L e n ( O r d e r C o m m e n t ( ) ) - 1 ) ) ;    
                          
                         b o o l   f o u n d   =   f a l s e ;  
                         s i z e   =   A r r a y S i z e ( o r d e r s 2 ) ;  
                         f o r   ( i = 0 ;   i < s i z e ;   i + + )  
                         {  
                               i f   ( o r d e r s 2 [ i ]   = =   t i c k e t _ o c o )   {  
                                     f o u n d   =   t r u e ;  
                                     b r e a k ;  
                               }  
                         }  
                          
                         i f   ( f o u n d   = =   f a l s e )   {  
                               A r r a y R e s i z e ( o r d e r s 1 ,   s i z e + 1 ) ;  
                               A r r a y R e s i z e ( o r d e r s 2 ,   s i z e + 1 ) ;  
                               o r d e r s 1 [ s i z e ]   =   t i c k e t _ o c o ;  
                               o r d e r s 2 [ s i z e ]   =   t i c k e t ;  
                         }  
                   }  
             }  
       }  
        
       s i z e   =   A r r a y S i z e ( o r d e r s 1 ) ;  
       i n t   d b r e m o v e   =   f a l s e ;  
       f o r   ( i = 0 ;   i < s i z e ;   i + + )  
       {  
             i f   ( L o a d O r d e r ( o r d e r s 1 [ i ] )   = =   f a l s e   | |   O r d e r T y p e ( )   < =   O R D E R _ T Y P E _ S E L L )  
             {  
                   i f   ( L o a d O r d e r ( o r d e r s 2 [ i ] ) )   {  
                         i f   ( D e l e t e O r d e r ( o r d e r s 2 [ i ] ) )  
                         {  
                               d b r e m o v e   =   t r u e ;  
                         }  
                   }  
                   e l s e   {  
                         d b r e m o v e   =   t r u e ;  
                   }  
                    
                   i f   ( d b r e m o v e   = =   t r u e )  
                   {  
                         A r r a y S t r i p K e y ( o r d e r s 1 ,   i ) ;  
                         A r r a y S t r i p K e y ( o r d e r s 2 ,   i ) ;  
                   }  
             }  
       }  
        
       s i z e   =   A r r a y S i z e ( o r d e r s 2 ) ;  
       d b r e m o v e   =   f a l s e ;  
       f o r   ( i = 0 ;   i < s i z e ;   i + + )  
       {  
             i f   ( L o a d O r d e r ( o r d e r s 2 [ i ] )   = =   f a l s e   | |   O r d e r T y p e ( )   < =   O R D E R _ T Y P E _ S E L L )  
             {  
                   i f   ( L o a d O r d e r ( o r d e r s 1 [ i ] ) )   {  
                         i f   ( D e l e t e O r d e r ( o r d e r s 1 [ i ] ) )  
                         {  
                               d b r e m o v e   =   t r u e ;  
                         }  
                   }  
                   e l s e   {  
                         d b r e m o v e   =   t r u e ;  
                   }  
                    
                   i f   ( d b r e m o v e   = =   t r u e )  
                   {  
                         A r r a y S t r i p K e y ( o r d e r s 1 ,   i ) ;  
                         A r r a y S t r i p K e y ( o r d e r s 2 ,   i ) ;  
                   }  
             }  
       }  
        
       r e t u r n   t r u e ;  
 }  
  
 b o o l   O n T i m e r S e t ( d o u b l e   s e c o n d s )  
 {  
       i f   ( s e c o n d s < = 0 )   {  
             E v e n t K i l l T i m e r ( ) ;  
       }  
       e l s e   i f   ( s e c o n d s   <   1 )   {  
             r e t u r n   ( E v e n t S e t M i l l i s e c o n d T i m e r ( ( i n t ) ( s e c o n d s * 1 0 0 0 ) ) ) ;      
       }  
       e l s e   {  
             r e t u r n   ( E v e n t S e t T i m e r ( ( i n t ) s e c o n d s ) ) ;  
       }  
        
       r e t u r n   t r u e ;  
 }  
  
 b o o l   O n T r a d e D e t e c t o r ( )   {  
  
       s t a t i c   i n t   l a s t O r d e r s T o t a l         = O r d e r s T o t a l ( ) ;             / /   N u m b e r   o f   o r d e r s   a t   t h e   t i m e   o f   p r e v i o u s   O n T r a d e ( )   c a l l  
       s t a t i c   i n t   l a s t P o s i t i o n s T o t a l   = P o s i t i o n s T o t a l ( ) ;       / /   N u m b e r   o f   p o s i t i o n s   a t   t h e   t i m e   o f   p r e v i o u s   O n T r a d e ( )   c a l l  
        
       i n t   i = 0 ;  
       u l o n g   t i c k e t = 0 ;  
       i n t   l a s t _ e r r o r = 0 ;  
       l o n g   s t a t e = 0 ;  
       b o o l   e v e n t = f a l s e ;  
       i n t   p o s i t i o n s _ c o u n t     = B u i l d P o s i t i o n s L i s t ( E G V _ P o s i t i o n s L i s t ) ;  
       i n t   o r d e r s _ c o u n t           = B u i l d O r d e r s L i s t ( E G V _ O r d e r L i s t ) ;  
       H i s t o r y S e l e c t ( 0 ,   T i m e C u r r e n t ( ) ) ;  
  
       i f   ( l a s t O r d e r s T o t a l   <   O r d e r s T o t a l ( ) )  
       {  
             t i c k e t = O r d e r G e t T i c k e t ( O r d e r s T o t a l ( ) - 1 ) ;   / /   S e l e c t   t h e   l a s t   o r d e r  
             b o o l   s u c c e s s   =   O r d e r S e l e c t ( t i c k e t ) ;  
             s t a t e   =   O r d e r G e t I n t e g e r ( O R D E R _ S T A T E ) ;  
              
             i f   ( s t a t e   = =   O R D E R _ S T A T E _ S T A R T E D )   {  
                   / / P r i n t ( " O r d e r   # " , t i c k e t , "   h a s   a r r i v e d   f o r   p r o c e s s i n g " ) ;  
             }  
             e l s e   i f   ( s t a t e   = =   O R D E R _ S T A T E _ P L A C E D )   {  
                   / /   E v e n t :   N e w   o r d e r   c r e a t e d  
                   P r i n t ( " P e n d i n g   o r d e r   t y p e   " , ( i n t ) O r d e r G e t I n t e g e r ( O R D E R _ T Y P E ) , "   # " ,   t i c k e t , "   a c c e p t e d ! " ) ;  
                   U p d a t e E v e n t V a l u e s ( E G V _ O r d e r L i s t [ O r d e r s T o t a l ( ) - 1 ] , " n e w " , " " ) ;  
                   e v e n t = t r u e ;  
             }  
       }  
       e l s e   i f ( l a s t O r d e r s T o t a l   >   O r d e r s T o t a l ( ) )  
       {  
             / /   S e l e c t   t h e   o r d e r   t h a t   i s   m i s s i n g   i n   t h e   n e w   l i s t  
             i n t   s i z e = A r r a y S i z e ( E G V _ O r d e r L i s t ) ;  
             i n t   s i z e 0 = A r r a y S i z e ( E G V _ O r d e r L i s t 0 ) ;  
             f o r   ( i = s i z e 0 - 1 ;   i > = 0 ;   i - - )   {  
                   t i c k e t = E G V _ O r d e r L i s t 0 [ i ] . t i c k e t ;  
                   b o o l   f o u n d = f a l s e ;  
                   f o r   ( i n t   j = s i z e - 1 ;   j > = 0 ;   j - - )   {  
                         i f   ( t i c k e t = = E G V _ O r d e r L i s t [ j ] . t i c k e t )   { f o u n d = t r u e ; b r e a k ; }  
                   }  
                   i f   ( f o u n d = = f a l s e )   {  
                         b r e a k ;  
                   }  
             }  
             i f   ( i < 0 )   { i = 0 ; }  
              
             / /   N o w   l o a d   t h a t   o r d e r  
             H i s t o r y O r d e r S e l e c t ( t i c k e t ) ;  
             s t a t e   =   H i s t o r y O r d e r G e t I n t e g e r ( t i c k e t , O R D E R _ S T A T E ) ;  
             i f   ( s t a t e = = 0   & &   G e t L a s t E r r o r ( ) = = E R R _ T R A D E _ O R D E R _ N O T _ F O U N D )   { s t a t e = 2 ; }  
              
             / / P r i n t ( " L a s t   o r d e r   t i c k e t   =   " , t i c k e t ,   " |   s t a t e   =   " , s t a t e ,   " |   G e t L a s t E r r o r =   " , G e t L a s t E r r o r ( ) ) ;  
              
             / /   I f   o r d e r   i s   n o t   f o u n d ,   g e n e r a t e   a n   e r r o r  
             R e s e t L a s t E r r o r ( ) ;  
             l a s t _ e r r o r = G e t L a s t E r r o r ( ) ;  
             i f   ( l a s t _ e r r o r > 0 ) { P r i n t ( " E r r o r   # " , l a s t _ e r r o r , "   O r d e r   " , t i c k e t , "   w a s   n o t   f o u n d ! " ) ; }  
             R e s e t L a s t E r r o r ( ) ;  
        
             i f   ( s t a t e   = =   O R D E R _ S T A T E _ C A N C E L E D )  
             {  
                   P r i n t ( " O r d e r   # " , t i c k e t , "   h a s   b e e n   c a n c e l l e d . " ) ;  
                   U p d a t e E v e n t V a l u e s ( E G V _ O r d e r L i s t 0 [ i ] , " c l o s e " , " " ) ;  
                   e v e n t = t r u e ;  
             }  
             e l s e   i f   ( s t a t e   = =   O R D E R _ S T A T E _ E X P I R E D )  
             {  
                   P r i n t ( " O r d e r   # " , t i c k e t , "   e x p i r e d . " ) ;  
                   U p d a t e E v e n t V a l u e s ( E G V _ O r d e r L i s t 0 [ i ] , " e x p i r e " , " " ) ;  
                   e v e n t = t r u e ;  
             }  
             e l s e  
             / /   I f   o r d e r   i s   f u l l y   e x e c u t e d ,   a n a l y z e   t h e   l a s t   d e a l  
             i f   ( s t a t e   = =   O R D E R _ S T A T E _ F I L L E D )  
             {  
                   u l o n g   d e a l _ t i c k e t = H i s t o r y D e a l G e t T i c k e t ( H i s t o r y D e a l s T o t a l ( ) - 1 ) ;  
                   l o n g   d e a l _ t y p e = H i s t o r y D e a l G e t I n t e g e r ( d e a l _ t i c k e t , D E A L _ T Y P E ) ;   / /   0   -   B U Y ,   1   -   S E L L  
                   s t r i n g   t e x t = " " ;  
                    
                   s w i t c h ( ( i n t ) H i s t o r y D e a l G e t I n t e g e r ( d e a l _ t i c k e t , D E A L _ E N T R Y ) )  
                   {  
                         / /   E n t e r i n g   t h e   m a r k e t  
                         c a s e   D E A L _ E N T R Y _ I N :  
                                
                               i f   ( d e a l _ t y p e = = D E A L _ T Y P E _ B U Y )   { t e x t = " B u y " ; }  
                               e l s e   i f   ( d e a l _ t y p e = = D E A L _ T Y P E _ S E L L )   { t e x t = " S e l l " ; }  
                                
                               P r i n t ( "   O r d e r   # " , H i s t o r y D e a l G e t I n t e g e r ( d e a l _ t i c k e t , D E A L _ O R D E R ) , "   i n v o k e d   d e a l   # " , d e a l _ t i c k e t ) ;  
                               i f   ( P o s i t i o n S e l e c t ( H i s t o r y D e a l G e t S t r i n g ( d e a l _ t i c k e t , D E A L _ S Y M B O L ) ) )   {    
                                     / /   P o s i t i o n   h a s   j u s t   b e e n   o p e n e d  
                                     i f   ( P o s i t i o n G e t D o u b l e ( P O S I T I O N _ V O L U M E )   = =   H i s t o r y D e a l G e t D o u b l e ( d e a l _ t i c k e t , D E A L _ V O L U M E ) )  
                                     {  
                                           P r i n t ( t e x t , "   p o s i t i o n   h a s   b e e n   o p e n e d   o n   p a i r   " , H i s t o r y D e a l G e t S t r i n g ( d e a l _ t i c k e t , D E A L _ S Y M B O L ) ) ;  
                                           U p d a t e E v e n t V a l u e s ( d e a l _ t i c k e t , " n e w " , " f r o m o r d e r " ) ;  
                                           e v e n t = t r u e ;  
                                     }  
                                     e l s e  
                                     / /   P o s i t i o n   h a s   b e e n   i n c r e m e n t e d  
                                     i f   ( P o s i t i o n G e t D o u b l e ( P O S I T I O N _ V O L U M E )   >   H i s t o r y D e a l G e t D o u b l e ( d e a l _ t i c k e t , D E A L _ V O L U M E ) )  
                                     {  
                                           P r i n t ( t e x t , "   p o s i t i o n   h a s   i n c r e m e n t e d   o n   p a i r   " , H i s t o r y D e a l G e t S t r i n g ( d e a l _ t i c k e t , D E A L _ S Y M B O L ) ) ;  
                                           U p d a t e E v e n t V a l u e s ( d e a l _ t i c k e t , " i n c r e m e n t " , " f r o m o r d e r " ) ;  
                                           e v e n t = t r u e ;  
                                     }  
                                     e l s e  
                                     / /   P o s i t i o n   h a s   b e e n   d e c r e m e n t e d  
                                     i f   ( P o s i t i o n G e t D o u b l e ( P O S I T I O N _ V O L U M E )   <   H i s t o r y D e a l G e t D o u b l e ( d e a l _ t i c k e t , D E A L _ V O L U M E ) )  
                                     {  
                                           P r i n t ( t e x t , "   p o s i t i o n   h a s   d e c r e m e n t e d   o n   p a i r   " , H i s t o r y D e a l G e t S t r i n g ( d e a l _ t i c k e t , D E A L _ S Y M B O L ) ) ;  
                                           U p d a t e E v e n t V a l u e s ( d e a l _ t i c k e t , " d e c r e m e n t " , " f r o m o r d e r " ) ;  
                                           e v e n t = t r u e ;  
                                     }  
                               }  
                         b r e a k ;  
                          
                         / /   E x i t i n g   t h e   m a r k e t  
                         c a s e   D E A L _ E N T R Y _ O U T :  
                          
                               i f   ( d e a l _ t y p e = = D E A L _ T Y P E _ B U Y )   { t e x t = " S e l l " ; }  
                               e l s e   i f   ( d e a l _ t y p e = = D E A L _ T Y P E _ S E L L )   { t e x t = " B u y " ; }  
                                
                               P r i n t ( H i s t o r y D e a l G e t I n t e g e r ( d e a l _ t i c k e t , D E A L _ O R D E R ) , "   o r d e r   i n v o k e d   d e a l   # " , d e a l _ t i c k e t ) ;  
                                
                               / /   I f   p o s i t i o n ,   w e   t r i e d   t o   c l o s e ,   i s   s t i l l   p r e s e n t ,   t h e n   w e   h a v e   c l o s e d   o n l y   p a r t   o f   i t  
                               i f   ( P o s i t i o n S e l e c t ( H i s t o r y D e a l G e t S t r i n g ( d e a l _ t i c k e t , D E A L _ S Y M B O L ) )   = =   t r u e )  
                               {  
                                     P r i n t ( " P a r t   o f   " , t e x t , "   p o s i t i o n   h a s   b e e n   c l o s e d   o n   p a i r   " , H i s t o r y D e a l G e t S t r i n g ( d e a l _ t i c k e t , D E A L _ S Y M B O L ) , "   w i t h   p r o f i t   =   " , H i s t o r y D e a l G e t D o u b l e ( d e a l _ t i c k e t , D E A L _ P R O F I T ) ) ;  
                                     U p d a t e E v e n t V a l u e s ( d e a l _ t i c k e t , " c l o s e p a r t " , " f r o m o r d e r " ) ;  
                                     e v e n t = t r u e ;  
                               }  
                               e l s e  
                               / /   I f   p o s i t i o n   i s   n o t   f o u n d ,   t h e n   i t   i s   f u l l y   c l o s e d  
                               {  
                                     P r i n t ( t e x t , "   p o s i t i o n   h a s   b e e n   c l o s e d   o n   p a i r   " , H i s t o r y D e a l G e t S t r i n g ( d e a l _ t i c k e t , D E A L _ S Y M B O L ) , "   w i t h   p r o f i t   =   " , H i s t o r y D e a l G e t D o u b l e ( d e a l _ t i c k e t , D E A L _ P R O F I T ) ) ;  
                                     U p d a t e E v e n t V a l u e s ( d e a l _ t i c k e t , " c l o s e " , " f r o m o r d e r " ) ;  
                                     e v e n t = t r u e ;  
                               }  
                         b r e a k ;  
                          
                         / /   R e v e r s e  
                         c a s e   D E A L _ E N T R Y _ I N O U T :  
                          
                               P r i n t ( H i s t o r y D e a l G e t I n t e g e r ( d e a l _ t i c k e t , D E A L _ O R D E R ) , "   o r d e r   i n v o k e d   d e a l   # " , d e a l _ t i c k e t ) ;  
                                
                               s w i t c h ( ( i n t ) d e a l _ t y p e )  
                               {  
                                     c a s e   0 :  
                                           P r i n t ( " S e l l   i s   r e v e r s e d   t o   B u y   o n   p a i r   " , H i s t o r y D e a l G e t S t r i n g ( d e a l _ t i c k e t , D E A L _ S Y M B O L ) , "   r e s u l t i n g   p r o f i t   =   " , H i s t o r y D e a l G e t D o u b l e ( d e a l _ t i c k e t , D E A L _ P R O F I T ) ) ;    
                                     b r e a k ;  
                                      
                                     c a s e   1 :  
                                           P r i n t ( " B u y   i s   r e v e r s e d   t o   S e l l   o n   p a i r   " , H i s t o r y D e a l G e t S t r i n g ( d e a l _ t i c k e t , D E A L _ S Y M B O L ) , "   r e s u l t i n g   p r o f i t   =   " , H i s t o r y D e a l G e t D o u b l e ( d e a l _ t i c k e t , D E A L _ P R O F I T ) ) ;    
                                     b r e a k ;  
                                      
                                     d e f a u l t :  
                                           P r i n t ( " U n p r o c e s s e d   c o d e   o f   t y p e :   " , d e a l _ t y p e ) ;  
                                     b r e a k ;  
                               }  
                               U p d a t e E v e n t V a l u e s ( d e a l _ t i c k e t , " r e v e r s e " , " f r o m o r d e r " ) ;  
                               e v e n t = t r u e ;  
                         b r e a k ;  
                          
                         / /   I n d i c a t e s   t h e   s t a t e   r e c o r d  
                         c a s e   D E A L _ E N T R Y _ S T A T E :  
                               / / P r i n t ( " U n p r o c e s s e d   c o d e   o f   d i r e c t i o n :   " , H i s t o r y D e a l G e t I n t e g e r ( d e a l _ t i c k e t , D E A L _ T Y P E ) ) ;  
                         b r e a k ;  
                   }  
             }  
       }  
       e l s e   i f   ( l a s t P o s i t i o n s T o t a l < P o s i t i o n s T o t a l ( ) )   {  
             u l o n g   d e a l _ t i c k e t = H i s t o r y D e a l G e t T i c k e t ( H i s t o r y D e a l s T o t a l ( ) - 1 ) ;  
             / /   N e w   p o s i t i o n   o p e n e d  
             U p d a t e E v e n t V a l u e s ( d e a l _ t i c k e t , " n e w " , " " ) ;  
             e v e n t = t r u e ;  
       }  
       e l s e   i f   ( l a s t P o s i t i o n s T o t a l > P o s i t i o n s T o t a l ( ) )   {  
             u l o n g   d e a l _ t i c k e t = H i s t o r y D e a l G e t T i c k e t ( H i s t o r y D e a l s T o t a l ( ) - 1 ) ;  
             / /   P o s i t i o n   c l o s e d  
             U p d a t e E v e n t V a l u e s ( d e a l _ t i c k e t , " c l o s e " , " " ) ;  
             e _ a t t r M a g i c N u m b e r ( t r u e ,   E G V _ P o s i t i o n s L i s t 0 [ i ] . m a g i c ) ;   / /   f o r   s o m e   r e a s o n   m a g i c   n u m b e r   c a n   b e   g e t   o n l y   o n c e   i n   t h e   n o r m a l   w a y  
             e v e n t = t r u e ;  
       }  
        
       i f   ( ( l a s t P o s i t i o n s T o t a l   = =   P o s i t i o n s T o t a l ( ) )   & &   ( l a s t O r d e r s T o t a l   = =   O r d e r s T o t a l ( ) ) )  
       {      
             f o r   ( i = 0 ;   i < p o s i t i o n s _ c o u n t ;   i + + )  
             {  
                   / /   P o s i t i o n   r e v e r s e  
                   i f   ( E G V _ P o s i t i o n s L i s t 0 [ i ] . t y p e   ! =   E G V _ P o s i t i o n s L i s t [ i ] . t y p e )  
                   {  
                         P r i n t ( E G V _ P o s i t i o n s L i s t [ i ] . s y m b o l + "   v o l u m e   r e v e r s e d   f r o m   " +   ( s t r i n g ) E G V _ P o s i t i o n s L i s t 0 [ i ] . t y p e   + "   t o   " +   ( s t r i n g ) E G V _ P o s i t i o n s L i s t [ i ] . t y p e ) ;  
                         U p d a t e E v e n t V a l u e s ( E G V _ P o s i t i o n s L i s t [ i ] , " r e v e r s e " , " " ) ;  
                         e v e n t = t r u e ;  
                   }  
                   / /   P o s i t i o n   m o d i f i e d   S L   a n d / o r   T P  
                   i f   ( ( E G V _ P o s i t i o n s L i s t 0 [ i ] . s l   ! =   E G V _ P o s i t i o n s L i s t [ i ] . s l )   & &   ( E G V _ P o s i t i o n s L i s t 0 [ i ] . t p   ! =   E G V _ P o s i t i o n s L i s t [ i ] . t p ) )   {  
                         P r i n t ( E G V _ P o s i t i o n s L i s t [ i ] . s y m b o l + "   S t o p   L o s s   c h a n g e d   f r o m   " +   ( s t r i n g ) E G V _ P o s i t i o n s L i s t 0 [ i ] . s l   + "   t o   " +   ( s t r i n g ) E G V _ P o s i t i o n s L i s t [ i ] . s l ) ;  
                         P r i n t ( E G V _ P o s i t i o n s L i s t [ i ] . s y m b o l + "   T a k e   P r o f i t   c h a n g e d   f r o m   " +   ( s t r i n g ) E G V _ P o s i t i o n s L i s t 0 [ i ] . t p   + "   t o   " +   ( s t r i n g ) E G V _ P o s i t i o n s L i s t [ i ] . t p ) ;  
                         U p d a t e E v e n t V a l u e s ( E G V _ P o s i t i o n s L i s t [ i ] , " m o d i f y " , " s l t p " ) ;  
                         e v e n t = t r u e ;  
                   }   e l s e   {  
                         i f   ( E G V _ P o s i t i o n s L i s t 0 [ i ] . s l   ! =   E G V _ P o s i t i o n s L i s t [ i ] . s l )  
                         {  
                               P r i n t ( E G V _ P o s i t i o n s L i s t [ i ] . s y m b o l + "   S t o p   L o s s   c h a n g e d   f r o m   " +   ( s t r i n g ) E G V _ P o s i t i o n s L i s t 0 [ i ] . s l   + "   t o   " +   ( s t r i n g ) E G V _ P o s i t i o n s L i s t [ i ] . s l ) ;  
                               U p d a t e E v e n t V a l u e s ( E G V _ P o s i t i o n s L i s t [ i ] , " m o d i f y " , " s l " ) ;  
                               e v e n t = t r u e ;  
                         }  
                         i f   ( E G V _ P o s i t i o n s L i s t 0 [ i ] . t p   ! =   E G V _ P o s i t i o n s L i s t [ i ] . t p )  
                         {  
                               P r i n t ( E G V _ P o s i t i o n s L i s t [ i ] . s y m b o l + "   T a k e   P r o f i t   c h a n g e d   f r o m   " +   ( s t r i n g ) E G V _ P o s i t i o n s L i s t 0 [ i ] . t p   + "   t o   " +   ( s t r i n g ) E G V _ P o s i t i o n s L i s t [ i ] . t p ) ;  
                               U p d a t e E v e n t V a l u e s ( E G V _ P o s i t i o n s L i s t [ i ] , " m o d i f y " , " t p " ) ;  
                               e v e n t = t r u e ;  
                         }  
                   }  
                   / /   C h e c k   p o s i t i o n   i n c r e m e n t / d e c r e m e n t  
                   i f   ( E G V _ P o s i t i o n s L i s t 0 [ i ] . v o l u m e   <   E G V _ P o s i t i o n s L i s t [ i ] . v o l u m e )  
                   {  
                         P r i n t ( E G V _ P o s i t i o n s L i s t [ i ] . s y m b o l + "   v o l u m e   i n c r e m e n t e d   f r o m   " +   ( s t r i n g ) E G V _ P o s i t i o n s L i s t 0 [ i ] . v o l u m e   + "   t o   " +   ( s t r i n g ) E G V _ P o s i t i o n s L i s t [ i ] . v o l u m e ) ;  
                         U p d a t e E v e n t V a l u e s ( E G V _ P o s i t i o n s L i s t [ i ] , " i n c r e m e n t " , " " ) ;  
                         e v e n t = t r u e ;  
                   }  
                   e l s e   i f   ( E G V _ P o s i t i o n s L i s t 0 [ i ] . v o l u m e   >   E G V _ P o s i t i o n s L i s t [ i ] . v o l u m e )  
                   {  
                         P r i n t ( E G V _ P o s i t i o n s L i s t [ i ] . s y m b o l + "   v o l u m e   d e c r e m e n t e d   f r o m   " +   ( s t r i n g ) E G V _ P o s i t i o n s L i s t 0 [ i ] . v o l u m e   + "   t o   " +   ( s t r i n g ) E G V _ P o s i t i o n s L i s t [ i ] . v o l u m e ) ;  
                         U p d a t e E v e n t V a l u e s ( E G V _ P o s i t i o n s L i s t [ i ] , " d e c r e m e n t " , " " ) ;  
                         e v e n t = t r u e ;  
                   }  
             }  
              
             f o r   ( i = 0 ;   i < o r d e r s _ c o u n t ;   i + + )  
             {  
                   i f   ( ( E G V _ O r d e r L i s t 0 [ i ] . s l   ! =   E G V _ O r d e r L i s t [ i ] . s l )   & &   ( E G V _ O r d e r L i s t 0 [ i ] . t p   ! =   E G V _ O r d e r L i s t [ i ] . t p ) )   {  
                         P r i n t ( " O r d e r   " + ( s t r i n g ) E G V _ O r d e r L i s t [ i ] . t i c k e t + "   h a s   c h a n g e d   S t o p   L o s s   f r o m   " +   ( s t r i n g ) E G V _ O r d e r L i s t 0 [ i ] . s l   + "   t o   " +   ( s t r i n g ) E G V _ O r d e r L i s t [ i ] . s l ) ;  
                         P r i n t ( " O r d e r   " + ( s t r i n g ) E G V _ O r d e r L i s t [ i ] . t i c k e t + "   h a s   c h a n g e d   T a k e   P r o f i t   f r o m   " +   ( s t r i n g ) E G V _ O r d e r L i s t 0 [ i ] . t p   + "   t o   " +   ( s t r i n g ) E G V _ O r d e r L i s t [ i ] . t p ) ;  
                         U p d a t e E v e n t V a l u e s ( E G V _ O r d e r L i s t [ i ] , " m o d i f y " , " s l t p " ) ;  
                         e v e n t = t r u e ;  
                   }   e l s e   {  
                         i f   ( E G V _ O r d e r L i s t 0 [ i ] . s l   ! =   E G V _ O r d e r L i s t [ i ] . s l )  
                         {  
                               P r i n t ( " O r d e r   " + ( s t r i n g ) E G V _ O r d e r L i s t [ i ] . t i c k e t + "   h a s   c h a n g e d   S t o p   L o s s   f r o m   " +   ( s t r i n g ) E G V _ O r d e r L i s t 0 [ i ] . s l   + "   t o   " +   ( s t r i n g ) E G V _ O r d e r L i s t [ i ] . s l ) ;  
                               U p d a t e E v e n t V a l u e s ( E G V _ O r d e r L i s t [ i ] , " m o d i f y " , " s l " ) ;  
                               e v e n t = t r u e ;  
                         }  
                         i f   ( E G V _ O r d e r L i s t 0 [ i ] . t p   ! =   E G V _ O r d e r L i s t [ i ] . t p )  
                         {  
                               P r i n t ( " O r d e r   " + ( s t r i n g ) E G V _ O r d e r L i s t [ i ] . t i c k e t + "   h a s   c h a n g e d   T a k e   P r o f i t   f r o m   " +   ( s t r i n g ) E G V _ O r d e r L i s t 0 [ i ] . t p   + "   t o   " +   ( s t r i n g ) E G V _ O r d e r L i s t [ i ] . t p ) ;  
                               U p d a t e E v e n t V a l u e s ( E G V _ O r d e r L i s t [ i ] , " m o d i f y " , " t p " ) ;  
                               e v e n t = t r u e ;  
                         }  
                   }  
                   i f   ( E G V _ O r d e r L i s t 0 [ i ] . p r i c e _ o p e n   ! =   E G V _ O r d e r L i s t [ i ] . p r i c e _ o p e n )  
                   {  
                         P r i n t ( " O r d e r   " + ( s t r i n g ) E G V _ O r d e r L i s t [ i ] . t i c k e t + "   h a s   c h a n g e d   O p e n   P r i c e   f r o m   " +   ( s t r i n g ) E G V _ O r d e r L i s t 0 [ i ] . p r i c e _ o p e n   + "   t o   " +   ( s t r i n g ) E G V _ O r d e r L i s t [ i ] . p r i c e _ o p e n ) ;  
                         U p d a t e E v e n t V a l u e s ( E G V _ O r d e r L i s t [ i ] , " m o d i f y " , " p r i c e " ) ;  
                         e v e n t = t r u e ;  
                   }  
                   i f   ( E G V _ O r d e r L i s t 0 [ i ] . t i m e _ e x p i r a t i o n   ! =   E G V _ O r d e r L i s t [ i ] . t i m e _ e x p i r a t i o n )  
                   {  
                         P r i n t ( " O r d e r   " + ( s t r i n g ) E G V _ O r d e r L i s t [ i ] . t i m e _ e x p i r a t i o n + "   h a s   c h a n g e d   E x p i r a t i o n   f r o m   " +   ( s t r i n g ) E G V _ O r d e r L i s t 0 [ i ] . t i m e _ e x p i r a t i o n   + "   t o   " +   ( s t r i n g ) E G V _ O r d e r L i s t [ i ] . t i m e _ e x p i r a t i o n ) ;  
                         U p d a t e E v e n t V a l u e s ( E G V _ O r d e r L i s t [ i ] , " m o d i f y " , " e x p i r a t i o n " ) ;  
                         e v e n t = t r u e ;  
                   }  
             }  
       }  
        
        
        
       B u i l d P o s i t i o n s L i s t ( E G V _ P o s i t i o n s L i s t 0 ) ;  
       B u i l d O r d e r s L i s t ( E G V _ O r d e r L i s t 0 ) ;  
       l a s t O r d e r s T o t a l           = O r d e r s T o t a l ( ) ;  
       l a s t P o s i t i o n s T o t a l     = P o s i t i o n s T o t a l ( ) ;  
        
       i f   ( e v e n t = = t r u e )   { r e t u r n ( t r u e ) ; }   e l s e   { r e t u r n ( f a l s e ) ; }  
 }  
  
 i n t   O n T r a d e Q u e u e ( i n t   q u e u e = 0 )  
 {  
 	 s t a t i c   i n t   m e m = 0 ;  
       m e m = m e m + q u e u e ;  
       r e t u r n ( m e m ) ;  
 }  
  
 d o u b l e   O r d e r C l o s e P r i c e ( )   {  
       i f   ( L o a d e d T y p e ( ) = = 1 ) {  
             i f   ( P o s i t i o n G e t I n t e g e r ( P O S I T I O N _ T Y P E ) = = P O S I T I O N _ T Y P E _ B U Y )   { r e t u r n ( S y m b o l I n f o D o u b l e ( P o s i t i o n G e t S t r i n g ( P O S I T I O N _ S Y M B O L ) , S Y M B O L _ A S K ) ) ; }  
             i f   ( P o s i t i o n G e t I n t e g e r ( P O S I T I O N _ T Y P E ) = = P O S I T I O N _ T Y P E _ S E L L )   { r e t u r n ( S y m b o l I n f o D o u b l e ( P o s i t i o n G e t S t r i n g ( P O S I T I O N _ S Y M B O L ) , S Y M B O L _ B I D ) ) ; }  
       }  
       i f   ( L o a d e d T y p e ( ) = = 3 ) { r e t u r n ( H i s t o r y D e a l G e t D o u b l e ( a t t r T i c k e t ( ) , D E A L _ P R I C E ) ) ; }  
       i f   ( L o a d e d T y p e ( ) = = 4 ) { r e t u r n ( H i s t o r y D e a l G e t D o u b l e ( a t t r T i c k e t ( ) , D E A L _ P R I C E ) ) ; }  
       r e t u r n ( O r d e r G e t D o u b l e ( O R D E R _ P R I C E _ C U R R E N T ) ) ;  
 }  
  
 s t r i n g   O r d e r C o m m e n t ( )  
 {  
       i f   ( L o a d e d T y p e ( ) = = 1 ) { r e t u r n ( P o s i t i o n G e t S t r i n g ( P O S I T I O N _ C O M M E N T ) ) ; }  
       i f   ( L o a d e d T y p e ( ) = = 3 ) { r e t u r n ( H i s t o r y O r d e r G e t S t r i n g ( H i s t o r y D e a l G e t I n t e g e r ( O r d e r T i c k e t ( ) , D E A L _ P O S I T I O N _ I D ) , O R D E R _ C O M M E N T ) ) ; }  
       i f   ( L o a d e d T y p e ( ) = = 4 ) { r e t u r n ( H i s t o r y O r d e r G e t S t r i n g ( O r d e r T i c k e t ( ) , O R D E R _ C O M M E N T ) ) ; }  
       r e t u r n ( O r d e r G e t S t r i n g ( O R D E R _ C O M M E N T ) ) ;  
 }  
  
 d o u b l e   O r d e r C o m m i s s i o n ( )   {  
       i f   ( L o a d e d T y p e ( ) = = 1 ) { r e t u r n ( P o s i t i o n G e t D o u b l e ( P O S I T I O N _ C O M M I S S I O N ) ) ; }  
       i f   ( L o a d e d T y p e ( ) = = 3 ) { r e t u r n ( H i s t o r y D e a l G e t D o u b l e ( O r d e r T i c k e t ( ) , D E A L _ C O M M I S S I O N ) ) ; }  
       i f   ( L o a d e d T y p e ( ) = = 4 ) { r e t u r n ( 0 ) ; }  
       r e t u r n ( 0 ) ;  
 }  
  
 b o o l   O r d e r C r e a t e ( 
       s t r i n g   s y m b o l = " " , 
       i n t         t y p e = O R D E R _ T Y P E _ B U Y , 
       d o u b l e   l o t s = 0 , 
       d o u b l e   o p = 0 , 
       d o u b l e   s l l = 0 , 
       d o u b l e   t p l = 0 , 
       d o u b l e   s l p = 0 , 
       d o u b l e   t p p = 0 , 
       d o u b l e   s l i p p a g e = 0 , 
       u l o n g     m a g i c = 0 , 
       s t r i n g   c o m m e n t = N U L L , 
       E N U M _ O R D E R _ T Y P E _ T I M E   t y p e _ t i m e = O R D E R _ T I M E _ G T C , 
       d a t e t i m e   e x p i r a t i o n = 0 , 
       b o o l   o c o   =   f a l s e 
       ) 
 { 
       O n T r a d e ( ) ;   / /   W h e n   p o s i t i o n   i s   c l o s e d   b y   s l   o r   t p ,   t h i s   e v e n t   i s   n o t   f i r e d   ( b y   M e t a T r a d e r )   u n t i l   t h e   e n d   o f   t h e   t i c k ,   a n d   i f   a   n e w   p o s i t i o n   i s   o p e n e d ,   i t   w i l l   b e   m i s s e d .   
 
       u i n t   t i m e 0 = G e t T i c k C o u n t ( ) ; 
       
       b o o l   c l o s i n g   =   f a l s e ; 
       d o u b l e   l o t s 0   =   0 ; 
       l o n g   t y p e 0   =   t y p e ; 
       i f   ( t y p e   = =   P O S I T I O N _ T Y P E _ B U Y   | |   t y p e   = =   P O S I T I O N _ T Y P E _ S E L L ) 
       { 
             i f   ( P o s i t i o n S e l e c t ( s y m b o l ) ) 
             { 
                   i f   ( ( i n t ) P o s i t i o n G e t I n t e g e r ( P O S I T I O N _ T Y P E )   ! =   t y p e )   { 
                         c l o s i n g   =   t r u e ; 
                   } 
                   l o t s 0   =   N o r m a l i z e D o u b l e ( P o s i t i o n G e t D o u b l e ( P O S I T I O N _ V O L U M E ) ,   5 ) ; 
                   t y p e 0   =   P o s i t i o n G e t I n t e g e r ( P O S I T I O N _ T Y P E ) ; 
             } 
       } 
       
       u l o n g   t i c k e t = - 1 ; 
       i n t   b s = 1 ; 
       i f   ( 
                   t y p e = = O R D E R _ T Y P E _ S E L L 
             | |   t y p e = = O R D E R _ T Y P E _ S E L L _ S T O P 
             | |   t y p e = = O R D E R _ T Y P E _ S E L L _ L I M I T 
       ) 
       { b s = - 1 ; }   / /   P o s i t i v e   w h e n   B u y ,   n e g a t i v e   w h e n   S e l l 
       
       i f   ( s y m b o l = = " " )   { s y m b o l = S y m b o l ( ) ; } 
       
       l o t s = A l i g n L o t s ( l o t s ) ; 
       
       i n t   d i g i t s   =   0 ; 
       d o u b l e   a s k = 0 ,   b i d = 0 ,   p o i n t = 0 ,   t i c k s i z e = 0 ; 
       d o u b l e   s l = 0 ,   t p = 0 ; 
       b o o l   s u c c e s s e d   =   f a l s e ; 
 
       / / - -   a t t e m p t s   t o   s e n d   p o s i t i o n / o r d e r   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
       w h i l e ( t r u e ) 
       {       
             d i g i t s       =   ( i n t ) S y m b o l I n f o I n t e g e r ( s y m b o l , S Y M B O L _ D I G I T S ) ; 
             a s k             =   S y m b o l I n f o D o u b l e ( s y m b o l , S Y M B O L _ A S K ) ; 
             b i d             =   S y m b o l I n f o D o u b l e ( s y m b o l , S Y M B O L _ B I D ) ; 
             p o i n t         =   S y m b o l I n f o D o u b l e ( s y m b o l , S Y M B O L _ P O I N T ) ; 
             t i c k s i z e   =   S y m b o l I n f o D o u b l e ( s y m b o l ,   S Y M B O L _ T R A D E _ T I C K _ S I Z E ) ; 
             
             / / -   n o t   e n o u g h   m o n e y   c h e c k :   f i x   m a x i m u m   p o s s i b l e   l o t   b y   m a r g i n   r e q u i r e d ,   o r   q u i t 
             i f   ( ( t y p e = = P O S I T I O N _ T Y P E _ B U Y   | |   t y p e = = P O S I T I O N _ T Y P E _ S E L L )   & &   c l o s i n g = = f a l s e ) 
             { 
                   d o u b l e   L o t S t e p                     = S y m b o l L o t S t e p ( s y m b o l ) ; 
                   d o u b l e   M i n L o t s                     = S y m b o l M i n L o t ( s y m b o l ) ; 
                   d o u b l e   m a r g i n _ r e q u i r e d     = 0 ;   b o o l   o c m   =   O r d e r C a l c M a r g i n ( ( E N U M _ O R D E R _ T Y P E ) t y p e , s y m b o l , 1 , a s k ( s y m b o l ) , m a r g i n _ r e q u i r e d ) ; 
                   s t a t i c   b o o l   n o t _ e n o u g h _ m e s s a g e   =   f a l s e ; 
                   
                   i f   ( m a r g i n _ r e q u i r e d   ! =   0 ) 
                   { 
                         d o u b l e   m a x _ s i z e _ b y _ m a r g i n   =   A c c o u n t F r e e M a r g i n ( ) / m a r g i n _ r e q u i r e d ; 
                   
                         i f   ( l o t s   >   m a x _ s i z e _ b y _ m a r g i n )   { 
                               d o u b l e   l o t s _ o l d   =   l o t s ; 
                               l o t s   =   m a x _ s i z e _ b y _ m a r g i n ; 
                               i f   ( l o t s < M i n L o t s ) 
                               { 
                                     i f   ( n o t _ e n o u g h _ m e s s a g e = = f a l s e )   { 
                                           P r i n t ( " N o t   e n o u g h   m o n e y   t o   t r a d e   : (   T h e   r o b o t   i s   s t i l l   w o r k i n g ,   w a i t i n g   f o r   s o m e   f u n d s   t o   a p p e a r . . . " ) ; 
                                     } 
                                     n o t _ e n o u g h _ m e s s a g e   =   t r u e ; 
                                     r e t u r n ( f a l s e ) ; 
                               } 
                               e l s e 
                               { 
                                     l o t s   =   M a t h F l o o r ( l o t s / L o t S t e p ) * L o t S t e p ; 
                                     P r i n t ( " N o t   e n o u g h   m o n e y   t o   t r a d e   " + D o u b l e T o S t r i n g ( l o t s _ o l d ,   2 ) + " ,   t h e   v o l u m e   t o   t r a d e   w i l l   b e   t h e   m a x i m u m   p o s s i b l e   o f   " + D o u b l e T o S t r i n g ( l o t s ,   2 ) ) ; 
                               } 
                         } 
                   } 
                   n o t _ e n o u g h _ m e s s a g e   =   f a l s e ; 
             } 
             
             i f   ( t y p e = = O R D E R _ T Y P E _ B U Y   | |   t y p e = = O R D E R _ T Y P E _ S E L L ) 
             { 
                   o p = a s k ; 
                   i f   ( b s < 0 )   { 
                       o p = b i d ; 
                   } 
             } 
             o p = N o r m a l i z e D o u b l e ( o p ,   d i g i t s ) ; 
             i f   ( o p < 0   | |   o p > = E M P T Y _ V A L U E )     { b r e a k ; } 
             i f   ( s l l < 0 )   { b r e a k ; } 
             i f   ( s l p < 0 )   { b r e a k ; } 
             i f   ( t p l < 0 )   { b r e a k ; } 
             i f   ( t p p < 0 )   { b r e a k ; } 
             
             / / - -   S L   a n d   T P   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
             s l = A l i g n S t o p L o s s ( s y m b o l ,   t y p e ,   o p ,   0 ,   N o r m a l i z e D o u b l e ( s l l , d i g i t s ) ,   s l p ) ; 
             i f   ( s l < 0 )   { b r e a k ; } 
             t p = A l i g n T a k e P r o f i t ( s y m b o l ,   t y p e ,   o p ,   0 ,   N o r m a l i z e D o u b l e ( t p l , d i g i t s ) ,   t p p ) ; 
             i f   ( t p < 0 )   { b r e a k ; } 
             
             s l   =   N o r m a l i z e D o u b l e ( s l , d i g i t s ) ; 
             t p   =   N o r m a l i z e D o u b l e ( t p , d i g i t s ) ; 
             
             / / - -   s e n d   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
             M q l T r a d e R e q u e s t   r e q u e s t ; 
             M q l T r a d e R e s u l t   r e s u l t ; 
             M q l T r a d e C h e c k R e s u l t   c h e c k _ r e s u l t ; 
             Z e r o M e m o r y ( r e q u e s t ) ; 
             Z e r o M e m o r y ( r e s u l t ) ; 
             Z e r o M e m o r y ( c h e c k _ r e s u l t ) ; 
             
             E N U M _ S Y M B O L _ T R A D E _ E X E C U T I O N   e x e c   = ( E N U M _ S Y M B O L _ T R A D E _ E X E C U T I O N ) S y m b o l I n f o I n t e g e r ( s y m b o l , S Y M B O L _ T R A D E _ E X E M O D E ) ; 
 
             / / i f   ( e x p i r a t i o n = = 0 )   { t y p e _ t i m e = O R D E R _ T I M E _ G T C ; } 
             / / - -   f i x   p r i c e s   b y   t i c k s i z e 
             o p   =   M a t h R o u n d ( o p / t i c k s i z e ) * t i c k s i z e ; 
             s l   =   M a t h R o u n d ( s l / t i c k s i z e ) * t i c k s i z e ; 
             t p   =   M a t h R o u n d ( t p / t i c k s i z e ) * t i c k s i z e ; 
 
             r e q u e s t . s y m b o l               =   s y m b o l ; 
             r e q u e s t . t y p e                   =   ( E N U M _ O R D E R _ T Y P E ) t y p e ; 
             r e q u e s t . v o l u m e               =   l o t s ; 
             r e q u e s t . p r i c e                 =   o p ; 
             r e q u e s t . d e v i a t i o n         =   ( u l o n g ) ( s l i p p a g e * P i p V a l u e ( s y m b o l ) ) ; 
             r e q u e s t . s l                       =   s l ; 
             r e q u e s t . t p                       =   t p ; 
             r e q u e s t . c o m m e n t             =   c o m m e n t ; 
             r e q u e s t . m a g i c                 =   m a g i c ; 
             r e q u e s t . t y p e _ t i m e         =   t y p e _ t i m e ; 
             r e q u e s t . e x p i r a t i o n       =   e x p i r a t i o n ; 
             
             / / - -   r e q u e s t   a c t i o n 
             i f   ( t y p e > O R D E R _ T Y P E _ S E L L ) 
             { 
                   r e q u e s t . a c t i o n               =   T R A D E _ A C T I O N _ P E N D I N G ; 
             } 
             e l s e 
             { 
                   r e q u e s t . a c t i o n               =   T R A D E _ A C T I O N _ D E A L ; 
             } 
             / / - -   f i l l i n g   t y p e 
             
             / /   c h e c k   O R D E R _ F I L L I N G _ R E T U R N   f o r   p e n d i n g   o r d e r s   o n l y   
             i f   ( t y p e   >   O R D E R _ T Y P E _ S E L L ) 
             { 
 	 	 	 i f   ( I s F i l l i n g T y p e A l l o w e d ( s y m b o l ,   O R D E R _ F I L L I N G _ R E T U R N ) ) 
 	             	 r e q u e s t . t y p e _ f i l l i n g   =   O R D E R _ F I L L I N G _ R E T U R N ; 
 	 	 	 e l s e   i f   ( I s F i l l i n g T y p e A l l o w e d ( s y m b o l ,   O R D E R _ F I L L I N G _ F O K ) ) 
 	 	 	 	 r e q u e s t . t y p e _ f i l l i n g   =   O R D E R _ F I L L I N G _ F O K ; 
 	 	 	 e l s e   i f   ( I s F i l l i n g T y p e A l l o w e d ( s y m b o l ,   O R D E R _ F I L L I N G _ I O C ) ) 
 	 	 	 	 r e q u e s t . t y p e _ f i l l i n g   =   O R D E R _ F I L L I N G _ I O C ; 
 	 	 	 
             } 
             e l s e 
 	 	 { 
 	 	 	 / /   i n   c a s e   o f   p o s i t i o n s   I   w o u l d   c h e c k   f o r   S Y M B O L _ F I L L I N G _   a n d   t h e n   s e t   O R D E R _ F I L L I N G _ 
 	 	 	 / /   t h i s   i s   b e c a u s e   i t   a p p e a r s   t h a t   I s F i l l i n g T y p e A l l o w e d ( )   w o r k s   c o r r e c t   w i t h   S Y M B O L _ F I L L I N G _ ,   b u t   t h e n   t h e   p o s i t i o n   w o r k s   c o r r e c t l y   w i t h   O R D E R _ F I L L I N G _ 
 	 	 	 / /   F O K   a n d   I O C   i n t e g e r   v a l u e s   a r e   n o t   t h e   s a m e   f o r   O R D E R   a n d   S Y M B O L 
 	 	 	 
 	 	 	 i f   ( I s F i l l i n g T y p e A l l o w e d ( s y m b o l ,   S Y M B O L _ F I L L I N G _ F O K ) ) 
 	             	 r e q u e s t . t y p e _ f i l l i n g   =   O R D E R _ F I L L I N G _ F O K ; 
 	 	 	 e l s e   i f   ( I s F i l l i n g T y p e A l l o w e d ( s y m b o l ,   S Y M B O L _ F I L L I N G _ I O C ) ) 
 	 	 	 	 r e q u e s t . t y p e _ f i l l i n g   =   O R D E R _ F I L L I N G _ I O C ; 
 	 	 	 e l s e   i f   ( I s F i l l i n g T y p e A l l o w e d ( s y m b o l ,   O R D E R _ F I L L I N G _ R E T U R N ) )   / /   j u s t   i n   c a s e 
 	 	 	 	 r e q u e s t . t y p e _ f i l l i n g   =   O R D E R _ F I L L I N G _ R E T U R N ; 
 	 	 } 
             
             
             i f   ( ! O r d e r C h e c k ( r e q u e s t , c h e c k _ r e s u l t ) )     { 
                   P r i n t ( " O r d e r C h e c k ( )   f a i l e d :   " + ( s t r i n g ) c h e c k _ r e s u l t . c o m m e n t + "   ( " + ( s t r i n g ) c h e c k _ r e s u l t . r e t c o d e + " ) " ) ; 
                   r e t u r n   f a l s e ; 
             } 
 
             i n t   s u c c e s s = O r d e r S e n d ( r e q u e s t , r e s u l t ) ; 
             
             / / - -   c h e c k   s e c u r i t y   f l a g   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
             i f   ( s u c c e s s e d   = =   t r u e )   { 
                   P r i n t ( " T h e   p r o g r a m   w i l l   b e   r e m o v e d   b e c a u s e   o f   s u s p i c i o u s   a t t e m p t   t o   c r e a t e   a   n e w   p o s i t i o n " ) ; 
                   E x p e r t R e m o v e ( ) ;   S l e e p ( 1 0 0 0 0 ) ;   b r e a k ; 
             } 
             i f   ( s u c c e s s )   { s u c c e s s e d   =   t r u e ; } 
             
             / / - -   e r r o r   c h e c k   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
             i f   ( ! s u c c e s s   | |   ( r e s u l t . r e t c o d e ! = T R A D E _ R E T C O D E _ D O N E   & &   r e s u l t . r e t c o d e ! = T R A D E _ R E T C O D E _ P L A C E D   & &   r e s u l t . r e t c o d e ! = T R A D E _ R E T C O D E _ D O N E _ P A R T I A L ) ) 
             { 
                   s t r i n g   e r r m s g p f x = " N e w   p o s i t i o n   e r r o r " ; 
                   i f   ( t y p e > O R D E R _ T Y P E _ S E L L )   { 
                         e r r m s g p f x = " N e w   p e n d i n g   o r d e r   e r r o r " ; 
                   } 
                   i n t   e r r a c t i o n = C h e c k F o r T r a d i n g E r r o r ( r e s u l t . r e t c o d e ,   e r r m s g p f x ) ; 
                   s w i t c h ( e r r a c t i o n ) 
                   { 
                         c a s e   0 :   b r e a k ;         / /   n o   e r r o r 
                         c a s e   1 :   c o n t i n u e ;   / /   o v e r c o m a b l e   e r r o r 
                         c a s e   2 :   b r e a k ;         / /   f a t a l   e r r o r 
                   } 
                   r e t u r n ( f a l s e ) ; 
             } 
             
             / / - -   f i n i s h   w o r k   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
             i f   ( r e s u l t . r e t c o d e = = T R A D E _ R E T C O D E _ D O N E   | |   r e s u l t . r e t c o d e = = T R A D E _ R E T C O D E _ P L A C E D   | |   r e s u l t . r e t c o d e = = T R A D E _ R E T C O D E _ D O N E _ P A R T I A L ) 
             { 
                   t i c k e t   =   r e s u l t . o r d e r ; 
                   / / = =   W h a t e v e r   w a s   c r e a t e d ,   w e   n e e d   t o   w a i t   u n t i l   M T 5   u p d a t e s   i t ' s   c a c h e 
 
                   / / - -   S y n c h r o n i z e :   P o s i t i o n 
                   i f   ( t y p e < = O R D E R _ T Y P E _ S E L L ) 
                   { 
 	 	 	 	 i f   ( A c c o u n t I n f o I n t e g e r ( A C C O U N T _ M A R G I N _ M O D E )   = =   A C C O U N T _ M A R G I N _ M O D E _ R E T A I L _ N E T T I N G ) 
 	 	 	 	 { 
                         	 i f   ( c l o s i n g   = =   f a l s e ) 
                         	 { 
                         	       / / -   n e w   p o s i t i o n :   2   s i t u a t i o n s   h e r e   -   n e w   p o s i t i o n   o r   a d d   t o   p o s i t i o n 
                         	       / / -   . . .   b e c a u s e   o f   t h a t   w e   w i l l   c h e c k   t h e   l o t   s i z e   i n s t e a d   o f   P o s i t i o n S e l e c t 
                         	       w h i l e   ( t r u e ) 
                         	       { 
                         	             i f   ( P o s i t i o n S e l e c t ( s y m b o l )   & &   ( l o t s 0   ! =   N o r m a l i z e D o u b l e ( P o s i t i o n G e t D o u b l e ( P O S I T I O N _ V O L U M E ) ,   5 ) ) )   { b r e a k ; } 
                         	             S l e e p ( 1 0 ) ; 
                         	       } 
                         	 } 
                         	 e l s e 
                         	 { 
                         	       / / -   c l o s i n g   p o s i t i o n :   f u l l 
                         	       i f   ( l o t s 0   = =   N o r m a l i z e D o u b l e ( r e s u l t . v o l u m e ,   5 ) ) 
                         	       { 
                         	             w h i l e   ( t r u e ) 
                         	             { 
                         	                   i f   ( ! P o s i t i o n S e l e c t ( s y m b o l ) )   { b r e a k ; } 
                         	                   S l e e p ( 1 0 ) ; 
                         	             } 
                         	       } 
                         	       / / -   c l o s i n g   p o s i t i o n :   p a r t i a l 
                         	       e l s e   i f   ( l o t s 0   >   N o r m a l i z e D o u b l e ( r e s u l t . v o l u m e ,   5 ) ) 
                         	       { 
                         	             w h i l e   ( t r u e ) 
                         	             { 
                         	                   i f   ( P o s i t i o n S e l e c t ( s y m b o l )   & &   ( l o t s 0   ! =   N o r m a l i z e D o u b l e ( P o s i t i o n G e t D o u b l e ( P O S I T I O N _ V O L U M E ) ,   5 ) ) )   { b r e a k ; } 
                         	                   S l e e p ( 1 0 ) ; 
                         	             } 
                               	 } 
                               	 e l s e   i f   ( l o t s 0   <   N o r m a l i z e D o u b l e ( r e s u l t . v o l u m e ,   5 ) ) 
                               	 { 
                               	 / / - -   p o s i t i o n   r e v e r s e 
                               	       w h i l e   ( t r u e ) 
                               	       { 
                               	             i f   ( P o s i t i o n S e l e c t ( s y m b o l )   & &   ( t y p e 0   ! =   P o s i t i o n G e t I n t e g e r ( P O S I T I O N _ T Y P E ) ) )   { b r e a k ; } 
                               	             S l e e p ( 1 0 ) ; 
                               	       } 
                               	 } 
                         	 } 
 	 	 	 	 } 
 	 	 	 	 e l s e   i f   ( A c c o u n t I n f o I n t e g e r ( A C C O U N T _ M A R G I N _ M O D E )   = =   A C C O U N T _ M A R G I N _ M O D E _ R E T A I L _ H E D G I N G ) 
 	 	 	 	 { 
 	 	 	 	 	 i f   ( c l o s i n g   = =   f a l s e ) 
                         	 { 
 	 	 	 	 	 	 w h i l e   ( t r u e ) 
                         	 	 { 
                         	 	       i f   ( P o s i t i o n S e l e c t B y T i c k e t ( t i c k e t ) )   { b r e a k ; } 
                         	 	 	 S l e e p ( 1 0 ) ; 
                         	 	 } 
 	 	 	 	 	 } 
 	 	 	 	 } 
                   } 
                   / / - -   S y n c h r o n i z e :   O r d e r 
                   e l s e 
                   { 
                         w h i l e   ( t r u e ) 
                         { 
                               i f   ( L o a d O r d e r ( r e s u l t . o r d e r ) )   { b r e a k ; } 
                               S l e e p ( 1 0 ) ; 
                         } 
                   } 
             } 
             b r e a k ; 
       } 
       
       i f   ( o c o   = =   t r u e   & &   t i c k e t   >   0 ) 
       { 
 	 	 s l   =   ( s l   >   0 )   ?   N o r m a l i z e D o u b l e ( M a t h A b s ( o p - s l ) ,   d i g i t s )   :   0 ; 
             t p   =   ( t p   >   0 )   ?   N o r m a l i z e D o u b l e ( M a t h A b s ( o p - t p ) ,   d i g i t s )   :   0 ; 
             
             i n t   t y p e o c o   =   t y p e ; 
             i f   ( t y p e o c o   = =   O R D E R _ T Y P E _ B U Y _ S T O P )   { 
                   t y p e o c o   =   O R D E R _ T Y P E _ S E L L _ S T O P ; 
                   o p   =   b i d   -   M a t h A b s ( o p - a s k ) ; 
             } 
             e l s e   i f   ( t y p e o c o   = =   O R D E R _ T Y P E _ B U Y _ L I M I T )   { 
                   t y p e o c o   =   O R D E R _ T Y P E _ S E L L _ L I M I T ; 
                   o p   =   b i d   +   M a t h A b s ( o p - a s k ) ; 
             } 
             e l s e   i f   ( t y p e o c o   = =   O R D E R _ T Y P E _ S E L L _ S T O P )   { 
                   t y p e o c o   =   O R D E R _ T Y P E _ B U Y _ S T O P ; 
                   o p   =   a s k   +   M a t h A b s ( o p - b i d ) ; 
             } 
             e l s e   i f   ( t y p e o c o   = =   O R D E R _ T Y P E _ S E L L _ L I M I T )   { 
                   t y p e o c o   =   O R D E R _ T Y P E _ B U Y _ L I M I T ; 
                   o p   =   a s k   -   M a t h A b s ( o p - b i d ) ; 
             } 
             
             i f   ( t y p e o c o   = =   O R D E R _ T Y P E _ B U Y _ S T O P   | |   t y p e o c o   = =   O R D E R _ T Y P E _ B U Y _ L I M I T ) 
             { 
                   s l   =   ( s l   >   0 )   ?   o p   -   s l   :   0 ; 
                   t p   =   ( t p   >   0 )   ?   o p   +   t p   :   0 ; 
             } 
             e l s e   { 
                   s l   =   ( s l   >   0 )   ?   o p   +   s l   :   0 ; 
                   t p   =   ( t p   >   0 )   ?   o p   -   t p   :   0 ; 
             } 
                   
             c o m m e n t   =   " [ o c o : " + ( s t r i n g ) t i c k e t + " ] " ; 
             
             O r d e r C r e a t e ( s y m b o l , t y p e o c o , l o t s , o p , s l , t p , 0 , 0 , s l i p p a g e , m a g i c , c o m m e n t , t y p e _ t i m e , e x p i r a t i o n , f a l s e ) ; 
       } 
       
       O n T r a d e ( ) ; 
       r e t u r n ( t r u e ) ; 
 }  
  
 d o u b l e   O r d e r L o t s ( )   { 
 	 i f   ( L o a d e d T y p e ( ) = = 1 ) { r e t u r n ( N o r m a l i z e D o u b l e ( P o s i t i o n G e t D o u b l e ( P O S I T I O N _ V O L U M E ) ,   5 ) ) ; } 
 	 i f   ( L o a d e d T y p e ( ) = = 3 ) { r e t u r n ( N o r m a l i z e D o u b l e ( H i s t o r y D e a l G e t D o u b l e ( a t t r T i c k e t ( ) , D E A L _ V O L U M E ) ,   5 ) ) ; } 
 	 i f   ( L o a d e d T y p e ( ) = = 4 ) { r e t u r n ( N o r m a l i z e D o u b l e ( H i s t o r y O r d e r G e t D o u b l e ( a t t r T i c k e t ( ) , O R D E R _ V O L U M E _ I N I T I A L ) ,   5 ) ) ; } 
 	 r e t u r n ( N o r m a l i z e D o u b l e ( O r d e r G e t D o u b l e ( O R D E R _ V O L U M E _ C U R R E N T ) ,   5 ) ) ; 
 }  
  
 i n t   O r d e r M a g i c N u m b e r ( )  
 {  
       i f   ( L o a d e d T y p e ( ) = = 1 ) { r e t u r n ( ( i n t ) P o s i t i o n G e t I n t e g e r ( P O S I T I O N _ M A G I C ) ) ; }  
       i f   ( L o a d e d T y p e ( ) = = 3 ) { r e t u r n ( ( i n t ) H i s t o r y O r d e r G e t I n t e g e r ( H i s t o r y D e a l G e t I n t e g e r ( O r d e r T i c k e t ( ) , D E A L _ P O S I T I O N _ I D ) , O R D E R _ M A G I C ) ) ; }  
       i f   ( L o a d e d T y p e ( ) = = 4 ) { r e t u r n ( ( i n t ) H i s t o r y O r d e r G e t I n t e g e r ( O r d e r T i c k e t ( ) , O R D E R _ M A G I C ) ) ; }  
       r e t u r n ( ( i n t ) O r d e r G e t I n t e g e r ( O R D E R _ M A G I C ) ) ;  
 }  
  
 d o u b l e   O r d e r O p e n P r i c e ( )   {  
       i f   ( L o a d e d T y p e ( ) = = 1 ) { r e t u r n ( P o s i t i o n G e t D o u b l e ( P O S I T I O N _ P R I C E _ O P E N ) ) ; }  
       i f   ( L o a d e d T y p e ( ) = = 3 ) { r e t u r n ( H i s t o r y O r d e r G e t D o u b l e ( H i s t o r y D e a l G e t I n t e g e r ( O r d e r T i c k e t ( ) , D E A L _ P O S I T I O N _ I D ) , O R D E R _ P R I C E _ O P E N ) ) ; }  
       i f   ( L o a d e d T y p e ( ) = = 4 ) { r e t u r n ( H i s t o r y O r d e r G e t D o u b l e ( O r d e r T i c k e t ( ) , O R D E R _ P R I C E _ O P E N ) ) ; }  
       r e t u r n ( O r d e r G e t D o u b l e ( O R D E R _ P R I C E _ O P E N ) ) ;  
 }  
  
 d a t e t i m e   O r d e r O p e n T i m e ( )   {  
       i f   ( L o a d e d T y p e ( ) = = 1 ) { r e t u r n ( ( d a t e t i m e ) P o s i t i o n G e t I n t e g e r ( P O S I T I O N _ T I M E ) ) ; }  
       i f   ( L o a d e d T y p e ( ) = = 3 ) { r e t u r n ( ( d a t e t i m e ) H i s t o r y O r d e r G e t I n t e g e r ( H i s t o r y D e a l G e t I n t e g e r ( O r d e r T i c k e t ( ) , D E A L _ P O S I T I O N _ I D ) , O R D E R _ T I M E _ S E T U P ) ) ; }  
       i f   ( L o a d e d T y p e ( ) = = 4 ) { r e t u r n ( ( d a t e t i m e ) H i s t o r y O r d e r G e t I n t e g e r ( O r d e r T i c k e t ( ) , O R D E R _ T I M E _ S E T U P ) ) ; }  
       r e t u r n ( ( d a t e t i m e ) O r d e r G e t I n t e g e r ( O R D E R _ T I M E _ S E T U P ) ) ;  
 }  
  
 d o u b l e   O r d e r P r o f i t ( )   {  
       i f   ( L o a d e d T y p e ( ) = = 1 ) { r e t u r n ( P o s i t i o n G e t D o u b l e ( P O S I T I O N _ P R O F I T ) ) ; }  
       i f   ( L o a d e d T y p e ( ) = = 3 ) { r e t u r n ( H i s t o r y D e a l G e t D o u b l e ( O r d e r T i c k e t ( ) , D E A L _ P R O F I T ) ) ; }  
       i f   ( L o a d e d T y p e ( ) = = 4 ) { r e t u r n ( 0 ) ; }  
       r e t u r n ( 0 ) ;  
 }  
  
 d o u b l e   O r d e r S w a p ( )   {  
       i f   ( L o a d e d T y p e ( ) = = 1 ) { r e t u r n ( P o s i t i o n G e t D o u b l e ( P O S I T I O N _ S W A P ) ) ; }  
       i f   ( L o a d e d T y p e ( ) = = 3 ) { r e t u r n ( H i s t o r y D e a l G e t D o u b l e ( O r d e r T i c k e t ( ) , D E A L _ S W A P ) ) ; }  
       i f   ( L o a d e d T y p e ( ) = = 4 ) { r e t u r n ( 0 ) ; }  
       r e t u r n ( 0 ) ;  
 }  
  
 s t r i n g   O r d e r S y m b o l ( )  
 {  
       i f   ( L o a d e d T y p e ( ) = = 1 ) { r e t u r n ( P o s i t i o n G e t S t r i n g ( P O S I T I O N _ S Y M B O L ) ) ; }  
       i f   ( L o a d e d T y p e ( ) = = 3 ) { r e t u r n ( H i s t o r y D e a l G e t S t r i n g ( O r d e r T i c k e t ( ) , D E A L _ S Y M B O L ) ) ; }  
       i f   ( L o a d e d T y p e ( ) = = 4 ) { r e t u r n ( H i s t o r y O r d e r G e t S t r i n g ( O r d e r T i c k e t ( ) , O R D E R _ S Y M B O L ) ) ; }  
       r e t u r n ( O r d e r G e t S t r i n g ( O R D E R _ S Y M B O L ) ) ;  
 }  
  
 u l o n g   O r d e r T i c k e t ( u l o n g   T i c k e t = 0 )  
 {  
       s t a t i c   u l o n g   m e m o r y ;                           / /   T i c k e t   m e m o r y  
       i f   ( T i c k e t > 0 )   { m e m o r y = T i c k e t ; }       / /   S e t   T i c k e t  
       r e t u r n ( m e m o r y ) ;                                     / /   G e t   T i c k e t  
 }  
  
 i n t   O r d e r T y p e ( )   {  
       i f   ( L o a d e d T y p e ( ) = = 1 ) { r e t u r n ( ( i n t ) P o s i t i o n G e t I n t e g e r ( P O S I T I O N _ T Y P E ) ) ; }  
       i f   ( L o a d e d T y p e ( ) = = 3 ) {  
             i n t   O T = ( i n t ) H i s t o r y D e a l G e t I n t e g e r ( O r d e r T i c k e t ( ) , D E A L _ T Y P E ) ;  
             i f ( O T = = 1 ) { r e t u r n ( 0 ) ; }  
             i f ( O T = = 0 ) { r e t u r n ( 1 ) ; }  
             r e t u r n ( O T ) ;  
       }  
       i f   ( L o a d e d T y p e ( ) = = 4 ) { r e t u r n ( ( i n t ) H i s t o r y O r d e r G e t I n t e g e r ( O r d e r T i c k e t ( ) , O R D E R _ T Y P E ) ) ; }  
       r e t u r n ( ( i n t ) O r d e r G e t I n t e g e r ( O R D E R _ T Y P E ) ) ;  
 }  
  
 d o u b l e   P i p V a l u e ( s t r i n g   s y m b o l = " " )  
 {  
       i f   ( s y m b o l = = " " )   { s y m b o l = G e t S y m b o l ( ) ; }  
       r e t u r n ( C u s t o m P o i n t ( s y m b o l ) / S y m b o l I n f o D o u b l e ( s y m b o l , S Y M B O L _ P O I N T ) ) ;  
       / *  
       i f   ( s y m b o l = = " " )   { s y m b o l = G e t S y m b o l ( ) ; }  
       i n t   d i g i t s = ( i n t ) S y m b o l I n f o I n t e g e r ( s y m b o l , S Y M B O L _ D I G I T S ) ;  
       i f   ( ( d i g i t s = = 2   | |   d i g i t s = = 4 ) )   { r e t u r n ( ( i n t ) ( P O I N T _ F O R M A T / 0 . 0 0 0 1 ) ) ; }  
       i f   ( ( d i g i t s = = 3   | |   d i g i t s = = 5 ) )   { r e t u r n ( ( i n t ) ( P O I N T _ F O R M A T / 0 . 0 0 0 0 1 ) ) ; }  
       i f   ( ( d i g i t s = = 6 ) )                             { r e t u r n ( ( i n t ) ( P O I N T _ F O R M A T / 0 . 0 0 0 0 0 1 ) ) ; }  
       r e t u r n ( 1 ) ;  
       * /  
 }  
  
 i n t   S e l l N o w (  
       s t r i n g   s y m b o l ,  
       d o u b l e   l o t s ,  
       d o u b l e   s l l ,  
       d o u b l e   t p l ,  
       d o u b l e   s l p ,  
       d o u b l e   t p p ,  
       d o u b l e   s l i p p a g e = 0 ,  
       i n t   m a g i c = 0 ,  
       s t r i n g   c o m m e n t = " "  
       )  
 {  
       b o o l   s u c c e s s = O r d e r C r e a t e (  
             s y m b o l ,  
             P O S I T I O N _ T Y P E _ S E L L ,  
             l o t s ,  
             0 ,  
             s l l ,  
             t p l ,  
             s l p ,  
             t p p ,  
             s l i p p a g e ,  
             m a g i c ,  
             c o m m e n t ,  
             0  
             ) ;  
       r e t u r n ( s u c c e s s ) ;  
 }  
  
 s t r i n g   S e t S y m b o l ( s t r i n g   s y m b o l = " " )  
 {  
       i f   ( s y m b o l = = " " )   { s y m b o l = S y m b o l ( ) ; }  
       G e t S y m b o l ( s y m b o l ) ;   r e t u r n ( s y m b o l ) ;  
 }  
  
 i n t   S t r T o I n t e g e r ( s t r i n g   v a l u e ) { r e t u r n ( ( i n t ) S t r i n g T o I n t e g e r ( v a l u e ) ) ; }  
  
 v o i d   S t r i n g E x p l o d e ( s t r i n g   s D e l i m i t e r ,   s t r i n g   s E x p l o d e ,   s t r i n g   & s R e t u r n [ ] ) { 
       i n t   i l B e g i n   =   - 1 , i l E n d   =   0 ; 
       i n t   i l E l e m e n t = 0 ; 
       w h i l e   ( i l E n d   ! =   - 1 ) { 
             i l E n d   =   S t r i n g F i n d ( s E x p l o d e ,   s D e l i m i t e r ,   i l B e g i n + 1 ) ; 
             A r r a y R e s i z e ( s R e t u r n , i l E l e m e n t + 1 ) ; 
             s R e t u r n [ i l E l e m e n t ]   =   " " ;           
             i f   ( i l E n d   = =   - 1 ) { 
                   i f   ( i l B e g i n + 1   ! =   S t r i n g L e n ( s E x p l o d e ) ) { 
                         s R e t u r n [ i l E l e m e n t ]   =   S t r i n g S u b s t r ( s E x p l o d e ,   i l B e g i n + 1 ,   S t r i n g L e n ( s E x p l o d e ) ) ; 
                   } 
             }   e l s e   {   
                   i f   ( i l B e g i n + 1   ! =   i l E n d ) { 
                         s R e t u r n [ i l E l e m e n t ]   =   S t r i n g S u b s t r ( s E x p l o d e ,   i l B e g i n + 1 ,   i l E n d - i l B e g i n - 1 ) ; 
                   } 
             }             
             i l B e g i n   =   S t r i n g F i n d ( s E x p l o d e ,   s D e l i m i t e r , i l E n d ) ;     
             i l E l e m e n t + + ;         
       } 
 } 
 
 v o i d   S t r i n g E x p l o d e ( s t r i n g   s D e l i m i t e r ,   s t r i n g   s E x p l o d e ,   i n t   & s R e t u r n [ ] ) { 
       i n t   i l B e g i n   =   - 1 , i l E n d   =   0 ; 
       i n t   i l E l e m e n t = 0 ; 
       w h i l e   ( i l E n d   ! =   - 1 ) { 
             i l E n d   =   S t r i n g F i n d ( s E x p l o d e ,   s D e l i m i t e r ,   i l B e g i n + 1 ) ; 
             A r r a y R e s i z e ( s R e t u r n , i l E l e m e n t + 1 ) ; 
             s R e t u r n [ i l E l e m e n t ]   =   0 ;           
             i f   ( i l E n d   = =   - 1 ) { 
                   i f   ( i l B e g i n + 1   ! =   S t r i n g L e n ( s E x p l o d e ) ) { 
                         s R e t u r n [ i l E l e m e n t ]   =   ( i n t ) S t r i n g T o I n t e g e r ( S t r i n g S u b s t r ( s E x p l o d e ,   i l B e g i n + 1 ,   S t r i n g L e n ( s E x p l o d e ) ) ) ; 
                   } 
             }   e l s e   {   
                   i f   ( i l B e g i n + 1   ! =   i l E n d ) { 
                         s R e t u r n [ i l E l e m e n t ]   =   ( i n t ) S t r i n g T o I n t e g e r ( S t r i n g S u b s t r ( s E x p l o d e ,   i l B e g i n + 1 ,   i l E n d - i l B e g i n - 1 ) ) ; 
                   } 
             }             
             i l B e g i n   =   S t r i n g F i n d ( s E x p l o d e ,   s D e l i m i t e r , i l E n d ) ;     
             i l E l e m e n t + + ;         
       } 
 } 
 
 v o i d   S t r i n g E x p l o d e ( s t r i n g   s D e l i m i t e r ,   s t r i n g   s E x p l o d e ,   d o u b l e   & s R e t u r n [ ] ) { 
       i n t   i l B e g i n   =   - 1 , i l E n d   =   0 ; 
       i n t   i l E l e m e n t = 0 ; 
       w h i l e   ( i l E n d   ! =   - 1 ) { 
             i l E n d   =   S t r i n g F i n d ( s E x p l o d e ,   s D e l i m i t e r ,   i l B e g i n + 1 ) ; 
             A r r a y R e s i z e ( s R e t u r n , i l E l e m e n t + 1 ) ; 
             s R e t u r n [ i l E l e m e n t ]   =   0 ;           
             i f   ( i l E n d   = =   - 1 ) { 
                   i f   ( i l B e g i n + 1   ! =   S t r i n g L e n ( s E x p l o d e ) ) { 
                         s R e t u r n [ i l E l e m e n t ]   =   ( d o u b l e ) S t r i n g T o D o u b l e ( S t r i n g S u b s t r ( s E x p l o d e ,   i l B e g i n + 1 ,   S t r i n g L e n ( s E x p l o d e ) ) ) ; 
                   } 
             }   e l s e   {   
                   i f   ( i l B e g i n + 1   ! =   i l E n d ) { 
                         s R e t u r n [ i l E l e m e n t ]   =   ( d o u b l e ) S t r i n g T o D o u b l e ( S t r i n g S u b s t r ( s E x p l o d e ,   i l B e g i n + 1 ,   i l E n d - i l B e g i n - 1 ) ) ; 
                   } 
             }             
             i l B e g i n   =   S t r i n g F i n d ( s E x p l o d e ,   s D e l i m i t e r , i l E n d ) ;     
             i l E l e m e n t + + ;         
       } 
 }  
  
 s t r i n g   S t r i n g T r i m ( s t r i n g   t e x t )  
 {  
       S t r i n g T r i m R i g h t ( t e x t ) ;  
       S t r i n g T r i m L e f t ( t e x t ) ;  
       r e t u r n ( t e x t ) ;  
 }  
  
 d o u b l e   S y m b o l A s k ( s t r i n g   s y m b o l = " " )  
 {  
       i f   ( s y m b o l = = " " )   { s y m b o l = G e t S y m b o l ( ) ; }  
       r e t u r n ( S y m b o l I n f o D o u b l e ( s y m b o l , S Y M B O L _ A S K ) ) ;  
 }  
  
 d o u b l e   S y m b o l B i d ( s t r i n g   s y m b o l = " " )  
 {  
       i f   ( s y m b o l = = " " )   { s y m b o l = G e t S y m b o l ( ) ; }  
       r e t u r n ( S y m b o l I n f o D o u b l e ( s y m b o l , S Y M B O L _ B I D ) ) ;  
 }  
  
 d o u b l e   S y m b o l L o t S i z e ( s t r i n g   s y m b o l = " " )  
 {  
 	 i f   ( s y m b o l = = " " )   { s y m b o l = S y m b o l ( ) ; }  
       r e t u r n   S y m b o l I n f o D o u b l e ( s y m b o l , S Y M B O L _ T R A D E _ C O N T R A C T _ S I Z E ) ;  
 }  
  
 d o u b l e   S y m b o l L o t S t e p ( s t r i n g   s y m b o l = " " )  
 {  
       i f   ( s y m b o l = = " " )   { s y m b o l = S y m b o l ( ) ; }  
       r e t u r n   S y m b o l I n f o D o u b l e ( s y m b o l , S Y M B O L _ V O L U M E _ S T E P ) ;  
 }  
  
 d o u b l e   S y m b o l M a x L o t ( s t r i n g   s y m b o l = " " )  
 {  
       i f   ( s y m b o l = = " " )   { s y m b o l = S y m b o l ( ) ; }  
       r e t u r n   ( S y m b o l I n f o D o u b l e ( s y m b o l , S Y M B O L _ V O L U M E _ M A X ) ) ;  
 }  
  
 d o u b l e   S y m b o l M i n L o t ( s t r i n g   s y m b o l = " " )  
 {  
       i f   ( s y m b o l = = " " )   { s y m b o l = S y m b o l ( ) ; }  
       r e t u r n   ( S y m b o l I n f o D o u b l e ( s y m b o l , S Y M B O L _ V O L U M E _ M I N ) ) ;  
 }  
  
 d o u b l e   T i c k s D a t a ( s t r i n g   s y m b o l = " " ,   i n t   t y p e = 0 ,   i n t   s h i f t = 0 ) 
 { 
       
       / / r e t u r n ( M a r k e t I n f o ( s y m b o l , t y p e ) ) ; 
       s t a t i c   b o o l   c o l l e c t i n g _ t i c k s = f a l s e ; 
       / / s t a t i c   s t r i n g   f e e d e d _ s y m b o l s [ ] ; 
       s t a t i c   s t r i n g   s y m b o l s [ ] ; 
       s t a t i c   i n t   z e r o _ s i d [ ] ; 
       s t a t i c   d o u b l e   m e m o r y A S K [ ] [ 1 0 0 ] ; 
       s t a t i c   d o u b l e   m e m o r y B I D [ ] [ 1 0 0 ] ; 
       i n t   s i d = 0 ,   s i z e = 0 ,   i = 0 ,   i d = 0 ; 
       d o u b l e   a s k = 0 ,   b i d = 0 ,   r e t v a l = 0 ; 
       b o o l   e x i s t s = f a l s e ; 
       
       i f   ( A r r a y S i z e ( s y m b o l s ) = = 0 ) 
       { 
             A r r a y R e s i z e ( s y m b o l s , 1 ) ; 
             A r r a y R e s i z e ( z e r o _ s i d , 1 ) ; 
             A r r a y R e s i z e ( m e m o r y A S K , 1 ) ; 
             A r r a y R e s i z e ( m e m o r y B I D , 1 ) ; 
             
             s y m b o l s [ 0 ]   =   _ S y m b o l ; 
       } 
       
       i f   ( t y p e > 0   & &   s h i f t > 0 )   { c o l l e c t i n g _ t i c k s = t r u e ; } 
       i f   ( c o l l e c t i n g _ t i c k s = = f a l s e )   { 
             i f   ( t y p e > 0   & &   s h i f t = = 0 )   { 
                   / /   g o i n g   t o   g e t   t i c k s 
             }   e l s e   { r e t u r n ( 0 ) ; } 
       } 
 	 
 	 i f   ( s y m b o l = = " " )   { s y m b o l = _ S y m b o l ; } 
       
 	 i f   ( t y p e = = 0 ) 
 	 { 
             / / S t r i n g E x p l o d e ( " , " , s y m b o l , f e e d e d _ s y m b o l s ) ; 
 	       / / f o r   ( s = 0 ;   s < A r r a y S i z e ( f e e d e d _ s y m b o l s ) ;   s + + ) 
 	       / / { 
 	             / / s y m b o l = f e e d e d _ s y m b o l s [ s ] ; 
                   / / i f   ( s y m b o l = = " " )   { s y m b o l = S y m b o l ( ) ; } 
 	             e x i s t s = f a l s e ; 
                   s i z e = A r r a y S i z e ( s y m b o l s ) ; 
                   i f   ( s i z e = = 0 )   { A r r a y R e s i z e ( s y m b o l s ,   1 ) ; } 
 	             f o r   ( i = 0 ;   i < s i z e ;   i + + )   { 
 	                   i f   ( s y m b o l s [ i ] = = s y m b o l )   { e x i s t s = t r u e ;   s i d = i ;   b r e a k ; } 
 	             } 
                   i f   ( e x i s t s = = f a l s e )   { 
                         i n t   n e w s i z e = A r r a y S i z e ( s y m b o l s ) + 1 ; 
                         
                         
                         A r r a y R e s i z e ( s y m b o l s , n e w s i z e ) ;   s y m b o l s [ n e w s i z e - 1 ] = s y m b o l ; 
                         A r r a y R e s i z e ( z e r o _ s i d , n e w s i z e ) ; 
                         A r r a y R e s i z e ( m e m o r y A S K , n e w s i z e ) ; 
                         A r r a y R e s i z e ( m e m o r y B I D , n e w s i z e ) ; 
                         s i d = n e w s i z e ; 
                   } 
                   i f   ( s i d > = 0 )   { 
                         a s k = S y m b o l I n f o D o u b l e ( s y m b o l , S Y M B O L _ A S K ) ; 
                         b i d = S y m b o l I n f o D o u b l e ( s y m b o l , S Y M B O L _ B I D ) ; 
                         i f   ( b i d = = 0   & &   M Q L I n f o I n t e g e r ( M Q L _ T E S T E R ) )   { 
                               P r i n t ( " T i c k s   d a t a   c o l l e c t o r   e r r o r :   " + s y m b o l + "   c a n n o t   b e   b a c k t e s t e d .   O n l y   t h e   c u r r e n t   s y m b o l   c a n   b e   b a c k t e s t e d .   T h e   E A   w i l l   b e   t e r m i n a t e d . " ) ; 
                               E x p e r t R e m o v e ( ) ; 
                         } 
                         i f   ( s y m b o l = = _ S y m b o l   | |   a s k ! = m e m o r y A S K [ s i d ] [ 0 ]   | |   b i d ! = m e m o r y B I D [ s i d ] [ 0 ] ) 
                         { 
                               m e m o r y A S K [ s i d ] [ z e r o _ s i d [ s i d ] ] = a s k ; 
                               m e m o r y B I D [ s i d ] [ z e r o _ s i d [ s i d ] ] = b i d ; 
                               z e r o _ s i d [ s i d ] = z e r o _ s i d [ s i d ] + 1 ; 
                               i f   ( z e r o _ s i d [ s i d ] = = 1 0 0 )   { z e r o _ s i d [ s i d ] = 0 ; } 
 	                   } 
       	       } 
             / / } 
       } 
       e l s e   { 
             i f   ( s h i f t < = 0 )   { 
                   i f   ( t y p e = = S Y M B O L _ A S K )   { 
                         r e t u r n ( S y m b o l I n f o D o u b l e ( s y m b o l , S Y M B O L _ A S K ) ) ; 
                   } 
                   e l s e   i f   ( t y p e = = S Y M B O L _ B I D )   { 
                         r e t u r n ( S y m b o l I n f o D o u b l e ( s y m b o l , S Y M B O L _ B I D ) ) ;   
                   } 
                   e l s e   { 
                         d o u b l e   m i d = ( ( S y m b o l I n f o D o u b l e ( s y m b o l , S Y M B O L _ A S K ) + S y m b o l I n f o D o u b l e ( s y m b o l , S Y M B O L _ B I D ) ) / 2 ) ; 
                         r e t u r n ( m i d ) ; 
                   } 
             } 
             e l s e   { 
                   s i z e = A r r a y S i z e ( s y m b o l s ) ; 
                   f o r   ( i = 0 ;   i < s i z e ;   i + + )   { 
                         i f   ( s y m b o l s [ i ] = = s y m b o l )   { s i d = i ; } 
                   } 
                   i f   ( s h i f t < 1 0 0 )   { 
                         i d = z e r o _ s i d [ s i d ] - s h i f t - 1 ;   i f ( i d < 0 )   { i d = i d + 1 0 0 ; } 
                         
                         i f   ( t y p e = = S Y M B O L _ A S K )   { 
                               r e t v a l = ( m e m o r y A S K [ s i d ] [ i d ] ) ; 
                               i f   ( r e t v a l = = 0 )   { r e t v a l = S y m b o l I n f o D o u b l e ( s y m b o l , S Y M B O L _ A S K ) ; } 
                         } 
                         e l s e   i f   ( t y p e = = S Y M B O L _ B I D )   { 
                               r e t v a l = ( m e m o r y B I D [ s i d ] [ i d ] ) ; 
                               i f   ( r e t v a l = = 0 )   { r e t v a l = S y m b o l I n f o D o u b l e ( s y m b o l , S Y M B O L _ B I D ) ; } 
                         } 
                         / / P r i n t ( s h i f t + "   " + i d + "   " + r e t v a l ) ; 
                   } 
             } 
       } 
       r e t u r n ( r e t v a l ) ; 
 }  
  
 i n t   T i c k s P e r S e c o n d ( b o o l   g e t _ m a x   =   f a l s e ,   b o o l   s e t   =   f a l s e )  
 {  
       s t a t i c   d a t e t i m e   t i m e 0   =   0 ;  
       d a t e t i m e   t i m e 1   =   T i m e L o c a l ( ) ;  
       s t a t i c   i n t   t i c k s ,   t p s ,   t p s m a x ;  
        
       i f   ( s e t   = =   t r u e )  
       {  
             i f   ( t i m e 1   >   t i m e 0 )  
             {  
                   i f   ( t i m e 1 - t i m e 0   >   1 )  
                   {  
                         t p s   =   0 ;  
                   }  
                   e l s e  
                   {  
                         t p s   =   t i c k s ;  
                   }  
                   t i m e 0   =   t i m e 1 ;  
                   t i c k s   =   0 ;  
             }  
              
             t i c k s + + ;  
              
             i f   ( t p s   >   t p s m a x )   { t p s m a x   =   t p s ; }  
       }  
        
       i f   ( g e t _ m a x )  
       {  
             r e t u r n   t p s m a x ;  
       }  
        
       r e t u r n   t p s ;  
 }  
  
 d a t e t i m e   T i m e A t S t a r t ( s t r i n g   c m d = " s e r v e r " )  
 {  
       s t a t i c   d a t e t i m e   l o c a l = 0 ;  
       s t a t i c   d a t e t i m e   s e r v e r = 0 ;  
        
       i f   ( c m d = = " l o c a l " )   { r e t u r n ( l o c a l ) ; }  
       e l s e   i f   ( c m d = = " s e r v e r " )   { r e t u r n ( s e r v e r ) ; }  
       e l s e   i f   ( c m d = = " s e t " )   {  
             l o c a l = T i m e L o c a l ( ) ;  
             s e r v e r = T i m e C u r r e n t ( ) ;  
       }  
       r e t u r n ( 0 ) ;  
 }  
  
 d a t e t i m e   T i m e F r o m S t r i n g ( i n t   m o d e _ t i m e ,   s t r i n g   s t a m p ) 
 { 
       d a t e t i m e   t   =   0 ; 
 
                 i f   ( m o d e _ t i m e   = =   0 )   t   =   T i m e C u r r e n t ( ) ; 
       e l s e   i f   ( m o d e _ t i m e   = =   1 )   t   =   T i m e L o c a l ( ) ; 
       e l s e   i f   ( m o d e _ t i m e   = =   2 )   t   =   T i m e G M T ( ) ; 
 	 
 	 i n t   s t a m p l e n   =   S t r i n g L e n ( s t a m p ) ; 
 
       i f   ( s t a m p l e n   <   9 ) 
       { 
             i n t   t h o u r   =   T i m e H o u r ( t ) ; 
             i n t   t m i n u t e   =   T i m e M i n u t e ( t ) ; 
             i n t   t s e c o n d s   =   T i m e S e c o n d s ( t ) ; 
       
             i n t   h o u r   =   ( i n t ) S t r i n g S u b s t r ( s t a m p ,   0 ,   2 ) ; 
             i n t   m i n u t e   =   ( i n t ) S t r i n g S u b s t r ( s t a m p ,   3 ,   2 ) ; 
 	 	 i n t   s e c o n d   =   0 ; 
 	 	 
 	 	 i f   ( s t a m p l e n   >   5 )   { 
 	 	 	 s e c o n d   =   ( i n t ) S t r i n g S u b s t r ( s t a m p ,   6 ,   2 ) ; 
 	 	 } 
       
             d a t e t i m e   t 1   =   ( d a t e t i m e ) ( t   -   ( t h o u r - h o u r ) * 3 6 0 0   -   ( t m i n u t e   -   m i n u t e ) * 6 0   -   ( t s e c o n d s - s e c o n d ) ) ; 
 
             r e t u r n   t 1 ; 
       } 
 	 
 	 r e t u r n   S t r i n g T o T i m e ( s t a m p ) ; 
 }  
  
 i n t   T i m e H o u r ( d a t e t i m e   t i m e )  
 {  
 	 M q l D a t e T i m e   t m ;  
       T i m e T o S t r u c t ( t i m e , t m ) ;  
       r e t u r n ( t m . h o u r ) ;  
 }  
  
 i n t   T i m e M i n u t e ( d a t e t i m e   t i m e )  
 {  
 	 M q l D a t e T i m e   t m ;  
       T i m e T o S t r u c t ( t i m e , t m ) ;  
       r e t u r n ( t m . m i n ) ;  
 }  
  
 i n t   T i m e S e c o n d s ( d a t e t i m e   t i m e )  
 {  
 	 M q l D a t e T i m e   t m ;  
       T i m e T o S t r u c t ( t i m e , t m ) ;  
       r e t u r n ( t m . s e c ) ;  
 }  
  
 v o i d   U p d a t e E v e n t V a l u e s ( u l o n g   d e a l _ t i c k e t ,   s t r i n g   e _ r e a s o n = " " ,   s t r i n g   e _ d e t a i l = " " )  
 {  
       e _ R e a s o n ( t r u e ,   e _ r e a s o n ) ;  
       e _ R e a s o n D e t a i l ( t r u e ,   e _ d e t a i l ) ;  
       e _ a t t r C l o s e P r i c e   ( t r u e , H i s t o r y D e a l G e t D o u b l e ( d e a l _ t i c k e t , D E A L _ P R I C E ) ) ;  
       e _ a t t r C l o s e T i m e     ( t r u e , 0 ) ;  
       e _ a t t r C o m m e n t         ( t r u e , H i s t o r y D e a l G e t S t r i n g ( d e a l _ t i c k e t , D E A L _ C O M M E N T ) ) ;  
       e _ a t t r C o m m i s s i o n   ( t r u e , H i s t o r y D e a l G e t D o u b l e ( d e a l _ t i c k e t , D E A L _ C O M M I S S I O N ) ) ;  
       e _ a t t r E x p i r a t i o n   ( t r u e , 0 ) ;  
       e _ a t t r L o t s               ( t r u e , H i s t o r y D e a l G e t D o u b l e ( d e a l _ t i c k e t , D E A L _ V O L U M E ) ) ;  
       e _ a t t r M a g i c N u m b e r ( t r u e , H i s t o r y O r d e r G e t I n t e g e r ( H i s t o r y D e a l G e t I n t e g e r ( d e a l _ t i c k e t , D E A L _ P O S I T I O N _ I D ) , O R D E R _ M A G I C ) ) ;  
       e _ a t t r O p e n P r i c e     ( t r u e , H i s t o r y D e a l G e t D o u b l e ( d e a l _ t i c k e t , D E A L _ P R I C E ) ) ;  
       e _ a t t r O p e n T i m e       ( t r u e , H i s t o r y D e a l G e t I n t e g e r ( d e a l _ t i c k e t , D E A L _ T I M E ) ) ;  
       e _ a t t r P r o f i t           ( t r u e , H i s t o r y D e a l G e t D o u b l e ( d e a l _ t i c k e t , D E A L _ P R O F I T ) ) ;  
       e _ a t t r S t o p L o s s       ( t r u e , H i s t o r y O r d e r G e t D o u b l e ( H i s t o r y D e a l G e t I n t e g e r ( d e a l _ t i c k e t , D E A L _ O R D E R ) , O R D E R _ S L ) ) ;  
       e _ a t t r S y m b o l           ( t r u e , H i s t o r y D e a l G e t S t r i n g ( d e a l _ t i c k e t , D E A L _ S Y M B O L ) ) ;  
       e _ a t t r S w a p               ( t r u e , H i s t o r y D e a l G e t D o u b l e ( d e a l _ t i c k e t , D E A L _ S W A P ) ) ;  
       e _ a t t r T a k e P r o f i t   ( t r u e , H i s t o r y O r d e r G e t D o u b l e ( H i s t o r y D e a l G e t I n t e g e r ( d e a l _ t i c k e t , D E A L _ O R D E R ) , O R D E R _ T P ) ) ;  
       e _ a t t r T i c k e t           ( t r u e , d e a l _ t i c k e t ) ;  
       i n t   t y p e = ( i n t ) H i s t o r y D e a l G e t I n t e g e r ( d e a l _ t i c k e t , D E A L _ T Y P E ) ;  
       i f   ( e _ r e a s o n = = " c l o s e " )   {  
             i f   ( t y p e = = 0 )   { t y p e = 1 ; }  
             e l s e   i f   ( t y p e = = 1 )   { t y p e = 0 ; }  
       }  
       e _ a t t r T y p e ( t r u e , t y p e ) ;  
 }  
 v o i d   U p d a t e E v e n t V a l u e s ( p o s i t i o n   & d a t a ,   s t r i n g   e _ r e a s o n = " " ,   s t r i n g   e _ d e t a i l = " " )  
 {  
       e _ R e a s o n                   ( t r u e , e _ r e a s o n ) ;  
       e _ R e a s o n D e t a i l       ( t r u e , e _ d e t a i l ) ;  
       e _ a t t r C l o s e P r i c e   ( t r u e , d a t a . p r i c e _ c u r r e n t ) ;  
       e _ a t t r C l o s e T i m e     ( t r u e , 0 ) ;  
       e _ a t t r C o m m e n t         ( t r u e , d a t a . c o m m e n t ) ;  
       e _ a t t r C o m m i s s i o n   ( t r u e , d a t a . c o m i s s i o n ) ;  
       e _ a t t r E x p i r a t i o n   ( t r u e , 0 ) ;  
       e _ a t t r L o t s               ( t r u e , d a t a . v o l u m e ) ;  
       e _ a t t r M a g i c N u m b e r ( t r u e , d a t a . m a g i c ) ;  
       e _ a t t r O p e n P r i c e     ( t r u e , d a t a . p r i c e _ o p e n ) ;  
       e _ a t t r O p e n T i m e       ( t r u e , d a t a . t i m e ) ;  
       e _ a t t r P r o f i t           ( t r u e , d a t a . p r o f i t ) ;  
       e _ a t t r S t o p L o s s       ( t r u e , d a t a . s l ) ;  
       e _ a t t r S y m b o l           ( t r u e , d a t a . s y m b o l ) ;  
       e _ a t t r S w a p               ( t r u e , d a t a . s w a p ) ;  
       e _ a t t r T a k e P r o f i t   ( t r u e , d a t a . t p ) ;  
       e _ a t t r T i c k e t           ( t r u e , d a t a . p o s i t i o n _ i d ) ;  
  
       i f   ( e _ r e a s o n = = " c l o s e " )   {  
             i f   ( d a t a . t y p e = = 0 )   { d a t a . t y p e = 1 ; }  
             e l s e   i f   ( d a t a . t y p e = = 1 )   { d a t a . t y p e = 0 ; }  
       }  
        
       e _ a t t r T y p e               ( t r u e , ( i n t ) d a t a . t y p e ) ;  
 }  
 v o i d   U p d a t e E v e n t V a l u e s ( o r d e r   & d a t a ,   s t r i n g   e _ r e a s o n = " " ,   s t r i n g   e _ d e t a i l = " " )  
 {  
       e _ R e a s o n ( t r u e ,   e _ r e a s o n ) ;  
       e _ R e a s o n D e t a i l ( t r u e ,   e _ d e t a i l ) ;  
       e _ a t t r C l o s e P r i c e   ( t r u e , d a t a . p r i c e _ c u r r e n t ) ;  
       e _ a t t r C l o s e T i m e     ( t r u e , d a t a . t i m e _ d o n e ) ;  
       e _ a t t r C o m m e n t         ( t r u e , d a t a . c o m m e n t ) ;  
       e _ a t t r C o m m i s s i o n   ( t r u e , 0 ) ;  
       e _ a t t r E x p i r a t i o n   ( t r u e , d a t a . t i m e _ e x p i r a t i o n ) ;  
       e _ a t t r L o t s               ( t r u e , d a t a . v o l u m e _ c u r r e n t ) ;  
       e _ a t t r M a g i c N u m b e r ( t r u e , d a t a . m a g i c ) ;  
       e _ a t t r O p e n P r i c e     ( t r u e , d a t a . p r i c e _ o p e n ) ;  
       e _ a t t r O p e n T i m e       ( t r u e , d a t a . t i m e _ s e t u p ) ;  
       e _ a t t r P r o f i t           ( t r u e , 0 ) ;  
       e _ a t t r S t o p L o s s       ( t r u e , d a t a . s l ) ;  
       e _ a t t r S y m b o l           ( t r u e , d a t a . s y m b o l ) ;  
       e _ a t t r S w a p               ( t r u e , 0 ) ;  
       e _ a t t r T a k e P r o f i t   ( t r u e , d a t a . t p ) ;  
       e _ a t t r T i c k e t           ( t r u e , d a t a . t i c k e t ) ;  
       e _ a t t r T y p e               ( t r u e , ( i n t ) d a t a . t y p e ) ;  
 }  
  
 d o u b l e   a s k ( s t r i n g   s y m b o l = " " )  
 {  
       i f   ( s y m b o l = = " " )   { s y m b o l = G e t S y m b o l ( ) ; }  
       r e t u r n ( S y m b o l I n f o D o u b l e ( s y m b o l , S Y M B O L _ A S K ) ) ;  
 }  
  
 d o u b l e   a t t r C l o s e P r i c e ( )   { r e t u r n   O r d e r C l o s e P r i c e ( ) ; }  
  
 d o u b l e   a t t r C o m m i s s i o n ( )   { r e t u r n   O r d e r C o m m i s s i o n ( ) ; }  
  
 d o u b l e   a t t r L o t s ( )   { r e t u r n   O r d e r L o t s ( ) ; }  
  
 d o u b l e   a t t r O p e n P r i c e ( )   { r e t u r n   O r d e r O p e n P r i c e ( ) ; }  
  
 d a t e t i m e   a t t r O p e n T i m e ( )   { r e t u r n   O r d e r O p e n T i m e ( ) ; }  
  
 d o u b l e   a t t r P r o f i t ( )   { r e t u r n   O r d e r P r o f i t ( ) ; }  
  
 d o u b l e   a t t r S w a p ( )   { r e t u r n   O r d e r S w a p ( ) ; }  
  
 s t r i n g   a t t r S y m b o l ( )   { r e t u r n   O r d e r S y m b o l ( ) ; }  
  
 u l o n g   a t t r T i c k e t ( u l o n g   t i c k e t = 0 )   { r e t u r n   O r d e r T i c k e t ( t i c k e t ) ; }  
  
 d o u b l e   b i d ( s t r i n g   s y m b o l = " " )  
 {  
       i f   ( s y m b o l = = " " )   { s y m b o l = G e t S y m b o l ( ) ; }  
       r e t u r n ( S y m b o l I n f o D o u b l e ( s y m b o l , S Y M B O L _ B I D ) ) ;  
 }  
  
 s t r i n g   e _ R e a s o n ( b o o l   s e t = f a l s e ,   s t r i n g   i n p = " " )   {  
       s t a t i c   s t r i n g   m e m [ 2 5 0 ] ;  
       i n t   q u e u e = O n T r a d e Q u e u e ( ) - 1 ;  
       i f ( s e t = = t r u e ) {  
             m e m [ q u e u e ] = i n p ;  
       }  
       r e t u r n ( m e m [ q u e u e ] ) ;  
 }  
  
 s t r i n g   e _ R e a s o n D e t a i l ( b o o l   s e t = f a l s e ,   s t r i n g   i n p = " " )   { s t a t i c   s t r i n g   m e m [ 2 5 0 ] ; i n t   q u e u e = O n T r a d e Q u e u e ( ) - 1 ; i f ( s e t = = t r u e ) { m e m [ q u e u e ] = i n p ; } r e t u r n ( m e m [ q u e u e ] ) ; }  
  
 d o u b l e   e _ a t t r C l o s e P r i c e ( b o o l   s e t = f a l s e ,   d o u b l e   i n p = - 1 )   { s t a t i c   d o u b l e   m e m [ 2 5 0 ] ; i n t   q u e u e = O n T r a d e Q u e u e ( ) - 1 ; i f ( s e t = = t r u e ) { m e m [ q u e u e ] = i n p ; } r e t u r n ( m e m [ q u e u e ] ) ; }  
  
 d a t e t i m e   e _ a t t r C l o s e T i m e ( b o o l   s e t = f a l s e ,   d a t e t i m e   i n p = - 1 )   { s t a t i c   d a t e t i m e   m e m [ 2 5 0 ] ; i n t   q u e u e = O n T r a d e Q u e u e ( ) - 1 ; i f ( s e t = = t r u e ) { m e m [ q u e u e ] = i n p ; } r e t u r n ( m e m [ q u e u e ] ) ; }  
  
 s t r i n g   e _ a t t r C o m m e n t ( b o o l   s e t = f a l s e ,   s t r i n g   i n p = " " )   { s t a t i c   s t r i n g   m e m [ 2 5 0 ] ; i n t   q u e u e = O n T r a d e Q u e u e ( ) - 1 ; i f ( s e t = = t r u e ) { m e m [ q u e u e ] = i n p ; } r e t u r n ( m e m [ q u e u e ] ) ; }  
  
 d o u b l e   e _ a t t r C o m m i s s i o n ( b o o l   s e t = f a l s e ,   d o u b l e   i n p = 0 )   { s t a t i c   d o u b l e   m e m [ 2 5 0 ] ; i n t   q u e u e = O n T r a d e Q u e u e ( ) - 1 ; i f ( s e t = = t r u e ) { m e m [ q u e u e ] = i n p ; } r e t u r n ( m e m [ q u e u e ] ) ; }  
  
 d a t e t i m e   e _ a t t r E x p i r a t i o n ( b o o l   s e t = f a l s e ,   d a t e t i m e   i n p = 0 )   { s t a t i c   d a t e t i m e   m e m [ 2 5 0 ] ; i n t   q u e u e = O n T r a d e Q u e u e ( ) - 1 ; i f ( s e t = = t r u e ) { m e m [ q u e u e ] = i n p ; } r e t u r n ( m e m [ q u e u e ] ) ; }  
  
 d o u b l e   e _ a t t r L o t s ( b o o l   s e t = f a l s e ,   d o u b l e   i n p = - 1 )   { s t a t i c   d o u b l e   m e m [ 2 5 0 ] ; i n t   q u e u e = O n T r a d e Q u e u e ( ) - 1 ; i f ( s e t = = t r u e ) { m e m [ q u e u e ] = i n p ; } r e t u r n ( m e m [ q u e u e ] ) ; }  
  
 u l o n g   e _ a t t r M a g i c N u m b e r ( b o o l   s e t = f a l s e ,   u l o n g   i n p = - 1 )   { s t a t i c   u l o n g   m e m [ 2 5 0 ] ; i n t   q u e u e = O n T r a d e Q u e u e ( ) - 1 ; i f ( s e t = = t r u e ) { m e m [ q u e u e ] = i n p ; } r e t u r n ( m e m [ q u e u e ] ) ; }  
  
 d o u b l e   e _ a t t r O p e n P r i c e ( b o o l   s e t = f a l s e ,   d o u b l e   i n p = - 1 )   { s t a t i c   d o u b l e   m e m [ 2 5 0 ] ; i n t   q u e u e = O n T r a d e Q u e u e ( ) - 1 ; i f ( s e t = = t r u e ) { m e m [ q u e u e ] = i n p ; } r e t u r n ( m e m [ q u e u e ] ) ; }  
  
 d a t e t i m e   e _ a t t r O p e n T i m e ( b o o l   s e t = f a l s e , d a t e t i m e   i n p = - 1 )   { s t a t i c   d a t e t i m e   m e m [ 2 5 0 ] ; i n t   q u e u e = O n T r a d e Q u e u e ( ) - 1 ; i f ( s e t = = t r u e ) { m e m [ q u e u e ] = i n p ; } r e t u r n ( m e m [ q u e u e ] ) ; }  
  
 d o u b l e   e _ a t t r P r o f i t ( b o o l   s e t = f a l s e ,   d o u b l e   i n p = 0 )   { s t a t i c   d o u b l e   m e m [ 2 5 0 ] ; i n t   q u e u e = O n T r a d e Q u e u e ( ) - 1 ; i f ( s e t = = t r u e ) { m e m [ q u e u e ] = i n p ; } r e t u r n ( m e m [ q u e u e ] ) ; }  
  
 d o u b l e   e _ a t t r S t o p L o s s ( b o o l   s e t = f a l s e ,   d o u b l e   i n p = - 1 )   { s t a t i c   d o u b l e   m e m [ 2 5 0 ] ; i n t   q u e u e = O n T r a d e Q u e u e ( ) - 1 ; i f ( s e t = = t r u e ) { m e m [ q u e u e ] = i n p ; } r e t u r n ( m e m [ q u e u e ] ) ; }  
  
 d o u b l e   e _ a t t r S w a p ( b o o l   s e t = f a l s e ,   d o u b l e   i n p = 0 )   { s t a t i c   d o u b l e   m e m [ 2 5 0 ] ; i n t   q u e u e = O n T r a d e Q u e u e ( ) - 1 ; i f ( s e t = = t r u e ) { m e m [ q u e u e ] = i n p ; } r e t u r n ( m e m [ q u e u e ] ) ; }  
  
 s t r i n g   e _ a t t r S y m b o l ( b o o l   s e t = f a l s e ,   s t r i n g   i n p = " " )   { s t a t i c   s t r i n g   m e m [ 2 5 0 ] ; i n t   q u e u e = O n T r a d e Q u e u e ( ) - 1 ; i f ( s e t = = t r u e ) { m e m [ q u e u e ] = i n p ; } r e t u r n ( m e m [ q u e u e ] ) ; }  
  
 d o u b l e   e _ a t t r T a k e P r o f i t ( b o o l   s e t = f a l s e ,   d o u b l e   i n p = - 1 )   { s t a t i c   d o u b l e   m e m [ 2 5 0 ] ; i n t   q u e u e = O n T r a d e Q u e u e ( ) - 1 ; i f ( s e t = = t r u e ) { m e m [ q u e u e ] = i n p ; } r e t u r n ( m e m [ q u e u e ] ) ; }  
  
 u l o n g   e _ a t t r T i c k e t ( b o o l   s e t = f a l s e ,   u l o n g   i n p = - 1 )   { s t a t i c   u l o n g   m e m [ 2 5 0 ] ; i n t   q u e u e = O n T r a d e Q u e u e ( ) - 1 ; i f ( s e t = = t r u e ) { m e m [ q u e u e ] = i n p ; } r e t u r n ( m e m [ q u e u e ] ) ; }  
  
 i n t   e _ a t t r T y p e ( b o o l   s e t = f a l s e ,   i n t   i n p = - 1 )   { s t a t i c   i n t   m e m [ 2 5 0 ] ; i n t   q u e u e = O n T r a d e Q u e u e ( ) - 1 ; i f ( s e t = = t r u e ) { m e m [ q u e u e ] = i n p ; } r e t u r n ( m e m [ q u e u e ] ) ; }  
  
 d o u b l e   t o D i g i t s ( d o u b l e   p i p s , s t r i n g   s y m b o l = " " )  
 {  
       i f   ( s y m b o l = = " " )   { s y m b o l = G e t S y m b o l ( ) ; }  
       r e t u r n (  
             N o r m a l i z e D o u b l e (  
                   p i p s * P i p V a l u e ( s y m b o l ) * S y m b o l I n f o D o u b l e ( s y m b o l , S Y M B O L _ P O I N T ) ,  
                   ( i n t ) S y m b o l I n f o I n t e g e r ( s y m b o l , S Y M B O L _ D I G I T S )  
             )  
       ) ;  
 }  
  
 d o u b l e   t o P i p s ( d o u b l e   d i g i t s , s t r i n g   s y m b o l = " " )  
 {  
       i f   ( s y m b o l = = " " )   { s y m b o l = G e t S y m b o l ( ) ; }  
       r e t u r n ( d i g i t s / ( P i p V a l u e ( s y m b o l ) * S y m b o l I n f o D o u b l e ( s y m b o l , S Y M B O L _ P O I N T ) ) ) ;  
 }  
  
  
  
 i n t   C u s t o m D i g i t s ( s t r i n g   s y m b o l = " " )  
 {  
 	 i f   ( s y m b o l   = =   " " )   { s y m b o l   =   G e t S y m b o l ( ) ; }  
 	 d o u b l e   p o i n t   =   C u s t o m P o i n t ( s y m b o l ) ;  
 	 i f   ( p o i n t = = 0 )   { r e t u r n ( 0 ) ; }  
 	 i n t   d i g i t s = 0 ;  
  
 	 w h i l e ( t r u e )  
 	 {  
 	 	 i f   ( p o i n t > = 1 )   { b r e a k ; }  
 	 	 p o i n t   =   p o i n t * 1 0 ;  
 	 	 d i g i t s + + ;  
 	 }  
  
 	 r e t u r n ( d i g i t s ) ;  
 }  
  
 d o u b l e   C u s t o m P o i n t ( s t r i n g   s y m b o l = " " )  
 {  
 	 s t a t i c   s t r i n g   s y m b o l s [ ] ;  
 	 s t a t i c   d o u b l e   p o i n t s [ ] ;  
 	 s t a t i c   s t r i n g   l a s t _ s y m b o l 	 =   " - " ;  
 	 s t a t i c   d o u b l e   l a s t _ p o i n t 	 =   0 ;  
 	 s t a t i c   i n t   l a s t _ i 	 	 	 	 =   0 ;  
 	 s t a t i c   i n t   s i z e 	 	 	 	 =   0 ;  
  
 	 / / - -   v a r i a n t   A )   u s e   t h e   c a c h e   f o r   t h e   l a s t   u s e d   s y m b o l  
 	 i f   ( s y m b o l   = =   " " )   { s y m b o l   =   G e t S y m b o l ( ) ; }  
 	 i f   ( s y m b o l   = =   l a s t _ s y m b o l )  
 	 {  
 	 	 r e t u r n ( l a s t _ p o i n t ) ;  
 	 }  
  
 	 / / - -   v a r i a n t   B )   s e a r c h   i n   t h e   a r r a y   c a c h e  
 	 i n t   i 	 	 	 =   l a s t _ i ;  
 	 i n t   s t a r t _ i 	 =   i ;  
 	 b o o l   f o u n d 	 =   f a l s e ;  
  
 	 i f   ( s i z e > 0 )  
 	 {  
 	 	 w h i l e ( t r u e )  
 	 	 {  
 	 	 	 i f   ( s y m b o l s [ i ]   = =   s y m b o l )  
 	 	 	 {  
 	 	 	 	 l a s t _ s y m b o l 	 =   s y m b o l ;  
 	 	 	 	 l a s t _ p o i n t 	 =   p o i n t s [ i ] ;  
 	 	 	 	 l a s t _ i 	 	 =   i ;  
  
 	 	 	 	 r e t u r n ( l a s t _ p o i n t ) ;  
 	 	 	 }  
  
 	 	 	 i + + ;  
 	 	 	 i f   ( i   > =   s i z e )  
 	 	 	 {  
 	 	 	 	 i = 0 ;  
 	 	 	 }  
 	 	 	 i f   ( i   = =   s t a r t _ i )   { b r e a k ; }  
 	 	 }  
 	 }  
  
 	 / / - -   v a r i a n t   C )   a d d   t h i s   s y m b o l   t o   t h e   c a c h e  
 	 i 	 	 =   s i z e ;  
 	 s i z e 	 =   s i z e + 1 ;  
  
 	 A r r a y R e s i z e ( s y m b o l s ,   s i z e ) ;  
 	 A r r a y R e s i z e ( p o i n t s ,   s i z e ) ;  
  
 	 s y m b o l s [ i ] 	 =   s y m b o l ;  
 	 p o i n t s [ i ] 	 =   0 ;  
 	 l a s t _ s y m b o l 	 =   s y m b o l ;  
 	 l a s t _ i 	 	 =   i ;  
  
 	 / / - -   u n s e r i a l i z e   r u l e s   f r o m   F X D _ P O I N T _ F O R M A T _ R U L E S  
 	 s t r i n g   r u l e s [ ] ;  
 	 S t r i n g E x p l o d e ( " , " ,   P O I N T _ F O R M A T _ R U L E S ,   r u l e s ) ;  
  
 	 i n t   r u l e s _ c o u n t   =   A r r a y S i z e ( r u l e s ) ;  
  
 	 i f   ( r u l e s _ c o u n t   >   0 )  
 	 {  
 	 	 s t r i n g   r u l e [ ] ;  
 	 	 f o r   ( i n t   r = 0 ;   r   <   r u l e s _ c o u n t ;   r + + )  
 	 	 {  
 	 	 	 S t r i n g E x p l o d e ( " = " ,   r u l e s [ r ] ,   r u l e ) ;  
  
 	 	 	 / / - -   a   s i n g l e   r u l e   m u s t   c o n t a i n   2   p a r t s ,   [ 0 ]   f r o m   a n d   [ 1 ]   t o  
 	 	 	 i f   ( A r r a y S i z e ( r u l e )   ! =   2 )   { c o n t i n u e ; }  
 	 	 	 d o u b l e   f r o m   =   S t r i n g T o D o u b l e ( r u l e [ 0 ] ) ;  
 	 	 	 d o u b l e   t o 	 =   S t r i n g T o D o u b l e ( r u l e [ 1 ] ) ;  
  
 	 	 	 / / - -   " t o "   m u s t   b e   a   p o s i t i v e   n u m b e r ,   d i f f e r e n t   t h a n   0  
 	 	 	 i f   ( t o   < =   0 )   { c o n t i n u e ; }  
  
 	 	 	 / / - -   " f r o m "   c a n   b e   a   n u m b e r   o r   a   s t r i n g  
 	 	 	 / /   a )   s t r i n g  
 	 	 	 i f   ( f r o m   = =   0   & &   S t r i n g L e n ( r u l e [ 0 ] )   >   0 )  
 	 	 	 {  
 	 	 	 	 s t r i n g   s _ f r o m   =   r u l e [ 0 ] ;  
 	 	 	 	 i n t   p o s   =   S t r i n g F i n d ( s _ f r o m ,   " ? " ) ;  
  
 	 	 	 	 i f   ( p o s   <   0 )   / /   ?   n o t   f o u n d  
 	 	 	 	 {  
 	 	 	 	 	 i f   ( S t r i n g F i n d ( s y m b o l ,   s _ f r o m )   = =   0 )   { p o i n t s [ i ]   =   t o ; }  
 	 	 	 	 }  
 	 	 	 	 e l s e   i f   ( p o s   = =   0 )   / /   ?   i s   t h e   f i r s t   s y m b o l   = >   m a t c h   t h e   s e c o n d   s y m b o l  
 	 	 	 	 {  
 	 	 	 	 	 i f   ( S t r i n g F i n d ( s y m b o l ,   S t r i n g S u b s t r ( s _ f r o m ,   1 ) ,   3 )   = =   3 )   { p o i n t s [ i ]   =   t o ; }  
 	 	 	 	 }  
 	 	 	 	 e l s e   i f   ( p o s   >   0 )   / /   ?   i s   t h e   s e c o n d   s y m b o l   = >   m a t c h   t h e   f i r s t   s y m b o l  
 	 	 	 	 {  
 	 	 	 	 	 i f   ( S t r i n g F i n d ( s y m b o l ,   S t r i n g S u b s t r ( s _ f r o m ,   0 ,   p o s ) )   = =   0 )   { p o i n t s [ i ]   =   t o ; }  
 	 	 	 	 }  
 	 	 	 }  
  
 	 	 	 / /   b )   n u m b e r  
 	 	 	 i f   ( f r o m   = =   0 )   { c o n t i n u e ; }  
  
 	 	 	 i f   ( S y m b o l I n f o D o u b l e ( s y m b o l ,   S Y M B O L _ P O I N T )   = =   f r o m )  
 	 	 	 {  
 	 	 	 	 p o i n t s [ i ]   =   t o ;  
 	 	 	 }  
 	 	 }  
 	 }  
  
 	 i f   ( p o i n t s [ i ]   = =   0 )   { p o i n t s [ i ]   =   S y m b o l I n f o D o u b l e ( s y m b o l ,   S Y M B O L _ P O I N T ) ; }  
 	 l a s t _ p o i n t = p o i n t s [ i ] ;  
  
 	 r e t u r n ( l a s t _ p o i n t ) ;  
 }  
  
 / /   B l o c k s   L o o k u p   F u n c t i o n s  
 s t r i n g   f x d B l o c k s L o o k u p T a b l e [ 8 ]   =   { " 3 " , " 7 " , " 8 " , " 9 " , " 1 0 " , " 1 1 " , " 1 2 " , " 1 4 " } ;  
  
 i n t   f x d B l o c k s L o o k u p T a b l e T r a n s l a t e I D ( s t r i n g   i d )  
 {  
 	 r e t u r n   A r r a y S e a r c h ( f x d B l o c k s L o o k u p T a b l e ,   i d ) ;  
 }  
 s t r i n g   f x d B l o c k s L o o k u p T a b l e T r a n s l a t e I D ( i n t   i d )  
 {  
 	 r e t u r n   f x d B l o c k s L o o k u p T a b l e [ i d ] ;  
 }  
  
 i n t   f x d B l o c k T o g g l e ( i n t   i d )  
 {  
 	 d i s a b l e d [ i d ]   =   ! d i s a b l e d [ i d ] ;  
 	 r e t u r n   d i s a b l e d [ i d ] ;  
 }  
  
 v o i d   f x d B l o c k T u r n O n ( i n t   i d )  
 {  
 	 d i s a b l e d [ i d ]   =   f a l s e ;  
 }  
 v o i d   f x d B l o c k T u r n O f f ( i n t   i d )  
 {  
 	 d i s a b l e d [ i d ]   =   t r u e ;  
 }  
 b o o l   f x d B l o c k R u n ( i n t   i d = 0 )  
 {  
 	 s w i t c h ( i d )  
 	 {  
 	 	 c a s e   0 :   b l o c k 0 ( ) ;   b r e a k ;  
 	 	 c a s e   1 :   b l o c k 1 ( ) ;   b r e a k ;  
 	 	 c a s e   2 :   b l o c k 2 ( ) ;   b r e a k ;  
 	 	 c a s e   3 :   b l o c k 3 ( ) ;   b r e a k ;  
 	 	 c a s e   4 :   b l o c k 4 ( ) ;   b r e a k ;  
 	 	 c a s e   5 :   b l o c k 5 ( ) ;   b r e a k ;  
 	 	 c a s e   6 :   b l o c k 6 ( ) ;   b r e a k ;  
 	 	 c a s e   7 :   b l o c k 7 ( ) ;   b r e a k ;  
 	 	 d e f a u l t :   r e t u r n   f a l s e ;  
 	 }  
  
 	 r e t u r n   t r u e ;  
 }  
 v o i d   f x d B l o c k G e t N e x t B l o c k s ( i n t   i d ,   i n t   & l i s t [ ] )  
 {  
 	 s w i t c h ( i d )  
 	 {  
 	 	 c a s e   0 :   A r r a y R e s i z e ( l i s t ,   1 ) ;   l i s t [ 0 ] = 7 ;   b r e a k ;  
 	 	 c a s e   2 :   A r r a y R e s i z e ( l i s t ,   1 ) ;   l i s t [ 0 ] = 1 ;   b r e a k ;  
 	 	 c a s e   3 :   A r r a y R e s i z e ( l i s t ,   1 ) ;   l i s t [ 0 ] = 2 ;   b r e a k ;  
 	 	 c a s e   4 :   A r r a y R e s i z e ( l i s t ,   1 ) ;   l i s t [ 0 ] = 0 ;   b r e a k ;  
 	 	 c a s e   5 :   A r r a y R e s i z e ( l i s t ,   1 ) ;   l i s t [ 0 ] = 0 ;   b r e a k ;  
 	 	 c a s e   6 :   A r r a y R e s i z e ( l i s t ,   1 ) ;   l i s t [ 0 ] = 0 ;   b r e a k ;  
 	 	 d e f a u l t :   A r r a y R e s i z e ( l i s t ,   0 ) ;  
 	 }  
 }  
  
 v o i d   f x d B l o c k G e t N e x t B l o c k s ( s t r i n g   i d ,   i n t   & l i s t [ ] )  
 {  
 	 f x d B l o c k G e t N e x t B l o c k s ( f x d B l o c k s L o o k u p T a b l e T r a n s l a t e I D ( i d ) ,   l i s t ) ;  
 }  
  
 c l a s s   F x d W a i t i n g  
 {  
 	 p r i v a t e :  
 	 	 i n t   b e g i n n i n g _ i d ;  
 	 	 u s h o r t   b a n k     [ ] [ 2 ] [ 2 0 ] ;   / /   2   b a n k s ,   2 0   p o s s i b l e   p a r a l l e l   w a i t i n g   b l o c k s   p e r   c h a i n   o f   b l o c k s  
 	 	 u s h o r t   s t a t e   [ ] [ 2 ] ;           / /   s e c o n d   d i m e n t i o n   v a l u e s :   0   -   c o u n t   o f   t h e   b l o c k s   p u t   o n   h o l d ,   1   -   c u r r e n t   b a n k   i d  
  
 	 p u b l i c :  
 	 	 v o i d   I n i t i a l i z e ( i n t   c o u n t )  
 	 	 {  
 	 	 	 A r r a y R e s i z e ( b a n k ,   c o u n t ) ;  
 	 	 	 A r r a y R e s i z e ( s t a t e ,   c o u n t ) ;  
 	 	 }  
  
 	 	 b o o l   R u n ( i n t   i d   =   0 )  
 	 	 {  
 	 	 	 b e g i n n i n g _ i d   =   i d ;  
  
 	 	 	 i n t   r a n g e   =   A r r a y R a n g e ( s t a t e ,   0 ) ;  
 	 	 	 i f   ( r a n g e   <   i d + 1 )   {  
 	 	 	 	 A r r a y R e s i z e ( b a n k ,   i d + 1 ) ;  
 	 	 	 	 A r r a y R e s i z e ( s t a t e ,   i d + 1 ) ;  
 	 	 	 	  
 	 	 	 	 / /   s e t   v a l u e s   t o   0 ,   o t h e r w i s e   t h e y   h a v e   r a n d o m   v a l u e s  
 	 	 	 	 f o r   ( i n t   i i = r a n g e ;   i i < i d + 1 ;   i i + + )  
 	 	 	 	 {  
 	 	 	 	       s t a t e [ i i ] [ 0 ]   =   0 ;  
 	 	 	 	       s t a t e [ i i ] [ 1 ]   =   0 ;  
 	 	 	 	 }  
 	 	 	 }  
  
 	 	 	 / /   a r e   t h e r e   b l o c k s   p u t   o n   h o l d ?  
 	 	 	 i n t   c o u n t   =   s t a t e [ i d ] [ 0 ] ;  
 	 	 	 i n t   b a n k _ i d   =   s t a t e [ i d ] [ 1 ] ;  
 	 	 	 / /   i f   n o   b l o c k   a r e   p u t   o n   h o l d   - >   e s c a p e  
 	 	 	 i f   ( c o u n t   = =   0 )   { r e t u r n   f a l s e ; }  
 	 	 	 e l s e  
 	 	 	 {  
 	 	 	       s t a t e [ i d ] [ 0 ]   =   0 ;   / /   n u l l   t h e   c o u n t  
 	 	 	       s t a t e [ i d ] [ 1 ]   =   ( b a n k _ i d )   ?   0   :   1 ;   / /   s w i t c h   t o   t h e   o t h e r   b a n k  
 	 	 	 }  
  
 	 	 	 / / = =   n o w   w e   w i l l   r u n   t h e   b l o c k s   p u t   o n   h o l d  
  
  
  
 	 	 	 f o r   ( i n t   i   =   0 ;   i   <   c o u n t ;   i + + )  
 	 	 	 {  
 	 	 	 	 i n t   b l o c k _ t o _ r u n   =   b a n k [ i d ] [ b a n k _ i d ] [ i ] ;  
 	 	 	 	 / / P r i n t ( c o u n t   +   "   "   +   b l o c k _ t o _ r u n ) ;  
 	 	 	 	 f x d B l o c k R u n ( b l o c k _ t o _ r u n ) ;  
 	 	 	 }  
  
 	 	 	 / / s t a t e [ i d ] [ 0 ]   =   0 ;  
  
  
 	 	 	 r e t u r n   t r u e ;  
 	 	 }  
  
 	 	 v o i d   A c c u m u l a t e ( i n t   b l o c k _ i d   =   0 )  
 	 	 {  
 	 	 	 i n t   c o u n t       =   + + s t a t e [ b e g i n n i n g _ i d ] [ 0 ] ;  
 	 	 	 i n t   b a n k _ i d   =   s t a t e [ b e g i n n i n g _ i d ] [ 1 ] ;  
  
 	 	 	 b a n k [ b e g i n n i n g _ i d ] [ b a n k _ i d ] [ c o u n t - 1 ]   =   ( u s h o r t ) b l o c k _ i d ;  
 	 	 }  
 } ;  
 F x d W a i t i n g   f x d W a i t ;  
  
  
 / / + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +  
 / / |   E N D                                                                                                                             |  
 / / |   C r e a t e d   w i t h   f x D r e e m a   E A   B u i l d e r                       h t t p s : / / f x d r e e m a . c o m /   |  
 / / + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +  
  
 / * < f x d r e e m a : e N r t W 1 t v 2 z g W / i t B 5 m U W S A e 6 + q I C A + T S 7 A 7 g N N k 4 H W C e D F q i H W 5 k U U t S b T 1 F / v s e 3 i R K s Z o E U T r t r P v Q 2 j y H 5 0 K e 7 / C j K q N k k n z h i e 8 n h y k t C p w K Q g t + + B Y l o + Q L S X z 4 E E q F O D l c E Z x n h 2 9 5 M k 4 O z 9 6 d H 3 + Y 3 c h v o + S Q 0 4 q l W H 4 B M 2 M z K B B b Y 2 E G J 4 d v 7 0 k S P N / a Z J e 1 q b I W P t 9 a + M B a k B z 6 n j I X D W X O V + b i o c w F y t z o W e Z g 4 6 I d 6 w Y O 7 u / V 8 D K n 6 Z 3 a 5 o n c Z r m U g S / N T 1 Q d C E Z z J Y 1 t c V y y D D M + T 2 m p o o U o 1 o x W p T J c i / 9 p h 6 S V J G l p z L e b J c 1 r A 2 F y i P L c h D 3 / 4 + L k c i a / e M m h n X B S b f k l m + N c R s K T C I K m 4 h Y y 4 M l U B 4 l I g Z m R 3 Z D 0 z n j O C E f L H M M K L R N P r x L + L D D T Z e 0 l X + 7 V w p L M X X Y w S f g i r b i g G z t x Y t d J L 6 B c 3 y 0 X e G P 8 b G i G 8 4 U x A 3 b e 0 y v K i c E P D I H f E j G 0 w e A b T F P K M u 7 k C O Z K A o i r 4 4 Q 1 5 S n K s R E W l G 2 Q W i E f Z n A s b Q n K V B K h x q Y K 3 5 f b H T i f w / q z 3 m s u k K j U t M A U E C 3 o a i V V P b 1 4 G R K o j u x e q Q g i d C Q 6 s 4 P S p G a C g / l q V Y x N s J H j l V C F N 4 n 1 9 g p a q s g i T 5 o E j U + I C G d P a C X K S n D X B o E x q e H r s L D 5 q g y A x Z T b 5 C E s W c Q o v Z M 1 V m R v U p p T Z i D x 0 / H 0 d H p + b s q 0 l k A e P 9 m E V l A 9 b z 5 h s r 4 V b t 5 + I I t M l v I b L r Y 6 f 1 u R U Q O M B Z Q T Q 0 0 x Q e 1 8 R I z I o q t L D C A 7 7 g P V V I 7 B J A W X C 6 i i L q J i I 9 s F J Y j n A r E 7 L O z E F p K 0 6 I l I 0 t a u G F 0 R 4 Y S x o Q X e m r U 8 p R u o O 9 u g f l X / B n b O 8 Q b W X v c W c O 1 B m K U a X + T 4 I 8 7 t u K t 7 R U r u d t 2 h o T w e A s p g 8 P Q W p 3 c f d O S v j e W g H 8 t D 4 D e I T T o H e n M O f q 4 K h l F O / s T Z P x 5 F c z x u o 9 m P 4 / 9 T N E / 6 0 O z 7 3 9 8 Z q Z N X D i 9 I U Q n M z Z p 5 d u Y F R r x i e B f s V V M A o D r w d i d K t Y c i W L U z / J E g e 0 b A e G S N H T N G P 5 3 W O y e p Z s 7 O M C 6 v S H H 3 C l 1 g M t C B f o P u s O 4 B r 3 6 g j 5 5 2 o E u W a t d c U s x m f F S P D 9 I 0 w M J p T j k 2 T U M u f 0 0 B + O N d o 8 s B 4 u d z A O 9 l X S M a T Y J l 1 O 0 a U r J S f 7 5 p 7 5 j 2 9 Y 7 x j 9 Y 6 d s N 8 c A R P h 0 B w Z G r 4 m 7 H y + A k g 9 n p A P B B w / b g G 7 p P R O g r a a A 2 j + A d B q y p a e R U e H L G + 1 w f Z q H M l 7 g N l C 3 d a x r e b h W 9 L 5 3 e a V x v 3 / F 2 R z z h r S + d A 0 g y a v V 9 8 m 0 o j u y b 8 z t D p 2 G t P t S K Y G v w S K 1 l o Z V e Y p V g f 3 6 E k 4 n r q x I p P J M A c H X t F l j l n b m C m D B r g + n I x 8 w o v 1 N 8 2 c W f x b E n / b u V O Z h D 6 6 e X 1 9 b v T m 9 8 u 3 z f 1 f a 9 D O 5 e r c y 3 7 z o e C C L s w k Z z u + b b y G 6 U z n G u Q Q H C B Z + W b z c X 6 N 5 h O U D 6 j + l B 3 A p h o h Y s q F 6 T M t 5 f F j H L b / A J l y + t q O D c E B X P d X 6 T O c Z Z J F y 0 j O o 5 p R 6 F l o x X q N Q b E 7 r A w b o n 7 Y v D D Y N S f b G h V r u G u x n h d h C j X n 7 W N c 7 K k v T a C Q K q c Q W / c L D E T j y x s r d f j M F A R z d C S V u k t Z r j f 3 K i t O C N c 2 O r z j 4 K j 8 C g 6 i o 9 G z V o 3 q n 2 5 K t d z / N 8 T x P E O h 7 4 R N 1 s B s 0 N w N W r N 3 r k V g R H 2 u R 5 Z 1 H 0 o S 8 x m Z E N a t 3 e Y P o e 2 L P 3 a V h H J Q 6 j A X b G 9 W j u I H j t S D e e b q 4 4 K + M l y q z Q I o u v M v 4 J n 6 b U c 1 G s 7 p a / 5 z Q b 1 6 z a g r z i O 3 M v E r o 1 s K e z Y y m l L r j d z P u s o B X I z G 7 V v t p 3 S b z m w 3 6 d t q P S c D e z 5 a V s K V u Y 5 K U u 0 x u 5 1 F / b p Y n t K N x t 7 d k I e M 1 q s n e e n L y T L v i S Z 3 g 6 a 4 F J o 8 3 z t x R x 6 p O 4 J 7 + m n 1 6 b O 0 f P v v 0 P Q 5 b H K 7 6 D Q C X 7 9 T j s 4 S f a f S Z I 9 b + J p S H w v J N l / J Z I c 7 E n y n i T v S f K e J O 9 J 8 p 4 k 7 0 n y 3 5 4 k g 7 X 5 L W X i L 2 D J / g A s W b Y Q n O d /  
 X 5 o 8 0 Q k + i S d 3 3 / 8 I X / 5 / P 8 8 l y q u V 9 5 0 R 5 e C V i H K 4 J 8 p 7 o r w n y n u i v C f K e 6 K 8 J 8 p 7 o v x 6 R D n Y E + V h i X I Y e B 2 i H O + J c t R H l A O d j K o g B o f f J Z t R q I U b s r H l w N W 4 P U O l Y C 4 Q c / u j g C B M F d d i k 7 z n J a Y / u H P / w I h 1 E n L s F v p 1 K e d w r Y V n a O u K X J v / o h V r t c L Y N a r e u O q y t 1 o 8 x 7 A k W f e N T C l + V 2 Q 7 E h 3 X Q i d N v z O v m 2 T g W O y k 6 N W i T o K N t Q f p h Y 0 5 N 7 m u c E d q c S 2 8 x r m M s s 1 b R 6 5 Y h d q W R 6 4 c 4 u X 9 x m X Q D 0 i x Y 7 z 1 H p z / U E E H 7 1 h 4 Y V M O b F N u V 6 r u a O 6 m d p t 0 N M R 7 c 2 a X z 0 k u D J 5 + 3 L f f b W U e r O p s H n l 6 E b W a 8 n T 8 r V 9 3 X 3 o 4 m I R / 8 e v u 9 w / 6 r 1 a e y O 0 T g h R r n b q n s g H H J a P / w a l Y F E j 3 Y z m U 2 n Z i h W J b 2 p L A n + F + I q x C K s s P F e v K 8 B 8 I 9 + L f s 7 h + T I A E X q Q M I 2 F + 2 h a P Y t + L R 6 E r h x I m q 6 2 W j y d R 7 E / C q b 1 u o T V J F 9 y 2 + 0 h e 4 u O J r e w 1 Q + X t g j I C J K t 5 r 1 X W D S 1 v 6 A k V C k Z 6 0 1 A q y E e I p Q f Y g e S H h B N Y y 0 V O l g y x 7 c J 9 h N N g T l J w q 6 m A 2 a c n S x H q l y 1 4 q 8 f U a 1 N S U o g F q 8 z u m c 7 R V O W K 6 e h j x U N 1 8 w 9 k e b f I 6 b 3 + p W d 3 0 k R P 8 r r z R m b c N 8 Q Z V r H i Q I o J E x X K Y a V p / T O f g j Y L 4 0 g X M i m F E M M + p 9 o E h l T X u E i 3 O 4 x I n Y 5 8 w c z v j J z H I V 0 V l D 0 4 M e H 2 X A g u S 6 Y + M c 0 O K g N a m m 5 T 2 B w o U 0 I z 2 3 v l w w d b z V D C h N U F Y 1 G o 2 z 7 U W i G a H 1 D K f q j f / V T M 1 G n a j U Q f C 9 D K H J R w w Q B q N Q w w T x k p W x 6 V h f o y 4 n R A 8 9 / o P f 6 C V / E X 9 v o L B / d n 4 L L D 3 9 p 5 h N r x l 9 F q 2 Z w L j / u r z y H T x Z z f t n U d P 9 Q Y K A B P Y 6 z b p n 3 z G 0 I O 8 L 9 d I P l 4 t h t S W z p s O D C K o C E 7 R w P 0 A P l M S k 2 W Y L n / H 4 p U F w k =  
 : f x d r e e m a > * / 