/ / + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + / /  
 / / )       _ _ _ _     _     _     _ _ _ _     _ _ _ _     _ _ _ _     _ _ _ _     _ _     _ _         _ _             _ _ _     _ _ _ _ _     _ _     _ _       ( / /  
 / / )     (   _ _ _ ) (   \ /   ) (     _   \ (     _   \ (   _ _ _ ) (   _ _ _ ) (     \ /     )     / _ _ \         /   _ _ ) (     _     ) (     \ /     )     ( / /  
 / / )       ) _ _ )     )     (     ) ( _ )   ) )       /   ) _ _ )     ) _ _ )     )         (     / ( _ _ ) \     (   ( _ _     ) ( _ ) (     )         (       ( / /  
 / / )     ( _ _ )     ( _ / \ _ ) ( _ _ _ _ / ( _ ) \ _ ) ( _ _ _ _ ) ( _ _ _ _ ) ( _ / \ / \ _ ) ( _ _ ) ( _ _ ) ( ) \ _ _ _ ) ( _ _ _ _ _ ) ( _ / \ / \ _ )     ( / /  
 / / )       h t t p s : / / f x d r e e m a . c o m                                                           C o p y r i g h t   2 0 2 0 ,   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 "  
 # p r o p e r t y   d e s c r i p t i o n   " "  
 # p r o p e r t y   v e r s i o n           " 1 . 0 "  
 # p r o p e r t y   s t r i c t  
  
 / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /  
 / /   + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +   / /  
 / /   |                                               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 - 8 6 6 2 "  
 / / - -  
 / /   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 1 = 0 . 0 0 0 1 , 0 . 0 0 0 0 0 1 = 0 . 0 0 0 1 "   / /   t h i s   i s   d e s e r i a l i z e d   i n   a   s p e c i a l   f u n c t i o n   l a t e r  
 # d e f i n e   E N A B L E _ S P R E A D _ M E T E R   t r u e  
 # d e f i n e   E N A B L E _ S T A T U S   t r u e  
 # d e f i n e   E N A B L E _ T E S T _ I N D I C A T O R S   t r u e  
 / / - -  
 / /   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  
 / / - -  
 / /   V i r t u a l   S t o p s  
 # d e f i n e   V I R T U A L _ S T O P S _ E N A B L E D   0   / /   e n a b l e   v i r t u a l   s t o p s  
 # d e f i n e   V I R T U A L _ S T O P S _ T I M E O U T   0   / /   v i r t u a l   s t o p s   t i m e o u t  
 # d e f i n e   U S E _ E M E R G E N C Y _ S T O P S   " n o "   / /   " y e s "   t o   u s e   e m e r g e n c y   ( h a r d   s t o p s )   w h e n   v i r t u a l   s t o p s   a r e   i n   u s e .   " a l w a y s "   t o   u s e   E M E R G E N C Y _ S T O P S _ A D D   a s   e m e r g e n c y   s t o p s   w h e n   t h e r e   i s   n o   v i r t u a l   s t o p .  
 # d e f i n e   E M E R G E N C Y _ S T O P S _ R E L   0   / /   u s e   0   t o   d i s a b l e   h a r d   s t o p s   w h e n   v i r t u a l   s t o p s   a r e   e n a b l e d .   U s e   a   v a l u e   > = 0   t o   a u t o m a t i c a l l y   s e t   h a r d   s t o p s   w i t h   v i r t u a l .   E x a m p l e :   i f   2   i s   u s e d ,   t h e n   h a r d   s t o p s   w i l l   b e   2   t i m e s   b i g g e r   t h a n   v i r t u a l   o n e s .  
 # d e f i n e   E M E R G E N C Y _ S T O P S _ A D D   0   / /   a d d   p i p s   t o   r e l a t i v e   s i z e   o f   e m e r g e n c y   s t o p s   ( h a r d   s t o p s )  
 / / - -  
 / /   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   6 0   / /   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 V V V V V V V V V V V V V V / /  
 / /   E n u m e r a t i o n s ,   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   / /  
 / / ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ / /  
  
 / / - -  
 / /   E n u m e r a t i o n s   b y   C u s t o m   I n d i c a t o r s  
  
 e n u m   E N U M _ V a l u e _ T y p e 
   { 
   P o i n t s = 0 , 
   P i p s = 1 , 
   } ;  
  
 e n u m   E N U M _ C O R N E R 
   { 
   L E F T _ U P P E R , 
   L E F T _ L O W E R , 
   R I G H T _ U P P E R , 
   R I G H T _ L O W E R , 
   } ;  
  
  
  
  
  
  
  
  
  
 / / - -  
 / /   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   i n t   M a g i c S t a r t   =   3 9 3 5 ;   / /   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   i n t   M a g i c S t a r t ;  
 } ;  
 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   a t r _ p i p s ;  
 	 s t a t i c   d o u b l e   p i p s _ f r o m _ o p e n _ p r i c e ;  
 } ;  
 d o u b l e   v : : a t r _ p i p s ;  
 d o u b l e   v : : p i p s _ f r o m _ o p e n _ p r i c e ;  
  
  
  
  
 / / 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   / /  
 / / ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ / /  
 / / - -  
 / /   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 [ ] ;  
  
 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 ;  
 b o o l   U S E _ V I R T U A L _ S T O P S   =   V I R T U A L _ S T O P S _ E N A B L E D ;  
 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                 =   5 5 ;  
 d a t e t i m e   F X D _ T I C K S K I P _ U N T I L   =   0 ;  
  
 i n t   F X D _ I C U S T O M _ H A N D L E S _ I D S [ ] ;   / /   o n l y   u s e d   i n   M Q L 5  
 s t r i n g   F X D _ I C U S T O M _ H A N D L E S _ K E Y S [ ] ;   / /   o n l y   u s e d   i n   M Q L 5  
  
 / / -   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  
 {  
 	 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 [ ] ;  
  
 / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /  
 / /   + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +   / /  
 / /   |                                                                                                   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 : : M a g i c S t a r t   =   M a g i c S t a r t ;  
  
  
  
  
 	 / /   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 ( ) ;  
  
 	 C u r r e n t S y m b o l ( F X D _ C U R R E N T _ S Y M B O L ) ;   / /   C u r r e n t S y m b o l ( )   h a s   i n t e r n a l   m e m o r y   t h a t   s h o u l d   b e   s e t   f r o m   h e r e   w h e n   t h e   s y m b o l l   i s   c h a n g e d  
 	 C u r r e n t T i m e f r a m e ( P E R I O D _ C U R R E N T ) ;  
  
 	 v : : a t r _ p i p s   =   0 . 0 ;  
 	 v : : p i p s _ f r o m _ o p e n _ p r i c e   =   0 . 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 ) ;  
  
 	 / / - -   d i s a b l e   v i r t u a l   s t o p s   i n   o p t i m i z a t i o n ,   b e c a u s e   g r a p h i c a l   o b j e c t s   d o e s   n o t   w o r k  
 	 / /   h t t p : / / d o c s . m q l 4 . c o m / r u n t i m e / t e s t i n g  
 	 i f   ( M Q L I n f o I n t e g e r ( M Q L _ O P T I M I Z A T I O N ) )   {  
 	 	 U S E _ V I R T U A L _ S T O P S   =   f a l s e ;  
 	 }  
  
 	 / / - -   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  
 	 i f   ( E N A B L E _ S P R E A D _ M E T E R   = =   f a l s e )   {  
 	 	 F X D _ D R A W _ S P R E A D _ I N F O   =   f a l s e ;  
 	 }  
 	 e l s e   {  
 	 	 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  
 	 i f   ( E N A B L E _ 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 . . . " ) ;  
  
 	 / / - -   d r a w   i n d i c a t o r s   a f t e r   t e s t  
 	 T e s t e r H i d e I n d i c a t o r s ( ! E N A B L E _ T E S T _ I N D I C A T O R S ) ;  
  
 	 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 ) ;  
 	 }  
  
  
 	 / / - -   I n i t i a l i z e   b l o c k s   c l a s s e s  
 	 A r r a y R e s i z e ( _ b l o c k s _ ,   5 5 ) ;  
  
 	 _ b l o c k s _ [ 0 ]   =   n e w   B l o c k 0 ( ) ;  
 	 _ b l o c k s _ [ 1 ]   =   n e w   B l o c k 1 ( ) ;  
 	 _ b l o c k s _ [ 2 ]   =   n e w   B l o c k 2 ( ) ;  
 	 _ b l o c k s _ [ 3 ]   =   n e w   B l o c k 3 ( ) ;  
 	 _ b l o c k s _ [ 4 ]   =   n e w   B l o c k 4 ( ) ;  
 	 _ b l o c k s _ [ 5 ]   =   n e w   B l o c k 5 ( ) ;  
 	 _ b l o c k s _ [ 6 ]   =   n e w   B l o c k 6 ( ) ;  
 	 _ b l o c k s _ [ 7 ]   =   n e w   B l o c k 7 ( ) ;  
 	 _ b l o c k s _ [ 8 ]   =   n e w   B l o c k 8 ( ) ;  
 	 _ b l o c k s _ [ 9 ]   =   n e w   B l o c k 9 ( ) ;  
 	 _ b l o c k s _ [ 1 0 ]   =   n e w   B l o c k 1 0 ( ) ;  
 	 _ b l o c k s _ [ 1 1 ]   =   n e w   B l o c k 1 1 ( ) ;  
 	 _ b l o c k s _ [ 1 2 ]   =   n e w   B l o c k 1 2 ( ) ;  
 	 _ b l o c k s _ [ 1 3 ]   =   n e w   B l o c k 1 3 ( ) ;  
 	 _ b l o c k s _ [ 1 4 ]   =   n e w   B l o c k 1 4 ( ) ;  
 	 _ b l o c k s _ [ 1 5 ]   =   n e w   B l o c k 1 5 ( ) ;  
 	 _ b l o c k s _ [ 1 6 ]   =   n e w   B l o c k 1 6 ( ) ;  
 	 _ b l o c k s _ [ 1 7 ]   =   n e w   B l o c k 1 7 ( ) ;  
 	 _ b l o c k s _ [ 1 8 ]   =   n e w   B l o c k 1 8 ( ) ;  
 	 _ b l o c k s _ [ 1 9 ]   =   n e w   B l o c k 1 9 ( ) ;  
 	 _ b l o c k s _ [ 2 0 ]   =   n e w   B l o c k 2 0 ( ) ;  
 	 _ b l o c k s _ [ 2 1 ]   =   n e w   B l o c k 2 1 ( ) ;  
 	 _ b l o c k s _ [ 2 2 ]   =   n e w   B l o c k 2 2 ( ) ;  
 	 _ b l o c k s _ [ 2 3 ]   =   n e w   B l o c k 2 3 ( ) ;  
 	 _ b l o c k s _ [ 2 4 ]   =   n e w   B l o c k 2 4 ( ) ;  
 	 _ b l o c k s _ [ 2 5 ]   =   n e w   B l o c k 2 5 ( ) ;  
 	 _ b l o c k s _ [ 2 6 ]   =   n e w   B l o c k 2 6 ( ) ;  
 	 _ b l o c k s _ [ 2 7 ]   =   n e w   B l o c k 2 7 ( ) ;  
 	 _ b l o c k s _ [ 2 8 ]   =   n e w   B l o c k 2 8 ( ) ;  
 	 _ b l o c k s _ [ 2 9 ]   =   n e w   B l o c k 2 9 ( ) ;  
 	 _ b l o c k s _ [ 3 0 ]   =   n e w   B l o c k 3 0 ( ) ;  
 	 _ b l o c k s _ [ 3 1 ]   =   n e w   B l o c k 3 1 ( ) ;  
 	 _ b l o c k s _ [ 3 2 ]   =   n e w   B l o c k 3 2 ( ) ;  
 	 _ b l o c k s _ [ 3 3 ]   =   n e w   B l o c k 3 3 ( ) ;  
 	 _ b l o c k s _ [ 3 4 ]   =   n e w   B l o c k 3 4 ( ) ;  
 	 _ b l o c k s _ [ 3 5 ]   =   n e w   B l o c k 3 5 ( ) ;  
 	 _ b l o c k s _ [ 3 6 ]   =   n e w   B l o c k 3 6 ( ) ;  
 	 _ b l o c k s _ [ 3 7 ]   =   n e w   B l o c k 3 7 ( ) ;  
 	 _ b l o c k s _ [ 3 8 ]   =   n e w   B l o c k 3 8 ( ) ;  
 	 _ b l o c k s _ [ 3 9 ]   =   n e w   B l o c k 3 9 ( ) ;  
 	 _ b l o c k s _ [ 4 0 ]   =   n e w   B l o c k 4 0 ( ) ;  
 	 _ b l o c k s _ [ 4 1 ]   =   n e w   B l o c k 4 1 ( ) ;  
 	 _ b l o c k s _ [ 4 2 ]   =   n e w   B l o c k 4 2 ( ) ;  
 	 _ b l o c k s _ [ 4 3 ]   =   n e w   B l o c k 4 3 ( ) ;  
 	 _ b l o c k s _ [ 4 4 ]   =   n e w   B l o c k 4 4 ( ) ;  
 	 _ b l o c k s _ [ 4 5 ]   =   n e w   B l o c k 4 5 ( ) ;  
 	 _ b l o c k s _ [ 4 6 ]   =   n e w   B l o c k 4 6 ( ) ;  
 	 _ b l o c k s _ [ 4 7 ]   =   n e w   B l o c k 4 7 ( ) ;  
 	 _ b l o c k s _ [ 4 8 ]   =   n e w   B l o c k 4 8 ( ) ;  
 	 _ b l o c k s _ [ 4 9 ]   =   n e w   B l o c k 4 9 ( ) ;  
 	 _ b l o c k s _ [ 5 0 ]   =   n e w   B l o c k 5 0 ( ) ;  
 	 _ b l o c k s _ [ 5 1 ]   =   n e w   B l o c k 5 1 ( ) ;  
 	 _ b l o c k s _ [ 5 2 ]   =   n e w   B l o c k 5 2 ( ) ;  
 	 _ b l o c k s _ [ 5 3 ]   =   n e w   B l o c k 5 3 ( ) ;  
 	 _ b l o c k s _ [ 5 4 ]   =   n e w   B l o c k 5 4 ( ) ;  
  
 	 / /   f i l l   t h e   l o o k u p   t a b l e  
 	 A r r a y R e s i z e ( f x d B l o c k s L o o k u p T a b l e ,   A r r a y S i z e ( _ b l o c k s _ ) ) ;  
 	 f o r   ( i n t   i = 0 ;   i < A r r a y S i z e ( _ b l o c k s _ ) ;   i + + )  
 	 {  
 	 	 f x d B l o c k s L o o k u p T a b l e [ i ]   =   _ b l o c k s _ [ i ] . _ _ b l o c k _ u s e r _ n u m b e r ;  
 	 }  
  
 	 / /   f i l l   t h e   l i s t   o f   i n b o u n d   b l o c k s   f o r   e a c h   B l o c k C a l l s   i n s t a n c e  
 	 f o r   ( i n t   i = 0 ;   i < A r r a y S i z e ( _ b l o c k s _ ) ;   i + + )  
 	 {  
 	 	 _ b l o c k s _ [ i ] . _ _ a n n o u n c e T h i s B l o c k ( ) ;  
 	 }  
  
 	 / /   L i s t   o f   i n i t i a l l y   d i s a b l e d   b l o c k s  
 	 i n t   d i s a b l e d _ b l o c k s _ l i s t [ ]   =   { } ;  
 	 f o r   ( i n t   l   =   0 ;   l   <   A r r a y S i z e ( d i s a b l e d _ b l o c k s _ l i s t ) ;   l + + )   {  
 	 	 _ b l o c k s _ [ d i s a b l e d _ b l o c k s _ l i s t [ l ] ] . _ _ d i s a b l e d   =   t r u e ;  
 	 }  
  
 	 / / - -   r u n   b l o c k s  
 	 i n t   b l o c k s _ t o _ r u n [ ]   =   { 5 0 } ;  
 	 f o r   ( i n t   i = 0 ;   i < A r r a y S i z e ( b l o c k s _ t o _ r u n ) ;   i + + )   {  
 	 	 _ b l o c k s _ [ b l o c k s _ t o _ r u n [ i ] ] . r u n ( ) ;  
 	 }  
  
  
 	 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   / /  
 / / ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ / /  
 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   ( E N A B L E _ S T A T U S   & &   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  
 	 i f   ( U S E _ V I R T U A L _ S T O P S )   { V i r t u a l S t o p s D r i v e r ( ) ; }  
  
 	 E x p i r a t i o n D r i v e r ( ) ;  
 	 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  
 	 i f   ( E N A B L E _ E V E N T _ T R A D E )   { O n T r a d e ( ) ; }  
  
 	 / /   s k i p   t i c k s  
 	 i f   ( T i m e L o c a l ( )   <   F X D _ T I C K S K I P _ U N T I L )   { r e t u r n ; }  
  
 	 / / - -   r u n   b l o c k s  
 	 i n t   b l o c k s _ t o _ r u n [ ]   =   { 0 , 2 7 , 3 6 , 4 5 , 5 1 , 5 2 } ;  
 	 f o r   ( i n t   i = 0 ;   i < A r r a y S i z e ( b l o c k s _ t o _ r u n ) ;   i + + )   {  
 	 	 _ b l o c k s _ [ b l o c k s _ t o _ r u n [ i ] ] . r u n ( ) ;  
 	 }  
  
  
 	 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 ( ) ;  
  
 	 i f   ( E N A B L E _ S T A T U S )   D r a w S t a t u s ( " s t o p p e d " ) ;  
 	 i f   ( E N A B L E _ S P R E A D _ M E T E R )   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 ;  
 	 	 }  
 	 }  
  
 	 / /   d e l e t e   d y n a m i c   p o i n t e r s  
 	 f o r   ( i n t   i = 0 ;   i < A r r a y S i z e ( _ b l o c k s _ ) ;   i + + )  
 	 {  
 	 	 d e l e t e   _ b l o c k s _ [ i ] ;  
 	 	 _ b l o c k s _ [ i ]   =   N U L L ;  
 	 }  
 	 A r r a y R e s i z e ( _ b l o c k s _ ,   0 ) ;  
  
 	 r e t u r n ;  
 }  
  
 / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /  
 / /   + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +   / /  
 / /   |                                                                                           C l a s s e s   o f   b l o c k s                                                                                                         |   / /  
 / /   |                             C l a s s e 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                               |   / /  
 / /   + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +   / /  
 / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /  
  
 / * *  
 	 T h e   b a s e   c l a s s   f o r   a l l   b l o c k   c a l l s  
       * /  
 c l a s s   B l o c k C a l l s  
 {  
 	 p u b l i c :  
 	 	 b o o l   _ _ d i s a b l e d ;   / /   w h e t h e r   o r   n o t   t h e   b l o c k   i s   d i s a b l e d  
  
 	 	 s t r i n g   _ _ b l o c k _ u s e r _ n u m b e r ;  
                 i n t   _ _ b l o c k _ n u m b e r ;  
 	 	 i n t   _ _ b l o c k _ w a i t i n g ;  
 	 	 i n t   _ _ p a r e n t _ n u m b e r ;  
 	 	 i n t   _ _ i n b o u n d _ b l o c k s [ ] ;  
 	 	 i n t   _ _ o u t b o u n d _ b l o c k s [ ] ;  
  
 	 	 v o i d   _ _ a d d I n b o u n d B l o c k ( i n t   i d   =   0 )   {  
 	 	 	 i n t   s i z e   =   A r r a y S i z e ( _ _ i n b o u n d _ b l o c k s ) ;  
 	 	 	 f o r   ( i n t   i   =   0 ;   i   <   s i z e ;   i + + )   {  
 	 	 	 	 i f   ( _ _ i n b o u n d _ b l o c k s [ i ]   = =   i d )   {  
 	 	 	 	 	 r e t u r n ;  
 	 	 	 	 }  
 	 	 	 }  
 	 	 	 A r r a y R e s i z e ( _ _ i n b o u n d _ b l o c k s ,   s i z e   +   1 ) ;  
 	 	 	 _ _ i n b o u n d _ b l o c k s [ s i z e ]   =   i d ;  
 	 	 }  
  
 	 	 v o i d   B l o c k C a l l s ( )   {  
 	 	 	 _ _ d i s a b l e d                     =   f a l s e ;  
 	 	 	 _ _ b l o c k _ u s e r _ n u m b e r   =   " " ;  
 	 	 	 _ _ b l o c k _ n u m b e r             =   0 ;  
 	 	 	 _ _ b l o c k _ w a i t i n g           =   0 ;  
 	 	 	 _ _ p a r e n t _ n u m b e r           =   0 ;  
 	 	 }  
  
 	 	 / * *  
 	 	       A n n o u n c e   t h i s   b l o c k   t o   t h e   l i s t   o f   i n b o u n d   c o n n e c t i o n s   o f   a l l   t h e   b l o c k s   t o   w h i c h   t h i s   b l o c k   i s   c o n n e c t e d   t o  
 	 	       * /  
 	 	 v o i d   _ _ a n n o u n c e T h i s B l o c k ( )  
 	 	 {  
 	 	       / /   a d d   t h e   c u r r e n t   b l o c k   n u m b e r   t o   t h e   l i s t   o f   i n b o u n d   b l o c k s  
 	 	       / /   f o r   e a c h   o u t b o u n d   b l o c k   t h a t   i s   p r o v i d e d  
 	 	 	 f o r   ( i n t   i   =   0 ;   i   <   A r r a y S i z e ( _ _ o u t b o u n d _ b l o c k s ) ;   i + + )  
 	 	 	 {  
 	 	 	 	 i n t   b l o c k   =   _ _ o u t b o u n d _ b l o c k s [ i ] ;   / /   o u t b o u n d   b l o c k   n u m b e r  
 	 	 	 	 i n t   s i z e     =   A r r a y S i z e ( _ b l o c k s _ [ b l o c k ] . _ _ i n b o u n d _ b l o c k s ) ;   / /   t h e   s i z e   o f   i t s   i n b o u n d   l i s t  
  
 	 	 	 	 / /   s k i p   i f   t h e   c u r r e n t   b l o c k   w a s   a l r e a d y   a d d e d  
 	 	 	 	 f o r   ( i n t   j   =   0 ;   j   <   s i z e ;   j + + )   {  
 	 	 	 	 	 i f   ( _ b l o c k s _ [ b l o c k ] . _ _ i n b o u n d _ b l o c k s [ j ]   = =   _ _ b l o c k _ n u m b e r )  
 	 	 	 	 	 {  
 	 	 	 	 	 	 r e t u r n ;  
 	 	 	 	 	 }  
 	 	 	 	 }  
  
 	 	 	 	 / /   a d d   t h e   c u r r e n t   b l o c k   n u m b e r   t o   t h e   l i s t   o f   i n b o u n d   b l o c k s   o f   t h e   o t h e r   b l o c k  
 	 	 	 	 A r r a y R e s i z e ( _ b l o c k s _ [ b l o c k ] . _ _ i n b o u n d _ b l o c k s ,   s i z e   +   1 ) ;  
 	 	 	 	 _ b l o c k s _ [ b l o c k ] . _ _ i n b o u n d _ b l o c k s [ s i z e ]   =   _ _ b l o c k _ n u m b e r ;  
 	 	 	 }  
 	 	 }  
  
 	 	 / /   t h i s   i s   h e r e ,   b e c a u s e   i t   i s   u s e d   i n   t h e   " r u n "   f u n c t i o n  
 	 	 v i r t u a l   v o i d   _ e x e c u t e _ ( )   =   0 ;  
  
 	 	 / * *  
 	 	 	 I n   t h e   d e r i v e d   c l a s s   t h i s   m e t h o d   s h o u l d   b e   u s e d   t o   s e t   d y n a m i c   p a r a m e t e r s   o r   o t h e r   s t u f f   b e f o r e   t h e   m a i n   e x e c u t e .  
 	 	 	 T h i s   m e t h o d   i s   a u t o m a t i c a l l y   c a l l e d   w i t h i n   t h e   m a i n   " r u n "   m e t h o d   b e l o w ,   b e f o r e   t h e   e x e c u t i o n   o f   t h e   m a i n   c l a s s .  
 	 	 	 * /  
 	 	 v i r t u a l   v o i d   _ b e f o r e E x e c u t e _ ( )   { r e t u r n ; } ;  
 	 	 b o o l   _ b e f o r e E x e c u t e E n a b l e d ;   / /   f o r   s p e e d  
  
 	 	 / * *  
 	 	 	 S a m e   a s   _ b e f o r e E x e c u t e _ ,   b u t   t o   w o r k   a f t e r   t h e   e x e c u t e   m e t h o d .  
 	 	 	 * /  
 	 	 v i r t u a l   v o i d   _ a f t e r E x e c u t e _ ( )   { r e t u r n ; } ;  
 	 	 b o o l   _ a f t e r E x e c u t e E n a b l e d ;   / /   f o r   s p e e d  
  
 	 	 / * *  
 	 	 	 T h i s   i s   t h e   m e t h o d   t h a t   i s   u s e d   t o   r u n   t h e   b l o c k  
 	 	 	 * /  
 	 	 v i r t u a l   v o i d   r u n ( i n t   _ p a r e n t _ = 0 )   {  
 	 	 	 _ _ p a r e n t _ n u m b e r   =   _ p a r e n t _ ;  
 	 	 	 i f   ( _ _ d i s a b l e d   | |   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   =   _ _ b l o c k _ n u m b e r ;  
  
 	 	 	 i f   ( _ b e f o r e E x e c u t e E n a b l e d )   { _ b e f o r e E x e c u t e _ ( ) ; }  
 	 	 	 _ e x e c u t e _ ( ) ;  
 	 	 	 i f   ( _ a f t e r E x e c u t e E n a b l e d )   { _ a f t e r E x e c u t e _ ( ) ; }  
  
 	 	 	 i f   ( _ _ b l o c k _ w a i t i n g   & &   F X D _ C U R R E N T _ F U N C T I O N _ I D   = =   _ _ b l o c k _ n u m b e r )   { f x d W a i t . A c c u m u l a t e ( F X D _ C U R R E N T _ F U N C T I O N _ I D ) ; }  
 	 	 }  
 } ;  
  
 B l o c k C a l l s   * _ b l o c k s _ [ ] ;  
  
  
 / /   " N o   p o s i t i o n "   m o d e l  
 t e m p l a t e < t y p e n a m e   T 1 , t y p e n a m e   T 2 , t y p e n a m e   T 3 , t y p e n a m e   T 4 , t y p e n a m e   T 5 >  
 c l a s s   M D L _ N o O p e n e d O r d e r s :   p u b l i c   B l o c k C a l l s  
 {  
 	 p u b l i c :   / *   I n p u t   P a r a m e t e r s   * /  
 	 T 1   G r o u p M o d e ;  
 	 T 2   G r o u p ;  
 	 T 3   S y m b o l M o d e ;  
 	 T 4   S y m b o l ;  
 	 T 5   B u y s O r S e l l s ;  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   r )   { r e t u r n ; }  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 M D L _ N o O p e n e d O r d e r s ( )  
 	 {  
 	 	 G r o u p M o d e   =   ( s t r i n g ) " g r o u p " ;  
 	 	 G r o u p   =   ( s t r i n g ) " " ;  
 	 	 S y m b o l M o d e   =   ( s t r i n g ) " s y m b o l " ;  
 	 	 S y m b o l   =   ( s t r i n g ) C u r r e n t S y m b o l ( ) ;  
 	 	 B u y s O r S e l l s   =   ( s t r i n g ) " b o t h " ;  
 	 }  
  
 	 p u b l i c :   / *   T h e   m a i n   m e t h o d   * /  
 	 v i r t u a l   v o i d   _ e x e c u t e _ ( )  
 	 {  
 	 	 b o o l   e x i s t   =   f a l s e ;  
 	 	  
 	 	 f o r   ( i n t   i n d e x   =   T r a d e s T o t a l ( ) - 1 ;   i n d e x   > =   0 ;   i n d e x - - )  
 	 	 {  
 	 	 	 i f   ( T r a d e S e l e c t B y I n d e x ( i n d e x ,   G r o u p M o d e ,   G r o u p ,   S y m b o l M o d 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 )   { _ c a l l b a c k _ ( 1 ) ; }   e l s e   { _ c a l l b a c k _ ( 0 ) ; }  
 	 }  
 } ;  
  
 / /   " B u y   n o w "   m o d e l  
 t e m p l a t e < t y p e n a m e   T 1 , t y p e n a m e   T 2 , t y p e n a m e   T 3 , t y p e n a m e   T 4 , t y p e n a m e   T 5 , t y p e n a m e   T 6 , t y p e n a m e   T 7 , t y p e n a m e   T 8 , t y p e n a m e   T 9 , t y p e n a m e   _ T 9 _ , t y p e n a m e   T 1 0 , t y p e n a m e   T 1 1 , t y p e n a m e   T 1 2 , t y p e n a m e   T 1 3 , t y p e n a m e   T 1 4 , t y p e n a m e   T 1 5 , t y p e n a m e   T 1 6 , t y p e n a m e   T 1 7 , t y p e n a m e   T 1 8 , t y p e n a m e   T 1 9 , t y p e n a m e   T 2 0 , t y p e n a m e   T 2 1 , t y p e n a m e   T 2 2 , t y p e n a m e   T 2 3 , t y p e n a m e   T 2 4 , t y p e n a m e   T 2 5 , t y p e n a m e   T 2 6 , t y p e n a m e   T 2 7 , t y p e n a m e   T 2 8 , t y p e n a m e   T 2 9 , t y p e n a m e   T 3 0 , t y p e n a m e   T 3 1 , t y p e n a m e   T 3 2 , t y p e n a m e   T 3 3 , t y p e n a m e   T 3 4 , t y p e n a m e   T 3 5 , t y p e n a m e   T 3 6 , t y p e n a m e   _ T 3 6 _ , t y p e n a m e   T 3 7 , t y p e n a m e   _ T 3 7 _ , t y p e n a m e   T 3 8 , t y p e n a m e   _ T 3 8 _ , t y p e n a m e   T 3 9 , t y p e n a m e   T 4 0 , t y p e n a m e   T 4 1 , t y p e n a m e   T 4 2 , t y p e n a m e   T 4 3 , t y p e n a m e   _ T 4 3 _ , t y p e n a m e   T 4 4 , t y p e n a m e   _ T 4 4 _ , t y p e n a m e   T 4 5 , t y p e n a m e   _ T 4 5 _ , t y p e n a m e   T 4 6 , t y p e n a m e   T 4 7 , t y p e n a m e   T 4 8 , t y p e n a m e   T 4 9 , t y p e n a m e   T 5 0 , t y p e n a m e   _ T 5 0 _ , t y p e n a m e   T 5 1 , t y p e n a m e   T 5 2 , t y p e n a m e   T 5 3 >  
 c l a s s   M D L _ B u y N o w :   p u b l i c   B l o c k C a l l s  
 {  
 	 p u b l i c :   / *   I n p u t   P a r a m e t e r s   * /  
 	 T 1   G r o u p ;  
 	 T 2   S y m b o l ;  
 	 T 3   V o l u m e M o d e ;  
 	 T 4   V o l u m e S i z e ;  
 	 T 5   V o l u m e S i z e R i s k ;  
 	 T 6   V o l u m e R i s k ;  
 	 T 7   V o l u m e P e r c e n t ;  
 	 T 8   V o l u m e B l o c k P e r c e n t ;  
 	 T 9   d V o l u m e S i z e ;   v i r t u a l   _ T 9 _   _ d V o l u m e S i z e _ ( ) { r e t u r n ( _ T 9 _ ) 0 ; }  
 	 T 1 0   F i x e d R a t i o U n i t S i z e ;  
 	 T 1 1   F i x e d R a t i o D e l t a ;  
 	 T 1 2   m m M g I n i t i a l L o t s ;  
 	 T 1 3   m m M g M u l t i p l y O n L o s s ;  
 	 T 1 4   m m M g M u l t i p l y O n P r o f i t ;  
 	 T 1 5   m m M g A d d L o t s O n L o s s ;  
 	 T 1 6   m m M g A d d L o t s O n P r o f i t ;  
 	 T 1 7   m m M g R e s e t O n L o s s ;  
 	 T 1 8   m m M g R e s e t O n P r o f i t ;  
 	 T 1 9   m m 1 3 2 6 I n i t i a l L o t s ;  
 	 T 2 0   m m 1 3 2 6 R e v e r s e ;  
 	 T 2 1   m m F i b o I n i t i a l L o t s ;  
 	 T 2 2   m m D a l e m b e r t I n i t i a l L o t s ;  
 	 T 2 3   m m D a l e m b e r t R e v e r s e ;  
 	 T 2 4   m m L a b o u c h e r e I n i t i a l L o t s ;  
 	 T 2 5   m m L a b o u c h e r e L i s t ;  
 	 T 2 6   m m L a b o u c h e r e R e v e r s e ;  
 	 T 2 7   m m S e q B a s e L o t s ;  
 	 T 2 8   m m S e q O n L o s s ;  
 	 T 2 9   m m S e q O n P r o f i t ;  
 	 T 3 0   m m S e q R e v e r s e ;  
 	 T 3 1   V o l u m e U p p e r L i m i t ;  
 	 T 3 2   S t o p L o s s M o d e ;  
 	 T 3 3   S t o p L o s s P i p s ;  
 	 T 3 4   S t o p L o s s P e r c e n t P r i c e ;  
 	 T 3 5   S t o p L o s s P e r c e n t T P ;  
 	 T 3 6   d l S t o p L o s s ;   v i r t u a l   _ T 3 6 _   _ d l S t o p L o s s _ ( ) { r e t u r n ( _ T 3 6 _ ) 0 ; }  
 	 T 3 7   d p S t o p L o s s ;   v i r t u a l   _ T 3 7 _   _ d p S t o p L o s s _ ( ) { r e t u r n ( _ T 3 7 _ ) 0 ; }  
 	 T 3 8   d d S t o p L o s s ;   v i r t u a l   _ T 3 8 _   _ d d S t o p L o s s _ ( ) { r e t u r n ( _ T 3 8 _ ) 0 ; }  
 	 T 3 9   T a k e P r o f i t M o d e ;  
 	 T 4 0   T a k e P r o f i t P i p s ;  
 	 T 4 1   T a k e P r o f i t P e r c e n t P r i c e ;  
 	 T 4 2   T a k e P r o f i t P e r c e n t S L ;  
 	 T 4 3   d l T a k e P r o f i t ;   v i r t u a l   _ T 4 3 _   _ d l T a k e P r o f i t _ ( ) { r e t u r n ( _ T 4 3 _ ) 0 ; }  
 	 T 4 4   d p T a k e P r o f i t ;   v i r t u a l   _ T 4 4 _   _ d p T a k e P r o f i t _ ( ) { r e t u r n ( _ T 4 4 _ ) 0 ; }  
 	 T 4 5   d d T a k e P r o f i t ;   v i r t u a l   _ T 4 5 _   _ d d T a k e P r o f i t _ ( ) { r e t u r n ( _ T 4 5 _ ) 0 ; }  
 	 T 4 6   E x p M o d e ;  
 	 T 4 7   E x p D a y s ;  
 	 T 4 8   E x p H o u r s ;  
 	 T 4 9   E x p M i n u t e s ;  
 	 T 5 0   d E x p ;   v i r t u a l   _ T 5 0 _   _ d E x p _ ( ) { r e t u r n ( _ T 5 0 _ ) 0 ; }  
 	 T 5 1   S l i p p a g e ;  
 	 T 5 2   M y C o m m e n t ;  
 	 T 5 3   A r r o w C o l o r B u y ;  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   r )   { r e t u r n ; }  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 M D L _ B u y N o w ( )  
 	 {  
 	 	 G r o u p   =   ( s t r i n g ) " " ;  
 	 	 S y m b o l   =   ( s t r i n g ) C u r r e n t S y m b o l ( ) ;  
 	 	 V o l u m e M o d e   =   ( s t r i n g ) " f i x e d " ;  
 	 	 V o l u m e S i z e   =   ( d o u b l e ) 0 . 1 ;  
 	 	 V o l u m e S i z e R i s k   =   ( d o u b l e ) 5 0 . 0 ;  
 	 	 V o l u m e R i s k   =   ( d o u b l e ) 2 . 5 ;  
 	 	 V o l u m e P e r c e n t   =   ( d o u b l e ) 1 0 0 . 0 ;  
 	 	 V o l u m e B l o c k P e r c e n t   =   ( d o u b l e ) 3 . 0 ;  
 	 	 F i x e d R a t i o U n i t S i z e   =   ( d o u b l e ) 0 . 0 1 ;  
 	 	 F i x e d R a t i o D e l t a   =   ( d o u b l e ) 2 0 . 0 ;  
 	 	 m m M g I n i t i a l L o t s   =   ( d o u b l e ) 0 . 1 ;  
 	 	 m m M g M u l t i p l y O n L o s s   =   ( d o u b l e ) 2 . 0 ;  
 	 	 m m M g M u l t i p l y O n P r o f i t   =   ( d o u b l e ) 1 . 0 ;  
 	 	 m m M g A d d L o t s O n L o s s   =   ( d o u b l e ) 0 . 0 ;  
 	 	 m m M g A d d L o t s O n P r o f i t   =   ( d o u b l e ) 0 . 0 ;  
 	 	 m m M g R e s e t O n L o s s   =   ( i n t ) 0 ;  
 	 	 m m M g R e s e t O n P r o f i t   =   ( i n t ) 1 ;  
 	 	 m m 1 3 2 6 I n i t i a l L o t s   =   ( d o u b l e ) 0 . 1 ;  
 	 	 m m 1 3 2 6 R e v e r s e   =   ( b o o l ) f a l s e ;  
 	 	 m m F i b o I n i t i a l L o t s   =   ( d o u b l e ) 0 . 1 ;  
 	 	 m m D a l e m b e r t I n i t i a l L o t s   =   ( d o u b l e ) 0 . 1 ;  
 	 	 m m D a l e m b e r t R e v e r s e   =   ( b o o l ) f a l s e ;  
 	 	 m m L a b o u c h e r e I n i t i a l L o t s   =   ( d o u b l e ) 0 . 1 ;  
 	 	 m m L a b o u c h e r e L i s t   =   ( s t r i n g ) " 1 , 2 , 3 , 4 , 5 , 6 " ;  
 	 	 m m L a b o u c h e r e R e v e r s e   =   ( b o o l ) f a l s e ;  
 	 	 m m S e q B a s e L o t s   =   ( d o u b l e ) 0 . 1 ;  
 	 	 m m S e q O n L o s s   =   ( s t r i n g ) " 3 , 2 , 6 " ;  
 	 	 m m S e q O n P r o f i t   =   ( s t r i n g ) " 1 " ;  
 	 	 m m S e q R e v e r s e   =   ( b o o l ) f a l s e ;  
 	 	 V o l u m e U p p e r L i m i t   =   ( d o u b l e ) 0 . 0 ;  
 	 	 S t o p L o s s M o d e   =   ( s t r i n g ) " f i x e d " ;  
 	 	 S t o p L o s s P i p s   =   ( d o u b l e ) 5 0 . 0 ;  
 	 	 S t o p L o s s P e r c e n t P r i c e   =   ( d o u b l e ) 0 . 5 5 ;  
 	 	 S t o p L o s s P e r c e n t T P   =   ( d o u b l e ) 1 0 0 . 0 ;  
 	 	 T a k e P r o f i t M o d e   =   ( s t r i n g ) " f i x e d " ;  
 	 	 T a k e P r o f i t P i p s   =   ( d o u b l e ) 5 0 . 0 ;  
 	 	 T a k e P r o f i t P e r c e n t P r i c e   =   ( d o u b l e ) 0 . 5 5 ;  
 	 	 T a k e P r o f i t P e r c e n t S L   =   ( d o u b l e ) 1 0 0 . 0 ;  
 	 	 E x p M o d e   =   ( s t r i n g ) " G T C " ;  
 	 	 E x p D a y s   =   ( i n t ) 0 ;  
 	 	 E x p H o u r s   =   ( i n t ) 1 ;  
 	 	 E x p M i n u t e s   =   ( i n t ) 0 ;  
 	 	 S l i p p a g e   =   ( u l o n g ) 4 ;  
 	 	 M y C o m m e n t   =   ( s t r i n g ) " " ;  
 	 	 A r r o w C o l o r B u y   =   ( c o l o r ) c l r B l u e ;  
 	 }  
  
 	 p u b l i c :   / *   T h e   m a i n   m e t h o d   * /  
 	 v i r t u a l   v o i d   _ e x e c u t e _ ( )  
 	 {  
 	 	 / / - -   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   = =   " f i x e d " )                   { s l p   =   S t o p L o s s P i p s ; }  
 	 	 e l s e   i f   ( S t o p L o s s M o d e   = =   " d y n a m i c P i p s " )       { s l p   =   _ d p S t o p L o s s _ ( ) ; }  
 	 	 e l s e   i f   ( S t o p L o s s M o d e   = =   " d y n a m i c D i g i t s " )   { s l p   =   t o P i p s ( _ d d S t o p L o s s _ ( ) , S y m b o l ) ; }  
 	 	 e l s e   i f   ( S t o p L o s s M o d e   = =   " d y n a m i c L e v e l " )     { s l l   =   _ d l S t o p L o s s _ ( ) ; }  
 	 	 e l s e   i f   ( S t o p L o s s M o d e   = =   " p e r c e n t P r i c e " )     { s l l   =   S y m b o l A s k ( S y m b o l )   -   ( S y m b o l A s k ( S y m b o l )   *   S t o p L o s s P e r c e n t P r i c e   /   1 0 0 ) ; }  
 	 	  
 	 	           i f   ( T a k e P r o f i t M o d e   = =   " f i x e d " )                   { t p p   =   T a k e P r o f i t P i p s ; }  
 	 	 e l s e   i f   ( T a k e P r o f i t M o d e   = =   " d y n a m i c P i p s " )       { t p p   =   _ d p T a k e P r o f i t _ ( ) ; }  
 	 	 e l s e   i f   ( T a k e P r o f i t M o d e   = =   " d y n a m i c D i g i t s " )   { t p p   =   t o P i p s ( _ d d T a k e P r o f i t _ ( ) , S y m b o l ) ; }  
 	 	 e l s e   i f   ( T a k e P r o f i t M o d e   = =   " d y n a m i c L e v e l " )     { t p l   =   _ d l T a k e P r o f i t _ ( ) ; }  
 	 	 e l s e   i f   ( T a k e P r o f i t M o d e   = =   " p e r c e n t P r i c e " )     { t p l   =   S y m b o l A s k ( S y m b o l )   +   ( S y m b o l A s k ( S y m b o l )   *   T a k e P r o f i t P e r c e n t P r i c e   /   1 0 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 ) ) ,   S y m b o l ) ;  
 	 	  
 	 	           i f   ( V o l u m e M o d e   = =   " f i x e d " )                         { l o t s   =   D y n a m i c L o t s ( S y m b o l ,   V o l u m e M o d e ,   V o l u m e S i z e ) ; }  
 	 	 e l s e   i f   ( V o l u m e M o d e   = =   " b l o c k - e q u i t y " )           { l o t s   =   D y n a m i c L o t s ( S y m b o l ,   V o l u m e M o d e ,   V o l u m e B l o c k P e r c e n t ) ; }  
 	 	 e l s e   i f   ( V o l u m e M o d e   = =   " b l o c k - b a l a n c e " )         { l o t s   =   D y n a m i c L o t s ( S y m b o l ,   V o l u m e M o d e ,   V o l u m e B l o c k P e r c e n t ) ; }  
 	 	 e l s e   i f   ( V o l u m e M o d e   = =   " b l o c k - f r e e m a r g i n " )   { l o t s   =   D y n a m i c L o t s ( S y m b o l ,   V o l u m e M o d e ,   V o l u m e B l o c k P e r c e n t ) ; }  
 	 	 e l s e   i f   ( V o l u m e M o d e   = =   " e q u i t y " )                       { l o t s   =   D y n a m i c L o t s ( S y m b o l ,   V o l u m e M o d e ,   V o l u m e P e r c e n t ) ; }  
 	 	 e l s e   i f   ( V o l u m e M o d e   = =   " b a l a n c e " )                     { l o t s   =   D y n a m i c L o t s ( S y m b o l ,   V o l u m e M o d e ,   V o l u m e P e r c e n t ) ; }  
 	 	 e l s e   i f   ( V o l u m e M o d e   = =   " f r e e m a r g i n " )               { l o t s   =   D y n a m i c L o t s ( S y m b o l ,   V o l u m e M o d e ,   V o l u m e P e r c e n t ) ; }  
 	 	 e l s e   i f   ( V o l u m e M o d e   = =   " e q u i t y R i s k " )               { l o t s   =   D y n a m i c L o t s ( S y m b o l ,   V o l u m e M o d e ,   V o l u m e R i s k ,   p r e _ s l _ p i p s ) ; }  
 	 	 e l s e   i f   ( V o l u m e M o d e   = =   " b a l a n c e R i s k " )             { l o t s   =   D y n a m i c L o t s ( S y m b o l ,   V o l u m e M o d e ,   V o l u m e R i s k ,   p r e _ s l _ p i p s ) ; }  
 	 	 e l s e   i f   ( V o l u m e M o d e   = =   " f r e e m a r g i n R i s k " )       { l o t s   =   D y n a m i c L o t s ( S y m b o l ,   V o l u m e M o d e ,   V o l u m e R i s k ,   p r e _ s l _ p i p s ) ; }  
 	 	 e l s e   i f   ( V o l u m e M o d e   = =   " f i x e d R i s k " )                 { l o t s   =   D y n a m i c L o t s ( S y m b o l ,   V o l u m e M o d e ,   V o l u m e S i z e R i s k ,   p r e _ s l _ p i p s ) ; }  
 	 	 e l s e   i f   ( V o l u m e M o d e   = =   " f i x e d R a t i o " )               { l o t s   =   D y n a m i c L o t s ( S y m b o l ,   V o l u m e M o d e ,   F i x e d R a t i o U n i t S i z e ,   F i x e d R a t i o D e l t a ) ; }  
 	 	 e l s e   i f   ( V o l u m e M o d e   = =   " d y n a m i c " )                     { l o t s   =   _ d V o l u m e S i z e _ ( ) ; }  
 	 	 e l s e   i f   ( V o l u m e M o d e   = =   " 1 3 2 6 " )                           { l o t s   =   B e t 1 3 2 6 ( G r o u p ,   S y m b o l ,   m m 1 3 2 6 I n i t i a l L o t s ,   m m 1 3 2 6 R e v e r s e ) ; }  
 	 	 e l s e   i f   ( V o l u m e M o d e   = =   " f i b o n a c c i " )                 { l o t s   =   B e t F i b o n a c c i ( G r o u p ,   S y m b o l ,   m m F i b o I n i t i a l L o t s ) ; }  
 	 	 e l s e   i f   ( V o l u m e M o d e   = =   " d a l e m b e r t " )                 { l o t s   =   B e t D a l e m b e r t ( G r o u p ,   S y m b o l ,   m m D a l e m b e r t I n i t i a l L o t s ,   m m D a l e m b e r t R e v e r s e ) ; }  
 	 	 e l s e   i f   ( V o l u m e M o d e   = =   " l a b o u c h e r e " )               { l o t s   =   B e t L a b o u c h e r e ( G r o u p ,   S y m b o l ,   m m L a b o u c h e r e I n i t i a l L o t s ,   m m L a b o u c h e r e L i s t ,   m m L a b o u c h e r e R e v e r s e ) ; }  
 	 	 e l s e   i f   ( V o l u m e M o d e   = =   " m a r t i n g a l e " )               { l o t s   =   B e t M a r t i n g a l e ( G r o u p ,   S y m b o l ,   m m M g I n i t i a l L o t s ,   m m M g M u l t i p l y O n L o s s ,   m m M g M u l t i p l y O n P r o f i t ,   m m M g A d d L o t s O n L o s s ,   m m M g A d d L o t s O n P r o f i t ,   m m M g R e s e t O n L o s s ,   m m M g R e s e t O n P r o f i t ) ; }  
 	 	 e l s e   i f   ( V o l u m e M o d e   = =   " s e q u e n c e " )                   { l o t s   =   B e t S e q u e n c e ( G r o u p ,   S y m b o l ,   m m S e q B a s e L o t s ,   m m S e q O n L o s s ,   m m S e q O n P r o f i t ,   m m S e q R e v e r s e ) ; }  
 	 	  
 	 	 l o t s   =   A l i g n L o t s ( S y m b o l ,   l o t s ,   0 ,   V o l u m e U p p e r L i m i t ) ;  
 	 	  
 	 	 d a t e t i m e   e x p   =   E x p i r a t i o n T i m e ( E x p M o d e , E x p D a y s , E x p H o u r s , E x p M i n u t e s , _ d E x p _ ( ) ) ;  
 	 	  
 	 	 / / - -   s e n d   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
 	 	 l o n g   t i c k e t   =   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 ) G r o u p ) ,   M y C o m m e n t ,   A r r o w C o l o r B u y ,   e x p ) ;  
 	 	  
 	 	 i f   ( t i c k e t   >   0 )   { _ c a l l b a c k _ ( 1 ) ; }   e l s e   { _ c a l l b a c k _ ( 0 ) ; }  
 	 }  
 } ;  
  
 / /   " I n d i c a t o r   r i s e "   m o d e l  
 t e m p l a t e < t y p e n a m e   T 1 , t y p e n a m e   _ T 1 _ , t y p e n a m e   T 2 , t y p e n a m e   T 3 , t y p e n a m e   T 4 , t y p e n a m e   T 5 , t y p e n a m e   T 6 , t y p e n a m e   T 7 >  
 c l a s s   M D L _ I n d i c a t o r R i s e :   p u b l i c   B l o c k C a l l s  
 {  
 	 p u b l i c :   / *   I n p u t   P a r a m e t e r s   * /  
 	 T 1   I n d i c a t o r ;   v i r t u a l   _ T 1 _   _ I n d i c a t o r _ ( ) { r e t u r n ( _ T 1 _ ) 0 ; }  
 	 T 2   R i s e M o d e ;  
 	 T 3   R i s e C a n d l e s ;  
 	 T 4   E x c e p t i o n C a n d l e s ;  
 	 T 5   R i s e P i p s ;  
 	 T 6   R i s e V a l u e ;  
 	 T 7   P a s s T y p e ;  
 	 / *   S t a t i c   P a r a m e t e r s   * /  
 	 d a t e t i m e   b a r t i m e ;  
 	 i n t   f l i p s t a t e ;  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   r )   { r e t u r n ; }  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 M D L _ I n d i c a t o r R i s e ( )  
 	 {  
 	 	 R i s e M o d e   =   ( s t r i n g ) " p i p s " ;  
 	 	 R i s e C a n d l e s   =   ( i n t ) 4 ;  
 	 	 E x c e p t i o n C a n d l e s   =   ( i n t ) 0 ;  
 	 	 R i s e P i p s   =   ( d o u b l e ) 1 0 . 0 ;  
 	 	 R i s e V a l u e   =   ( d o u b l e ) 5 . 0 ;  
 	 	 P a s s T y p e   =   ( s t r i n g ) " c o n t " ;  
 	 	 / *   S t a t i c   P a r a m e t e r s   ( i n i t i a l   v a l u e )   * /  
 	 	 f l i p s t a t e   =     0 ;  
 	 }  
  
 	 p u b l i c :   / *   T h e   m a i n   m e t h o d   * /  
 	 v i r t u a l   v o i d   _ e x e c u t e _ ( )  
 	 {  
 	 	 i n t   e x c e p t i o n s               =   0 ;  
 	 	 b o o l   n e x t                         =   t r u e ;  
 	 	 d o u b l e   i n i t i a l _ l e v e l   =   - E M P T Y _ V A L U E ;  
 	 	 d o u b l e   l e v e l                   =   i n i t i a l _ l e v e l ;  
 	 	 s t r i n g   s y m b o l                 =   S y m b o l ( ) ;  
 	 	  
 	 	 i f   ( R i s e C a n d l e s   < =   0 )   { R i s e C a n d l e s   =   1 ; }  
 	 	  
 	 	 f o r   ( i n t   i   =   R i s e C a n d l e s ;   i   > =   0 ;   i - - )  
 	 	 {  
 	 	 	 F X D _ M O R E _ S H I F T   =   i ;  
 	 	 	 _ T 1 _   i v a l u e   =   _ I n d i c a t o r _ ( ) ;  
 	 	 	 s y m b o l   =   I n d i c a t o r . S y m b o l ;  
 	 	 	 F X D _ M O R E _ S H I F T   =   0 ;   / /   r e s e t  
 	 	 	  
 	 	 	 i f   ( i   = =   R i s e C a n d l e s )  
 	 	 	 {  
 	 	 	 	 i n i t i a l _ l e v e l   =   i v a l u e ;  
 	 	 	 	 l e v e l                   =   i n i t i a l _ l e v e l ;  
 	 	 	 	 c o n t i n u e ;  
 	 	 	 }  
 	 	  
 	 	 	 i f   ( i v a l u e   < =   l e v e l )  
 	 	 	 {  
 	 	 	 	 i f   ( R i s e C a n d l e s   >   1   & &   E x c e p t i o n C a n d l e s   >   0 )  
 	 	 	 	 {  
 	 	 	 	 	 e x c e p t i o n s + + ;  
 	 	  
 	 	 	 	 	 i f   ( e x c e p t i o n s   < =   E x c e p t i o n C a n d l e s )  
 	 	 	 	 	 {  
 	 	 	 	 	 	 l e v e l   =   i v a l u e ;  
 	 	 	 	 	 	 c o n t i n u e ;  
 	 	 	 	 	 }  
 	 	 	 	 }  
 	 	  
 	 	 	 	 n e x t   =   f a l s e ;  
 	 	 	 	 b r e a k ;  
 	 	 	 }  
 	 	  
 	 	 	 l e v e l   =   i v a l u e ;  
 	 	 }  
 	 	  
 	 	 i f   (  
 	 	 	       n e x t   = =   f a l s e  
 	 	 	 | |   ( R i s e M o d e   = =   " p i p s "   & &   t o P i p s ( l e v e l - i n i t i a l _ l e v e l ,   s y m b o l )   <   R i s e P i p s )  
 	 	 	 | |   ( R i s e M o d e   = =   " v a l u e "   & &   ( l e v e l - i n i t i a l _ l e v e l )   <   R i s e V a l u e )  
 	 	 	 )  
 	 	 {  
 	 	 	 n e x t             =   f a l s e ;  
 	 	 	 f l i p s t a t e   =   0 ;  
 	 	 }  
 	 	  
 	 	 i f   ( P a s s T y p e   = =   " c o n t "   | |   ( P a s s T y p e   = =   " o n c e "   & &   f l i p s t a t e   = =   0 )   | |   ( P a s s T y p e   = =   " b a r "   & &   b a r t i m e   <   i T i m e ( S y m b o l ( ) , P e r i o d ( ) , 1 ) ) )  
 	 	 {  
 	 	 	 i f   ( P a s s T y p e   = =   " b a r " )  
 	 	 	 {  
 	 	 	 	 b a r t i m e   =   i T i m e ( S y m b o l ( ) , P e r i o d ( ) , 1 ) ;  
 	 	 	 }  
 	 	 	 e l s e   i f   ( P a s s T y p e   = =   " o n c e "   & &   n e x t   = =   t r u e )  
 	 	 	 {  
 	 	 	 	 f l i p s t a t e   =   1 ;  
 	 	 	 }  
 	 	 	  
 	 	 }  
 	 	 e l s e  
 	 	 {  
 	 	 	 n e x t   =   f a l s e ;  
 	 	 }  
 	 	  
 	 	 i f   ( n e x t   = =   t r u e )   { _ c a l l b a c k _ ( 1 ) ; }   e l s e   { _ c a l l b a c k _ ( 0 ) ; }  
 	 }  
 } ;  
  
 / /   " I n d i c a t o r   f a l l "   m o d e l  
 t e m p l a t e < t y p e n a m e   T 1 , t y p e n a m e   _ T 1 _ , t y p e n a m e   T 2 , t y p e n a m e   T 3 , t y p e n a m e   T 4 , t y p e n a m e   T 5 , t y p e n a m e   T 6 , t y p e n a m e   T 7 >  
 c l a s s   M D L _ I n d i c a t o r F a l l :   p u b l i c   B l o c k C a l l s  
 {  
 	 p u b l i c :   / *   I n p u t   P a r a m e t e r s   * /  
 	 T 1   I n d i c a t o r ;   v i r t u a l   _ T 1 _   _ I n d i c a t o r _ ( ) { r e t u r n ( _ T 1 _ ) 0 ; }  
 	 T 2   F a l l M o d e ;  
 	 T 3   F a l l C a n d l e s ;  
 	 T 4   E x c e p t i o n C a n d l e s ;  
 	 T 5   F a l l P i p s ;  
 	 T 6   F a l l V a l u e ;  
 	 T 7   P a s s T y p e ;  
 	 / *   S t a t i c   P a r a m e t e r s   * /  
 	 d a t e t i m e   b a r t i m e ;  
 	 i n t   f l i p s t a t e ;  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   r )   { r e t u r n ; }  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 M D L _ I n d i c a t o r F a l l ( )  
 	 {  
 	 	 F a l l M o d e   =   ( s t r i n g ) " p i p s " ;  
 	 	 F a l l C a n d l e s   =   ( i n t ) 4 ;  
 	 	 E x c e p t i o n C a n d l e s   =   ( i n t ) 0 ;  
 	 	 F a l l P i p s   =   ( d o u b l e ) 1 0 . 0 ;  
 	 	 F a l l V a l u e   =   ( d o u b l e ) 5 . 0 ;  
 	 	 P a s s T y p e   =   ( s t r i n g ) " c o n t " ;  
 	 	 / *   S t a t i c   P a r a m e t e r s   ( i n i t i a l   v a l u e )   * /  
 	 	 f l i p s t a t e   =     0 ;  
 	 }  
  
 	 p u b l i c :   / *   T h e   m a i n   m e t h o d   * /  
 	 v i r t u a l   v o i d   _ e x e c u t e _ ( )  
 	 {  
 	 	 i n t   e x c e p t i o n s               =   0 ;  
 	 	 b o o l   n e x t                         =   t r u e ;  
 	 	 d o u b l e   i n i t i a l _ l e v e l   =   E M P T Y _ V A L U E ;  
 	 	 d o u b l e   l e v e l                   =   i n i t i a l _ l e v e l ;  
 	 	 s t r i n g   s y m b o l                 =   S y m b o l ( ) ;  
 	 	  
 	 	 i f   ( F a l l C a n d l e s   < =   0 )   { F a l l C a n d l e s   =   1 ; }  
 	 	  
 	 	 f o r   ( i n t   i   =   F a l l C a n d l e s ;   i   > =   0 ;   i - - )  
 	 	 {  
 	 	 	 F X D _ M O R E _ S H I F T   =   i ;  
 	 	 	 _ T 1 _   i v a l u e   =   _ I n d i c a t o r _ ( ) ;  
 	 	 	 s y m b o l   =   I n d i c a t o r . S y m b o l ;  
 	 	 	 F X D _ M O R E _ S H I F T   =   0 ;   / /   r e s e t  
 	 	 	  
 	 	 	 i f   ( i   = =   F a l l C a n d l e s )  
 	 	 	 {  
 	 	 	 	 i n i t i a l _ l e v e l   =   i v a l u e ;  
 	 	 	 	 l e v e l                   =   i n i t i a l _ l e v e l ;  
 	 	 	 	 c o n t i n u e ;  
 	 	 	 }  
 	 	 	  
 	 	 	 i f   ( i v a l u e   > =   l e v e l )  
 	 	 	 {  
 	 	 	 	 i f   ( F a l l C a n d l e s   >   1   & &   E x c e p t i o n C a n d l e s   >   0 )  
 	 	 	 	 {  
 	 	 	 	 	 e x c e p t i o n s + + ;  
 	 	  
 	 	 	 	 	 i f   ( e x c e p t i o n s   < =   E x c e p t i o n C a n d l e s )  
 	 	 	 	 	 {  
 	 	 	 	 	 	 l e v e l   =   i v a l u e ;  
 	 	 	 	 	 	 c o n t i n u e ;  
 	 	 	 	 	 }  
 	 	 	 	 }  
 	 	  
 	 	 	 	 n e x t   =   f a l s e ;  
 	 	 	 	 b r e a k ;  
 	 	 	 }  
 	 	  
 	 	 	 l e v e l   =   i v a l u e ;  
 	 	 }  
 	 	  
 	 	 i f   (  
 	 	 	       n e x t   = =   f a l s e  
 	 	 	 | |   ( F a l l M o d e   = =   " p i p s "   & &   t o P i p s ( i n i t i a l _ l e v e l - l e v e l ,   s y m b o l )   <   F a l l P i p s )  
 	 	 	 | |   ( F a l l M o d e   = =   " v a l u e "   & &   ( i n i t i a l _ l e v e l - l e v e l )   <   F a l l V a l u e )  
 	 	 	 )  
 	 	 {  
 	 	 	 n e x t             =   f a l s e ;  
 	 	 	 f l i p s t a t e   =   0 ;  
 	 	 }  
 	 	  
 	 	 i f   ( P a s s T y p e   = =   " c o n t "   | |   ( P a s s T y p e   = =   " o n c e "   & &   f l i p s t a t e   = =   0 )   | |   ( P a s s T y p e   = =   " b a r "   & &   b a r t i m e   <   i T i m e ( S y m b o l ( ) , P e r i o d ( ) , 1 ) ) )  
 	 	 {  
 	 	 	 i f   ( P a s s T y p e   = =   " b a r " )  
 	 	 	 {  
 	 	 	 	 b a r t i m e   =   i T i m e ( S y m b o l ( ) , P e r i o d ( ) , 1 ) ;  
 	 	 	 }  
 	 	 	 e l s e   i f   ( P a s s T y p e   = =   " o n c e "   & &   n e x t   = =   t r u e )  
 	 	 	 {  
 	 	 	 	 f l i p s t a t e   =   1 ;  
 	 	 	 }  
 	 	  
 	 	 }  
 	 	 e l s e  
 	 	 {  
 	 	 	 n e x t   =   f a l s e ;  
 	 	 }  
 	 	  
 	 	 i f   ( n e x t   = =   t r u e )   { _ c a l l b a c k _ ( 1 ) ; }   e l s e   { _ c a l l b a c k _ ( 0 ) ; }  
 	 }  
 } ;  
  
 / /   " C o n d i t i o n "   m o d e l  
 t e m p l a t e < t y p e n a m e   T 1 , t y p e n a m e   _ T 1 _ , t y p e n a m e   T 2 , t y p e n a m e   T 3 , t y p e n a m e   _ T 3 _ , t y p e n a m e   T 4 >  
 c l a s s   M D L _ C o n d i t i o n :   p u b l i c   B l o c k C a l l s  
 {  
 	 p u b l i c :   / *   I n p u t   P a r a m e t e r s   * /  
 	 T 1   L o ;   v i r t u a l   _ T 1 _   _ L o _ ( ) { r e t u r n ( _ T 1 _ ) 0 ; }  
 	 T 2   c o m p a r e ;  
 	 T 3   R o ;   v i r t u a l   _ T 3 _   _ R o _ ( ) { r e t u r n ( _ T 3 _ ) 0 ; }  
 	 T 4   c r o s s w i d t h ;  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   r )   { r e t u r n ; }  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 M D L _ C o n d i t i o n ( )  
 	 {  
 	 	 c o m p a r e   =   ( s t r i n g ) " > " ;  
 	 	 c r o s s w i d t h   =   ( i n t ) 1 ;  
 	 }  
  
 	 p u b l i c :   / *   T h e   m a i n   m e t h o d   * /  
 	 v i r t u a l   v o i d   _ e x e c u t e _ ( )  
 	 {  
 	 	 b o o l   o u t p u t 1   =   f a l s e ,   o u t p u t 2   =   f a l s e ;   / /   o u t p u t   1   a n d   o u t p u t   2  
 	 	 i n t   c r o s s o v e r   =   0 ;  
 	 	  
 	 	 i f   ( c o m p a r e   = =   " x > "   | |   c o m p a r e   = =   " x < " )   { c r o s s o v e r   =   1 ; }  
 	 	  
 	 	 f o r   ( i n t   i   =   0 ;   i   < =   c r o s s o v e r ;   i + + )  
 	 	 {  
 	 	 	 / /   i = 0   -   n o r m a l   p a s s ,   i = 1   -   c r o s s o v e r   p a s s  
 	 	  
 	 	 	 / /   L e f t   o p e r a n d   o f   t h e   c o n d i t i o n  
 	 	 	 F X D _ M O R E _ S H I F T   =   i   *   c r o s s w i d t h ;  
 	 	 	 _ T 1 _   l o   =   _ L o _ ( ) ;  
 	 	 	 i f   ( M a t h A b s ( l o )   = =   E M P T Y _ V A L U E )   { r e t u r n ; }  
 	 	  
 	 	 	 / /   R i g h t   o p e r a n d   o f   t h e   c o n d i t i o n  
 	 	 	 F X D _ M O R E _ S H I F T   =   i   *   c r o s s w i d t h ;  
 	 	 	 _ T 3 _   r o   =   _ R o _ ( ) ;  
 	 	 	 i f   ( M a t h A b s ( r o )   = =   E M P T Y _ V A L U E )   { r e t u r n ; }  
 	 	  
 	 	 	 / /   C o n d i t i o n s  
 	 	 	 i f   ( C o m p a r e V a l u e s ( c o m p a r e ,   l o ,   r o ) )  
 	 	 	 {  
 	 	 	 	 i f   ( i   = =   0 )  
 	 	 	 	 {  
 	 	 	 	 	 o u t p u t 1   =   t r u e ;  
 	 	 	 	 }  
 	 	 	 }  
 	 	 	 e l s e  
 	 	 	 {  
 	 	 	 	 i f   ( i   = =   0 )  
 	 	 	 	 {  
 	 	 	 	 	 o u t p u t 2   =   t r u e ;  
 	 	 	 	 }  
 	 	 	 	 e l s e  
 	 	 	 	 {  
 	 	 	 	 	 o u t p u t 2   =   f a l s e ;  
 	 	 	 	 }  
 	 	 	 }  
 	 	  
 	 	 	 i f   ( c r o s s o v e r   = =   1 )  
 	 	 	 {  
 	 	 	 	 i f   ( C o m p a r e V a l u e s ( c o m p a r e ,   r o ,   l o ) )  
 	 	 	 	 {  
 	 	 	 	 	 i f   ( i   = =   0 )  
 	 	 	 	 	 {  
 	 	 	 	 	 	 o u t p u t 2   =   t r u e ;  
 	 	 	 	 	 }  
 	 	 	 	 }  
 	 	 	 	 e l s e  
 	 	 	 	 {  
 	 	 	 	 	 i f   ( i   = =   1 )  
 	 	 	 	 	 {  
 	 	 	 	 	 	 o u t p u t 1   =   f a l s e ;  
 	 	 	 	 	 }  
 	 	 	 	 }  
 	 	 	 }  
 	 	 }  
 	 	  
 	 	 F X D _ M O R E _ S H I F T   =   0 ;   / /   r e s e t  
 	 	  
 	 	 	     i f   ( o u t p u t 1   = =   t r u e )   { _ c a l l b a c k _ ( 1 ) ; }  
 	 	 e l s e   i f   ( o u t p u t 2   = =   t r u e )   { _ c a l l b a c k _ ( 0 ) ; }  
 	 }  
 } ;  
  
 / /   " H o u r s   f i l t e r "   m o d e l  
 t e m p l a t e < t y p e n a m e   T 1 , t y p e n a m e   T 2 , t y p e n a m e   T 3 , t y p e n a m e   T 4 , t y p e n a m e   T 5 , t y p e n a m e   T 6 , t y p e n a m e   T 7 , t y p e n a m e   T 8 , t y p e n a m e   T 9 , t y p e n a m e   T 1 0 , t y p e n a m e   T 1 1 , t y p e n a m e   T 1 2 >  
 c l a s s   M D L _ H o u r s F i l t e r :   p u b l i c   B l o c k C a l l s  
 {  
 	 p u b l i c :   / *   I n p u t   P a r a m e t e r s   * /  
 	 T 1   S e r v e r O r L o c a l T i m e ;  
 	 T 2   S t a r t H o u r ;  
 	 T 3   E n d H o u r ;  
 	 T 4   S e c o n d H o u r s B l o c k ;  
 	 T 5   S e c o n d S t a r t H o u r ;  
 	 T 6   S e c o n d E n d H o u r ;  
 	 T 7   T h i r d H o u r s B l o c k ;  
 	 T 8   T h i r d S t a r t H o u r ;  
 	 T 9   T h i r d E n d H o u r ;  
 	 T 1 0   F o u r t h H o u r s B l o c k ;  
 	 T 1 1   F o u r t h S t a r t H o u r ;  
 	 T 1 2   F o u r t h E n d H o u r ;  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   r )   { r e t u r n ; }  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 M D L _ H o u r s F i l t e r ( )  
 	 {  
 	 	 S e r v e r O r L o c a l T i m e   =   ( s t r i n g ) " s e r v e r " ;  
 	 	 S t a r t H o u r   =   ( s t r i n g ) " 0 0 : 0 0 " ;  
 	 	 E n d H o u r   =   ( s t r i n g ) " 0 6 : 0 0 " ;  
 	 	 S e c o n d H o u r s B l o c k   =   ( b o o l ) f a l s e ;  
 	 	 S e c o n d S t a r t H o u r   =   ( s t r i n g ) " 0 6 : 0 0 " ;  
 	 	 S e c o n d E n d H o u r   =   ( s t r i n g ) " 1 2 : 0 0 " ;  
 	 	 T h i r d H o u r s B l o c k   =   ( b o o l ) f a l s e ;  
 	 	 T h i r d S t a r t H o u r   =   ( s t r i n g ) " 1 2 : 0 0 " ;  
 	 	 T h i r d E n d H o u r   =   ( s t r i n g ) " 1 8 : 0 0 " ;  
 	 	 F o u r t h H o u r s B l o c k   =   ( b o o l ) f a l s e ;  
 	 	 F o u r t h S t a r t H o u r   =   ( s t r i n g ) " 1 8 : 0 0 " ;  
 	 	 F o u r t h E n d H o u r   =   ( s t r i n g ) " 0 0 : 0 0 " ;  
 	 }  
  
 	 p u b l i c :   / *   T h e   m a i n   m e t h o d   * /  
 	 v i r t u a l   v o i d   _ e x e c u t e _ ( )  
 	 {  
 	 	 b o o l   p a s s           =   f a l s e ;  
 	 	 i n t   m o d e _ t i m e   =   0 ;  
 	 	 d a t e t i m e   s t a r t   =   0 ,   e n d   =   0 ,   n o w   =   0 ;  
 	 	  
 	 	 	     i f   ( S e r v e r O r L o c a l T i m e   = =   " s e r v e r " )   { m o d e _ t i m e   =   0 ;   n o w   =   T i m e C u r r e n t ( ) ; }  
 	 	 e l s e   i f   ( S e r v e r O r L o c a l T i m e   = =   " l o c a l " )     { m o d e _ t i m e   =   1 ;   n o w   =   T i m e L o c a l ( ) ; }    
 	 	 e l s e   i f   ( S e r v e r O r L o c a l T i m e   = =   " g m t " ) 	   { m o d e _ t i m e   =   2 ;   n o w   =   T i m e G M T ( ) ; }  
 	 	  
 	 	 s t a r t   =   T i m e F r o m S t r i n g ( m o d e _ t i m e ,   S t a r t H o u r ) ;  
 	 	 e n d       =   T i m e F r o m S t r i n g ( m o d e _ t i m e ,   E n d H o u r ) ;  
 	 	  
 	 	 i f   ( e n d   <   s t a r t )   e n d   =   e n d   +   8 6 4 0 0 ;  
 	 	  
 	 	 i f   ( n o w   > =   s t a r t   & &   n o w   <   e n d )   p a s s = t r u e ;  
 	 	  
 	 	 i f   ( p a s s   = =   f a l s e   & &   S e c o n d H o u r s B l o c k   = =   t r u e )  
 	 	 {  
 	 	 	 s t a r t   =   T i m e F r o m S t r i n g ( m o d e _ t i m e ,   S e c o n d S t a r t H o u r ) ;  
 	 	 	 e n d       =   T i m e F r o m S t r i n g ( m o d e _ t i m e ,   S e c o n d E n d H o u r ) ;  
 	 	  
 	 	 	 i f   ( e n d   <   s t a r t )   e n d   =   e n d   +   8 6 4 0 0 ;  
 	 	  
 	 	 	 i f   ( n o w   > =   s t a r t   & &   n o w   <   e n d )   p a s s   =   t r u e ;  
 	 	 }  
 	 	  
 	 	 i f   ( p a s s   = =   f a l s e   & &   T h i r d H o u r s B l o c k   = =   t r u e )  
 	 	 {  
 	 	 	 s t a r t   =   T i m e F r o m S t r i n g ( m o d e _ t i m e ,   T h i r d S t a r t H o u r ) ;  
 	 	 	 e n d       =   T i m e F r o m S t r i n g ( m o d e _ t i m e ,   T h i r d E n d H o u r ) ;  
 	 	  
 	 	 	 i f   ( e n d   <   s t a r t )   e n d   =   e n d   +   8 6 4 0 0 ;  
 	 	  
 	 	 	 i f   ( n o w   > =   s t a r t   & &   n o w   <   e n d )   p a s s   =   t r u e ;  
 	 	 }  
 	 	  
 	 	 i f   ( p a s s   = =   f a l s e   & &   F o u r t h H o u r s B l o c k   = =   t r u e )  
 	 	 {  
 	 	 	 s t a r t   =   T i m e F r o m S t r i n g ( m o d e _ t i m e ,   F o u r t h S t a r t H o u r ) ;  
 	 	 	 e n d       =   T i m e F r o m S t r i n g ( m o d e _ t i m e ,   F o u r t h E n d H o u r ) ;  
 	 	  
 	 	 	 i f   ( e n d   <   s t a r t )   e n d   =   e n d   +   8 6 4 0 0 ;  
 	 	 	 i f   ( n o w   > =   s t a r t   & &   n o w   <   e n d )   p a s s   =   t r u e ;  
 	 	 }  
 	 	  
 	 	 i f   ( p a s s   = =   t r u e )   { _ c a l l b a c k _ ( 1 ) ; }   e l s e   { _ c a l l b a c k _ ( 0 ) ; }  
 	 }  
 } ;  
  
 / /   " B e a r   c a n d l e "   m o d e l  
 t e m p l a t e < t y p e n a m e   T 1 , t y p e n a m e   T 2 , t y p e n a m e   T 3 , t y p e n a m e   T 4 , t y p e n a m e   T 5 , t y p e n a m e   T 6 >  
 c l a s s   M D L _ S i g n a l B e a r C a n d l e :   p u b l i c   B l o c k C a l l s  
 {  
 	 p u b l i c :   / *   I n p u t   P a r a m e t e r s   * /  
 	 T 1   S i g n a l T y p e ;  
 	 T 2   C a n d l e I D ;  
 	 T 3   M i n B o d y S i z e ;  
 	 T 4   M a x B o d y S i z e ;  
 	 T 5   S y m b o l ;  
 	 T 6   P e r i o d ;  
 	 / *   S t a t i c   P a r a m e t e r s   * /  
 	 d a t e t i m e   b a r t i m e ;  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   r )   { r e t u r n ; }  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 M D L _ S i g n a l B e a r C a n d l e ( )  
 	 {  
 	 	 S i g n a l T y p e   =   ( s t r i n g ) " c o n t i n u o u s " ;  
 	 	 C a n d l e I D   =   ( i n t ) 1 ;  
 	 	 M i n B o d y S i z e   =   ( d o u b l e ) 5 . 0 ;  
 	 	 M a x B o d y S i z e   =   ( d o u b l e ) 0 . 0 ;  
 	 	 S y m b o l   =   ( s t r i n g ) C u r r e n t S y m b o l ( ) ;  
 	 	 P e r i o d   =   ( E N U M _ T I M E F R A M E S ) C u r r e n t T i m e f r a m e ( ) ;  
 	 	 / *   S t a t i c   P a r a m e t e r s   ( i n i t i a l   v a l u e )   * /  
 	 	 b a r t i m e   =     0 ;  
 	 }  
  
 	 p u b l i c :   / *   T h e   m a i n   m e t h o d   * /  
 	 v i r t u a l   v o i d   _ e x e c u t e _ ( )  
 	 {  
 	 	 d o u b l e   c O p e n     =   i O p e n ( S y m b o l , P e r i o d , C a n d l e I D ) ;  
 	 	 d o u b l e   c C l o s e   =   i C l o s e ( S y m b o l , P e r i o d , C a n d l e I D ) ;  
 	 	  
 	 	 i f   ( S i g n a l T y p e   = =   " c o n t i n u o u s "   | |   b a r t i m e   <   i T i m e ( S y m b o l , P e r i o d , 1 ) )  
 	 	 {  
 	 	 	 i f   (  
 	 	 	 	 ( c C l o s e   <   c O p e n )  
 	 	 	 	 & &   ( c O p e n - c C l o s e   > =   t o D i g i t s ( M i n B o d y S i z e ,   S y m b o l ) )  
 	 	 	 	 & &   ( M a x B o d y S i z e   < =   0   | |   c O p e n - c C l o s e   < =   t o D i g i t s ( M a x B o d y S i z e ,   S y m b o l ) )  
 	 	 	 )  
 	 	 	 {  
 	 	 	 	 i f   ( S i g n a l T y p e   ! =   " c o n t i n u o u s " )   {  
 	 	 	 	 	 b a r t i m e   =   i T i m e ( S y m b o l , P e r i o d , 1 ) ;  
 	 	 	 	 }  
 	 	  
 	 	 	 	 _ c a l l b a c k _ ( 1 ) ;  
 	 	  
 	 	 	 	 r e t u r n ;  
 	 	 	 }  
 	 	 }  
 	 	  
 	 	 _ c a l l b a c k _ ( 0 ) ;  
 	 }  
 } ;  
  
 / /   " B u l l   c a n d l e "   m o d e l  
 t e m p l a t e < t y p e n a m e   T 1 , t y p e n a m e   T 2 , t y p e n a m e   T 3 , t y p e n a m e   T 4 , t y p e n a m e   T 5 , t y p e n a m e   T 6 >  
 c l a s s   M D L _ S i g n a l B u l l C a n d l e :   p u b l i c   B l o c k C a l l s  
 {  
 	 p u b l i c :   / *   I n p u t   P a r a m e t e r s   * /  
 	 T 1   S i g n a l T y p e ;  
 	 T 2   C a n d l e I D ;  
 	 T 3   M i n B o d y S i z e ;  
 	 T 4   M a x B o d y S i z e ;  
 	 T 5   S y m b o l ;  
 	 T 6   P e r i o d ;  
 	 / *   S t a t i c   P a r a m e t e r s   * /  
 	 d a t e t i m e   b a r t i m e ;  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   r )   { r e t u r n ; }  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 M D L _ S i g n a l B u l l C a n d l e ( )  
 	 {  
 	 	 S i g n a l T y p e   =   ( s t r i n g ) " c o n t i n u o u s " ;  
 	 	 C a n d l e I D   =   ( i n t ) 1 ;  
 	 	 M i n B o d y S i z e   =   ( d o u b l e ) 5 . 0 ;  
 	 	 M a x B o d y S i z e   =   ( d o u b l e ) 0 . 0 ;  
 	 	 S y m b o l   =   ( s t r i n g ) C u r r e n t S y m b o l ( ) ;  
 	 	 P e r i o d   =   ( E N U M _ T I M E F R A M E S ) C u r r e n t T i m e f r a m e ( ) ;  
 	 	 / *   S t a t i c   P a r a m e t e r s   ( i n i t i a l   v a l u e )   * /  
 	 	 b a r t i m e   =     0 ;  
 	 }  
  
 	 p u b l i c :   / *   T h e   m a i n   m e t h o d   * /  
 	 v i r t u a l   v o i d   _ e x e c u t e _ ( )  
 	 {  
 	 	 d o u b l e   c O p e n     =   i O p e n ( S y m b o l , P e r i o d , C a n d l e I D ) ;  
 	 	 d o u b l e   c C l o s e   =   i C l o s e ( S y m b o l , P e r i o d , C a n d l e I D ) ;  
 	 	  
 	 	 i f   ( S i g n a l T y p e   = =   " c o n t i n u o u s "   | |   b a r t i m e   <   i T i m e ( S y m b o l , P e r i o d , 1 ) )  
 	 	 {  
 	 	 	 i f   (  
 	 	 	 	 ( c O p e n   <   c C l o s e )  
 	 	 	 	 & &   ( c C l o s e - c O p e n   > =   t o D i g i t s ( M i n B o d y S i z e ,   S y m b o l ) )  
 	 	 	 	 & &   ( M a x B o d y S i z e   < =   0   | |   c C l o s e - c O p e n   < =   t o D i g i t s ( M a x B o d y S i z e ,   S y m b o l ) )  
 	 	 	 )  
 	 	 	 {  
 	 	 	 	 i f   ( S i g n a l T y p e   ! =   " c o n t i n u o u s " )   {  
 	 	 	 	 	 b a r t i m e   =   i T i m e ( S y m b o l , P e r i o d , 1 ) ;  
 	 	 	 	 }  
 	 	  
 	 	 	 	 _ c a l l b a c k _ ( 1 ) ;  
 	 	  
 	 	 	 	 r e t u r n ;  
 	 	 	 }  
 	 	 }  
 	 	  
 	 	 _ c a l l b a c k _ ( 0 ) ;  
 	 }  
 } ;  
  
 / /   " O n c e   p e r   m i n u t e s "   m o d e l  
 t e m p l a t e < t y p e n a m e   T 1 >  
 c l a s s   M D L _ O n c e P e r M i n u t e s :   p u b l i c   B l o c k C a l l s  
 {  
 	 p u b l i c :   / *   I n p u t   P a r a m e t e r s   * /  
 	 T 1   M i n u t e s P e r i o d ;  
 	 / *   S t a t i c   P a r a m e t e r s   * /  
 	 d a t e t i m e   t i m e n e x t ;  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   r )   { r e t u r n ; }  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 M D L _ O n c e P e r M i n u t e s ( )  
 	 {  
 	 	 M i n u t e s P e r i o d   =   ( i n t ) 2 0 ;  
 	 	 / *   S t a t i c   P a r a m e t e r s   ( i n i t i a l   v a l u e )   * /  
 	 	 t i m e n e x t   =     0 ;  
 	 }  
  
 	 p u b l i c :   / *   T h e   m a i n   m e t h o d   * /  
 	 v i r t u a l   v o i d   _ e x e c u t e _ ( )  
 	 {  
 	 	 d a t e t i m e   n o w   =   T i m e C u r r e n t ( ) ;  
 	 	  
 	 	 i f   ( n o w   > =   t i m e n e x t )  
 	 	 {  
 	 	 	 w h i l e   ( t r u e )  
 	 	 	 {  
 	 	 	 	 i f   ( n o w   > =   t i m e n e x t )  
 	 	 	 	 {  
 	 	 	 	 	 i f   ( t i m e n e x t   = =   0 )  
 	 	 	 	 	 {  
 	 	 	 	 	 	 t i m e n e x t   =   ( d a t e t i m e ) ( M a t h F l o o r ( n o w   /   8 6 4 0 0 . 0 )   *   8 6 4 0 0 . 0 ) ;   / /   T h i s   c a l c u l a t i o n   g i v e s   u s   0 0 : 0 0   o f   t o d a y  
 	 	 	 	 	 }  
 	 	  
 	 	 	 	 	 t i m e n e x t   =   t i m e n e x t   +   ( M i n u t e s P e r i o d   *   6 0 ) ;  
 	 	 	 	 }  
 	 	 	 	 e l s e  
 	 	 	 	 {  
 	 	 	 	 	 b r e a k ;      
 	 	 	 	 }  
 	 	 	 }  
 	 	  
 	 	 	 _ c a l l b a c k _ ( 1 ) ;  
 	 	 }  
 	 	 e l s e  
 	 	 {  
 	 	 	 _ c a l l b a c k _ ( 0 ) ;  
 	 	 }  
 	 }  
 } ;  
  
 / /   " S e l l   n o w "   m o d e l  
 t e m p l a t e < t y p e n a m e   T 1 , t y p e n a m e   T 2 , t y p e n a m e   T 3 , t y p e n a m e   T 4 , t y p e n a m e   T 5 , t y p e n a m e   T 6 , t y p e n a m e   T 7 , t y p e n a m e   T 8 , t y p e n a m e   T 9 , t y p e n a m e   _ T 9 _ , t y p e n a m e   T 1 0 , t y p e n a m e   T 1 1 , t y p e n a m e   T 1 2 , t y p e n a m e   T 1 3 , t y p e n a m e   T 1 4 , t y p e n a m e   T 1 5 , t y p e n a m e   T 1 6 , t y p e n a m e   T 1 7 , t y p e n a m e   T 1 8 , t y p e n a m e   T 1 9 , t y p e n a m e   T 2 0 , t y p e n a m e   T 2 1 , t y p e n a m e   T 2 2 , t y p e n a m e   T 2 3 , t y p e n a m e   T 2 4 , t y p e n a m e   T 2 5 , t y p e n a m e   T 2 6 , t y p e n a m e   T 2 7 , t y p e n a m e   T 2 8 , t y p e n a m e   T 2 9 , t y p e n a m e   T 3 0 , t y p e n a m e   T 3 1 , t y p e n a m e   T 3 2 , t y p e n a m e   T 3 3 , t y p e n a m e   T 3 4 , t y p e n a m e   T 3 5 , t y p e n a m e   T 3 6 , t y p e n a m e   _ T 3 6 _ , t y p e n a m e   T 3 7 , t y p e n a m e   _ T 3 7 _ , t y p e n a m e   T 3 8 , t y p e n a m e   _ T 3 8 _ , t y p e n a m e   T 3 9 , t y p e n a m e   T 4 0 , t y p e n a m e   T 4 1 , t y p e n a m e   T 4 2 , t y p e n a m e   T 4 3 , t y p e n a m e   _ T 4 3 _ , t y p e n a m e   T 4 4 , t y p e n a m e   _ T 4 4 _ , t y p e n a m e   T 4 5 , t y p e n a m e   _ T 4 5 _ , t y p e n a m e   T 4 6 , t y p e n a m e   T 4 7 , t y p e n a m e   T 4 8 , t y p e n a m e   T 4 9 , t y p e n a m e   T 5 0 , t y p e n a m e   _ T 5 0 _ , t y p e n a m e   T 5 1 , t y p e n a m e   T 5 2 , t y p e n a m e   T 5 3 >  
 c l a s s   M D L _ S e l l N o w :   p u b l i c   B l o c k C a l l s  
 {  
 	 p u b l i c :   / *   I n p u t   P a r a m e t e r s   * /  
 	 T 1   G r o u p ;  
 	 T 2   S y m b o l ;  
 	 T 3   V o l u m e M o d e ;  
 	 T 4   V o l u m e S i z e ;  
 	 T 5   V o l u m e S i z e R i s k ;  
 	 T 6   V o l u m e R i s k ;  
 	 T 7   V o l u m e P e r c e n t ;  
 	 T 8   V o l u m e B l o c k P e r c e n t ;  
 	 T 9   d V o l u m e S i z e ;   v i r t u a l   _ T 9 _   _ d V o l u m e S i z e _ ( ) { r e t u r n ( _ T 9 _ ) 0 ; }  
 	 T 1 0   F i x e d R a t i o U n i t S i z e ;  
 	 T 1 1   F i x e d R a t i o D e l t a ;  
 	 T 1 2   m m M g I n i t i a l L o t s ;  
 	 T 1 3   m m M g M u l t i p l y O n L o s s ;  
 	 T 1 4   m m M g M u l t i p l y O n P r o f i t ;  
 	 T 1 5   m m M g A d d L o t s O n L o s s ;  
 	 T 1 6   m m M g A d d L o t s O n P r o f i t ;  
 	 T 1 7   m m M g R e s e t O n L o s s ;  
 	 T 1 8   m m M g R e s e t O n P r o f i t ;  
 	 T 1 9   m m 1 3 2 6 I n i t i a l L o t s ;  
 	 T 2 0   m m 1 3 2 6 R e v e r s e ;  
 	 T 2 1   m m F i b o I n i t i a l L o t s ;  
 	 T 2 2   m m D a l e m b e r t I n i t i a l L o t s ;  
 	 T 2 3   m m D a l e m b e r t R e v e r s e ;  
 	 T 2 4   m m L a b o u c h e r e I n i t i a l L o t s ;  
 	 T 2 5   m m L a b o u c h e r e L i s t ;  
 	 T 2 6   m m L a b o u c h e r e R e v e r s e ;  
 	 T 2 7   m m S e q B a s e L o t s ;  
 	 T 2 8   m m S e q O n L o s s ;  
 	 T 2 9   m m S e q O n P r o f i t ;  
 	 T 3 0   m m S e q R e v e r s e ;  
 	 T 3 1   V o l u m e U p p e r L i m i t ;  
 	 T 3 2   S t o p L o s s M o d e ;  
 	 T 3 3   S t o p L o s s P i p s ;  
 	 T 3 4   S t o p L o s s P e r c e n t P r i c e ;  
 	 T 3 5   S t o p L o s s P e r c e n t T P ;  
 	 T 3 6   d l S t o p L o s s ;   v i r t u a l   _ T 3 6 _   _ d l S t o p L o s s _ ( ) { r e t u r n ( _ T 3 6 _ ) 0 ; }  
 	 T 3 7   d p S t o p L o s s ;   v i r t u a l   _ T 3 7 _   _ d p S t o p L o s s _ ( ) { r e t u r n ( _ T 3 7 _ ) 0 ; }  
 	 T 3 8   d d S t o p L o s s ;   v i r t u a l   _ T 3 8 _   _ d d S t o p L o s s _ ( ) { r e t u r n ( _ T 3 8 _ ) 0 ; }  
 	 T 3 9   T a k e P r o f i t M o d e ;  
 	 T 4 0   T a k e P r o f i t P i p s ;  
 	 T 4 1   T a k e P r o f i t P e r c e n t P r i c e ;  
 	 T 4 2   T a k e P r o f i t P e r c e n t S L ;  
 	 T 4 3   d l T a k e P r o f i t ;   v i r t u a l   _ T 4 3 _   _ d l T a k e P r o f i t _ ( ) { r e t u r n ( _ T 4 3 _ ) 0 ; }  
 	 T 4 4   d p T a k e P r o f i t ;   v i r t u a l   _ T 4 4 _   _ d p T a k e P r o f i t _ ( ) { r e t u r n ( _ T 4 4 _ ) 0 ; }  
 	 T 4 5   d d T a k e P r o f i t ;   v i r t u a l   _ T 4 5 _   _ d d T a k e P r o f i t _ ( ) { r e t u r n ( _ T 4 5 _ ) 0 ; }  
 	 T 4 6   E x p M o d e ;  
 	 T 4 7   E x p D a y s ;  
 	 T 4 8   E x p H o u r s ;  
 	 T 4 9   E x p M i n u t e s ;  
 	 T 5 0   d E x p ;   v i r t u a l   _ T 5 0 _   _ d E x p _ ( ) { r e t u r n ( _ T 5 0 _ ) 0 ; }  
 	 T 5 1   S l i p p a g e ;  
 	 T 5 2   M y C o m m e n t ;  
 	 T 5 3   A r r o w C o l o r S e l l ;  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   r )   { r e t u r n ; }  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 M D L _ S e l l N o w ( )  
 	 {  
 	 	 G r o u p   =   ( s t r i n g ) " " ;  
 	 	 S y m b o l   =   ( s t r i n g ) C u r r e n t S y m b o l ( ) ;  
 	 	 V o l u m e M o d e   =   ( s t r i n g ) " f i x e d " ;  
 	 	 V o l u m e S i z e   =   ( d o u b l e ) 0 . 1 ;  
 	 	 V o l u m e S i z e R i s k   =   ( d o u b l e ) 5 0 . 0 ;  
 	 	 V o l u m e R i s k   =   ( d o u b l e ) 2 . 5 ;  
 	 	 V o l u m e P e r c e n t   =   ( d o u b l e ) 1 0 0 . 0 ;  
 	 	 V o l u m e B l o c k P e r c e n t   =   ( d o u b l e ) 3 . 0 ;  
 	 	 F i x e d R a t i o U n i t S i z e   =   ( d o u b l e ) 0 . 0 1 ;  
 	 	 F i x e d R a t i o D e l t a   =   ( d o u b l e ) 2 0 . 0 ;  
 	 	 m m M g I n i t i a l L o t s   =   ( d o u b l e ) 0 . 1 ;  
 	 	 m m M g M u l t i p l y O n L o s s   =   ( d o u b l e ) 2 . 0 ;  
 	 	 m m M g M u l t i p l y O n P r o f i t   =   ( d o u b l e ) 1 . 0 ;  
 	 	 m m M g A d d L o t s O n L o s s   =   ( d o u b l e ) 0 . 0 ;  
 	 	 m m M g A d d L o t s O n P r o f i t   =   ( d o u b l e ) 0 . 0 ;  
 	 	 m m M g R e s e t O n L o s s   =   ( i n t ) 0 ;  
 	 	 m m M g R e s e t O n P r o f i t   =   ( i n t ) 1 ;  
 	 	 m m 1 3 2 6 I n i t i a l L o t s   =   ( d o u b l e ) 0 . 1 ;  
 	 	 m m 1 3 2 6 R e v e r s e   =   ( b o o l ) f a l s e ;  
 	 	 m m F i b o I n i t i a l L o t s   =   ( d o u b l e ) 0 . 1 ;  
 	 	 m m D a l e m b e r t I n i t i a l L o t s   =   ( d o u b l e ) 0 . 1 ;  
 	 	 m m D a l e m b e r t R e v e r s e   =   ( b o o l ) f a l s e ;  
 	 	 m m L a b o u c h e r e I n i t i a l L o t s   =   ( d o u b l e ) 0 . 1 ;  
 	 	 m m L a b o u c h e r e L i s t   =   ( s t r i n g ) " 1 , 2 , 3 , 4 , 5 , 6 " ;  
 	 	 m m L a b o u c h e r e R e v e r s e   =   ( b o o l ) f a l s e ;  
 	 	 m m S e q B a s e L o t s   =   ( d o u b l e ) 0 . 1 ;  
 	 	 m m S e q O n L o s s   =   ( s t r i n g ) " 3 , 2 , 6 " ;  
 	 	 m m S e q O n P r o f i t   =   ( s t r i n g ) " 1 " ;  
 	 	 m m S e q R e v e r s e   =   ( b o o l ) f a l s e ;  
 	 	 V o l u m e U p p e r L i m i t   =   ( d o u b l e ) 0 . 0 ;  
 	 	 S t o p L o s s M o d e   =   ( s t r i n g ) " f i x e d " ;  
 	 	 S t o p L o s s P i p s   =   ( d o u b l e ) 5 0 . 0 ;  
 	 	 S t o p L o s s P e r c e n t P r i c e   =   ( d o u b l e ) 0 . 5 5 ;  
 	 	 S t o p L o s s P e r c e n t T P   =   ( d o u b l e ) 1 0 0 . 0 ;  
 	 	 T a k e P r o f i t M o d e   =   ( s t r i n g ) " f i x e d " ;  
 	 	 T a k e P r o f i t P i p s   =   ( d o u b l e ) 5 0 . 0 ;  
 	 	 T a k e P r o f i t P e r c e n t P r i c e   =   ( d o u b l e ) 0 . 5 5 ;  
 	 	 T a k e P r o f i t P e r c e n t S L   =   ( d o u b l e ) 1 0 0 . 0 ;  
 	 	 E x p M o d e   =   ( s t r i n g ) " G T C " ;  
 	 	 E x p D a y s   =   ( i n t ) 0 ;  
 	 	 E x p H o u r s   =   ( i n t ) 1 ;  
 	 	 E x p M i n u t e s   =   ( i n t ) 0 ;  
 	 	 S l i p p a g e   =   ( u l o n g ) 4 ;  
 	 	 M y C o m m e n t   =   ( s t r i n g ) " " ;  
 	 	 A r r o w C o l o r S e l l   =   ( c o l o r ) c l r R e d ;  
 	 }  
  
 	 p u b l i c :   / *   T h e   m a i n   m e t h o d   * /  
 	 v i r t u a l   v o i d   _ e x e c u t e _ ( )  
 	 {  
 	 	 / / - -   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   = =   " f i x e d " )                   { s l p   =   S t o p L o s s P i p s ; }  
 	 	 e l s e   i f   ( S t o p L o s s M o d e   = =   " d y n a m i c P i p s " )       { s l p   =   _ d p S t o p L o s s _ ( ) ; }  
 	 	 e l s e   i f   ( S t o p L o s s M o d e   = =   " d y n a m i c D i g i t s " )   { s l p   =   t o P i p s ( _ d d S t o p L o s s _ ( ) , S y m b o l ) ; }  
 	 	 e l s e   i f   ( S t o p L o s s M o d e   = =   " d y n a m i c L e v e l " )     { s l l   =   _ d l S t o p L o s s _ ( ) ; }  
 	 	 e l s e   i f   ( S t o p L o s s M o d e   = =   " p e r c e n t P r i c e " )     { s l l   =   S y m b o l B i d ( S y m b o l )   +   ( S y m b o l B i d ( S y m b o l )   *   S t o p L o s s P e r c e n t P r i c e   /   1 0 0 ) ; }  
 	 	  
 	 	           i f   ( T a k e P r o f i t M o d e   = =   " f i x e d " )                   { t p p   =   T a k e P r o f i t P i p s ; }  
 	 	 e l s e   i f   ( T a k e P r o f i t M o d e   = =   " d y n a m i c P i p s " )       { t p p   =   _ d p T a k e P r o f i t _ ( ) ; }  
 	 	 e l s e   i f   ( T a k e P r o f i t M o d e   = =   " d y n a m i c D i g i t s " )   { t p p   =   t o P i p s ( _ d d T a k e P r o f i t _ ( ) , S y m b o l ) ; }  
 	 	 e l s e   i f   ( T a k e P r o f i t M o d e   = =   " d y n a m i c L e v e l " )     { t p l   =   _ d l T a k e P r o f i t _ ( ) ; }  
 	 	 e l s e   i f   ( T a k e P r o f i t M o d e   = =   " p e r c e n t P r i c e " )     { t p l   =   S y m b o l B i d ( S y m b o l )   -   ( S y m b o l B i d ( S y m b o l )   *   T a k e P r o f i t P e r c e n t P r i c e   /   1 0 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 B i d ( 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 B i d ( 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 ) ,   S y m b o l ) ;  
 	 	  
 	 	           i f   ( V o l u m e M o d e   = =   " f i x e d " )                         { l o t s   =   D y n a m i c L o t s ( S y m b o l ,   V o l u m e M o d e ,   V o l u m e S i z e ) ; }  
 	 	 e l s e   i f   ( V o l u m e M o d e   = =   " b l o c k - e q u i t y " )           { l o t s   =   D y n a m i c L o t s ( S y m b o l ,   V o l u m e M o d e ,   V o l u m e B l o c k P e r c e n t ) ; }  
 	 	 e l s e   i f   ( V o l u m e M o d e   = =   " b l o c k - b a l a n c e " )         { l o t s   =   D y n a m i c L o t s ( S y m b o l ,   V o l u m e M o d e ,   V o l u m e B l o c k P e r c e n t ) ; }  
 	 	 e l s e   i f   ( V o l u m e M o d e   = =   " b l o c k - f r e e m a r g i n " )   { l o t s   =   D y n a m i c L o t s ( S y m b o l ,   V o l u m e M o d e ,   V o l u m e B l o c k P e r c e n t ) ; }  
 	 	 e l s e   i f   ( V o l u m e M o d e   = =   " e q u i t y " )                       { l o t s   =   D y n a m i c L o t s ( S y m b o l ,   V o l u m e M o d e ,   V o l u m e P e r c e n t ) ; }  
 	 	 e l s e   i f   ( V o l u m e M o d e   = =   " b a l a n c e " )                     { l o t s   =   D y n a m i c L o t s ( S y m b o l ,   V o l u m e M o d e ,   V o l u m e P e r c e n t ) ; }  
 	 	 e l s e   i f   ( V o l u m e M o d e   = =   " f r e e m a r g i n " )               { l o t s   =   D y n a m i c L o t s ( S y m b o l ,   V o l u m e M o d e ,   V o l u m e P e r c e n t ) ; }  
 	 	 e l s e   i f   ( V o l u m e M o d e   = =   " e q u i t y R i s k " )               { l o t s   =   D y n a m i c L o t s ( S y m b o l ,   V o l u m e M o d e ,   V o l u m e R i s k ,   p r e _ s l _ p i p s ) ; }  
 	 	 e l s e   i f   ( V o l u m e M o d e   = =   " b a l a n c e R i s k " )             { l o t s   =   D y n a m i c L o t s ( S y m b o l ,   V o l u m e M o d e ,   V o l u m e R i s k ,   p r e _ s l _ p i p s ) ; }  
 	 	 e l s e   i f   ( V o l u m e M o d e   = =   " f r e e m a r g i n R i s k " )       { l o t s   =   D y n a m i c L o t s ( S y m b o l ,   V o l u m e M o d e ,   V o l u m e R i s k ,   p r e _ s l _ p i p s ) ; }  
 	 	 e l s e   i f   ( V o l u m e M o d e   = =   " f i x e d R i s k " )                 { l o t s   =   D y n a m i c L o t s ( S y m b o l ,   V o l u m e M o d e ,   V o l u m e S i z e R i s k ,   p r e _ s l _ p i p s ) ; }  
 	 	 e l s e   i f   ( V o l u m e M o d e   = =   " f i x e d R a t i o " )               { l o t s   =   D y n a m i c L o t s ( S y m b o l ,   V o l u m e M o d e ,   F i x e d R a t i o U n i t S i z e ,   F i x e d R a t i o D e l t a ) ; }  
 	 	 e l s e   i f   ( V o l u m e M o d e   = =   " d y n a m i c " )                     { l o t s   =   _ d V o l u m e S i z e _ ( ) ; }  
 	 	 e l s e   i f   ( V o l u m e M o d e   = =   " 1 3 2 6 " )                           { l o t s   =   B e t 1 3 2 6 ( G r o u p ,   S y m b o l ,   m m 1 3 2 6 I n i t i a l L o t s ,   m m 1 3 2 6 R e v e r s e ) ; }  
 	 	 e l s e   i f   ( V o l u m e M o d e   = =   " f i b o n a c c i " )                 { l o t s   =   B e t F i b o n a c c i ( G r o u p ,   S y m b o l ,   m m F i b o I n i t i a l L o t s ) ; }  
 	 	 e l s e   i f   ( V o l u m e M o d e   = =   " d a l e m b e r t " )                 { l o t s   =   B e t D a l e m b e r t ( G r o u p ,   S y m b o l ,   m m D a l e m b e r t I n i t i a l L o t s ,   m m D a l e m b e r t R e v e r s e ) ; }  
 	 	 e l s e   i f   ( V o l u m e M o d e   = =   " l a b o u c h e r e " )               { l o t s   =   B e t L a b o u c h e r e ( G r o u p ,   S y m b o l ,   m m L a b o u c h e r e I n i t i a l L o t s ,   m m L a b o u c h e r e L i s t ,   m m L a b o u c h e r e R e v e r s e ) ; }  
 	 	 e l s e   i f   ( V o l u m e M o d e   = =   " m a r t i n g a l e " )               { l o t s   =   B e t M a r t i n g a l e ( G r o u p ,   S y m b o l ,   m m M g I n i t i a l L o t s ,   m m M g M u l t i p l y O n L o s s ,   m m M g M u l t i p l y O n P r o f i t ,   m m M g A d d L o t s O n L o s s ,   m m M g A d d L o t s O n P r o f i t ,   m m M g R e s e t O n L o s s ,   m m M g R e s e t O n P r o f i t ) ; }  
 	 	 e l s e   i f   ( V o l u m e M o d e   = =   " s e q u e n c e " )                   { l o t s   =   B e t S e q u e n c e ( G r o u p ,   S y m b o l ,   m m S e q B a s e L o t s ,   m m S e q O n L o s s ,   m m S e q O n P r o f i t ,   m m S e q R e v e r s e ) ; }  
 	 	  
 	 	 l o t s   =   A l i g n L o t s ( S y m b o l ,   l o t s ,   0 ,   V o l u m e U p p e r L i m i t ) ;  
 	 	  
 	 	 d a t e t i m e   e x p   =   E x p i r a t i o n T i m e ( E x p M o d e , E x p D a y s , E x p H o u r s , E x p M i n u t e s , _ d E x p _ ( ) ) ;  
 	 	  
 	 	 / / - -   s e n d   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
 	 	 l o n g   t i c k e t   =   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 ) G r o u p ) ,   M y C o m m e n t ,   A r r o w C o l o r S e l l ,   e x p ) ;  
 	 	  
 	 	 i f   ( t i c k e t   >   0 )   { _ c a l l b a c k _ ( 1 ) ; }   e l s e   { _ c a l l b a c k _ ( 0 ) ; }  
 	 }  
 } ;  
  
 / /   " o n c e   p e r   p o s i t i o n / o r d e r "   m o d e l  
 t e m p l a t e < t y p e n a m e   T 1 >  
 c l a s s   M D L _ L o o p O n c e P e r :   p u b l i c   B l o c k C a l l s  
 {  
 	 p u b l i c :   / *   I n p u t   P a r a m e t e r s   * /  
 	 T 1   A l l o w O l d O r d e r s ;  
 	 / *   S t a t i c   P a r a m e t e r s   * /  
 	 i n t   m e m o r y [ ] ;  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   r )   { r e t u r n ; }  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 M D L _ L o o p O n c e P e r ( )  
 	 {  
 	 	 A l l o w O l d O r d e r s   =   ( b o o l ) f a l s e ;  
 	 }  
  
 	 p u b l i c :   / *   T h e   m a i n   m e t h o d   * /  
 	 v i r t u a l   v o i d   _ e x e c u t e _ ( )  
 	 {  
 	 	 i f   ( F X D _ B R E A K = = t r u e )   { r e t u r n ; }  
 	 	  
 	 	 L o o p e d R e s u m e ( ) ;  
 	 	  
 	 	  
 	 	  
 	 	 b o o l   n e x t   =   f a l s e ;  
 	 	  
 	 	 i f   ( A l l o w O l d O r d e r s   | |   O r d e r O p e n T i m e ( )   > =   T i m e A t S t a r t ( ) )  
 	 	 {  
 	 	       i n t   t i c k e t   =   ( i n t ) a t t r T i c k e t P a r e n t ( O r d e r T i c k e t ( ) ) ;  
 	 	  
 	 	       i f   ( I n A r r a y ( m e m o r y ,   t i c k e t )   = =   f a l s e )  
 	 	 	 {  
 	 	             A r r a y E n s u r e V a l u e ( m e m o r y ,   t i c k e t ) ;  
 	 	             n e x t   =   t r u e ;  
 	 	       }  
 	 	 }  
 	 	  
 	 	 i f   ( n e x t   = =   t r u e )   { _ c a l l b a c k _ ( 1 ) ; }   e l s e   { _ c a l l b a c k _ ( 0 ) ; }  
 	 }  
 } ;  
  
 / /   " T r a i l i n g   s t o p "   m o d e l  
 t e m p l a t e < t y p e n a m e   T 1 , t y p e n a m e   T 2 , t y p e n a m e   T 3 , t y p e n a m e   T 4 , t y p e n a m e   T 5 , t y p e n a m e   T 6 , t y p e n a m e   T 7 , t y p e n a m e   T 8 , t y p e n a m e   T 9 , t y p e n a m e   T 1 0 , t y p e n a m e   T 1 1 , t y p e n a m e   T 1 2 , t y p e n a m e   T 1 3 , t y p e n a m e   T 1 4 , t y p e n a m e   _ T 1 4 _ , t y p e n a m e   T 1 5 , t y p e n a m e   _ T 1 5 _ , t y p e n a m e   T 1 6 , t y p e n a m e   T 1 7 , t y p e n a m e   T 1 8 , t y p e n a m e   T 1 9 , t y p e n a m e   T 2 0 , t y p e n a m e   T 2 1 , t y p e n a m e   T 2 2 , t y p e n a m e   T 2 3 , t y p e n a m e   T 2 4 , t y p e n a m e   _ T 2 4 _ , t y p e n a m e   T 2 5 , t y p e n a m e   _ T 2 5 _ , t y p e n a m e   T 2 6 , t y p e n a m e   T 2 7 , t y p e n a m e   T 2 8 , t y p e n a m e   T 2 9 , t y p e n a m e   _ T 2 9 _ , t y p e n a m e   T 3 0 >  
 c l a s s   M D L _ T r a i l i n g S t o p 2 :   p u b l i c   B l o c k C a l l s  
 {  
 	 p u b l i c :   / *   I n p u t   P a r a m e t e r s   * /  
 	 T 1   G r o u p M o d e ;  
 	 T 2   G r o u p ;  
 	 T 3   S y m b o l M o d e ;  
 	 T 4   S y m b o l ;  
 	 T 5   B u y s O r S e l l s ;  
 	 T 6   T r a i l W h a t ;  
 	 T 7   T r a i l i n g R e f e r e n c e P r i c e ;  
 	 T 8   T r a i l i n g S t o p M o d e ;  
 	 T 9   t S t o p P i p s ;  
 	 T 1 0   t S t o p M o n e y ;  
 	 T 1 1   t S t o p M u l t i p l e ;  
 	 T 1 2   t S t o p P e r c e n t T P ;  
 	 T 1 3   t S t o p P e r c e n t P r o f i t ;  
 	 T 1 4   f t S t o p ;   v i r t u a l   _ T 1 4 _   _ f t S t o p _ ( ) { r e t u r n ( _ T 1 4 _ ) 0 ; }  
 	 T 1 5   f t D i g i t s ;   v i r t u a l   _ T 1 5 _   _ f t D i g i t s _ ( ) { r e t u r n ( _ T 1 5 _ ) 0 ; }  
 	 T 1 6   T r a i l i n g S t e p M o d e ;  
 	 T 1 7   t S t e p P i p s ;  
 	 T 1 8   t S t e p P e r c e n t T S ;  
 	 T 1 9   T r a i l i n g S t a r t M o d e ;  
 	 T 2 0   t S t a r t P i p s ;  
 	 T 2 1   t S t a r t P e r c e n t T S ;  
 	 T 2 2   t S t a r t P e r c e n t S L ;  
 	 T 2 3   t S t a r t P e r c e n t T P ;  
 	 T 2 4   f t S t a r t ;   v i r t u a l   _ T 2 4 _   _ f t S t a r t _ ( ) { r e t u r n ( _ T 2 4 _ ) 0 ; }  
 	 T 2 5   f t S t a r t F r a c t i o n ;   v i r t u a l   _ T 2 5 _   _ f t S t a r t F r a c t i o n _ ( ) { r e t u r n ( _ T 2 5 _ ) 0 ; }  
 	 T 2 6   T r a i l i n g T P m o d e ;  
 	 T 2 7   t T P p i p s ;  
 	 T 2 8   t T P p e r c e n t T S ;  
 	 T 2 9   f t T P ;   v i r t u a l   _ T 2 9 _   _ f t T P _ ( ) { r e t u r n ( _ T 2 9 _ ) 0 ; }  
 	 T 3 0   L e v e l C o l o r ;  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   r )   { r e t u r n ; }  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 M D L _ T r a i l i n g S t o p 2 ( )  
 	 {  
 	 	 G r o u p M o d e   =   ( s t r i n g ) " g r o u p " ;  
 	 	 G r o u p   =   ( s t r i n g ) " " ;  
 	 	 S y m b o l M o d e   =   ( s t r i n g ) " s y m b o l " ;  
 	 	 S y m b o l   =   ( s t r i n g ) C u r r e n t S y m b o l ( ) ;  
 	 	 B u y s O r S e l l s   =   ( s t r i n g ) " b o t h " ;  
 	 	 T r a i l W h a t   =   ( i n t ) 1 ;  
 	 	 T r a i l i n g R e f e r e n c e P r i c e   =   ( i n t ) 0 ;  
 	 	 T r a i l i n g S t o p M o d e   =   ( s t r i n g ) " f i x e d " ;  
 	 	 t S t o p P i p s   =   ( d o u b l e ) 4 0 . 0 ;  
 	 	 t S t o p M o n e y   =   ( d o u b l e ) 1 0 . 0 ;  
 	 	 t S t o p M u l t i p l e   =   ( s t r i n g ) " 2 0 / 5 ,   3 0 / 1 0 " ;  
 	 	 t S t o p P e r c e n t T P   =   ( d o u b l e ) 1 0 0 . 0 ;  
 	 	 t S t o p P e r c e n t P r o f i t   =   ( d o u b l e ) 5 0 . 0 ;  
 	 	 T r a i l i n g S t e p M o d e   =   ( s t r i n g ) " f i x e d " ;  
 	 	 t S t e p P i p s   =   ( d o u b l e ) 1 . 0 ;  
 	 	 t S t e p P e r c e n t T S   =   ( d o u b l e ) 1 0 . 0 ;  
 	 	 T r a i l i n g S t a r t M o d e   =   ( s t r i n g ) " n o n e " ;  
 	 	 t S t a r t P i p s   =   ( d o u b l e ) 1 0 . 0 ;  
 	 	 t S t a r t P e r c e n t T S   =   ( d o u b l e ) 1 0 0 . 0 ;  
 	 	 t S t a r t P e r c e n t S L   =   ( d o u b l e ) 1 0 . 0 ;  
 	 	 t S t a r t P e r c e n t T P   =   ( d o u b l e ) 1 0 . 0 ;  
 	 	 T r a i l i n g T P m o d e   =   ( s t r i n g ) " n o n e " ;  
 	 	 t T P p i p s   =   ( d o u b l e ) 2 0 . 0 ;  
 	 	 t T P p e r c e n t T S   =   ( d o u b l e ) 2 0 0 . 0 ;  
 	 	 L e v e l C o l o r   =   ( c o l o r ) c l r D e e p P i n k ;  
 	 }  
  
 	 p u b l i c :   / *   T h e   m a i n   m e t h o d   * /  
 	 v i r t u a l   v o i d   _ e x e c u t e _ ( )  
 	 {  
 	 	 i n t   t o t a l   =   T r a d e s T o t a l ( ) ;  
 	 	  
 	 	 f o r   ( i n t   i n d e x   =   0 ;   i n d e x   <   t o t a l ;   i n d e x + + )  
 	 	 {  
 	 	 	 i f   ( T r a d e S e l e c t B y I n d e x ( i n d e x ,   G r o u p M o d e ,   G r o u p ,   S y m b o l M o d e ,   S y m b o l ,   B u y s O r S e l l s ) )  
 	 	 	 {  
 	 	 	 	 s t r i n g   s y m b o l           =   O r d e r S y m b o 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 ) ;  
 	 	 	 	 d o u b l e   s t o p s 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 _ S T O P S _ L E V E 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 n t   p o l a r i t y             =   1 ;       / /   1   =   b u y ,   - 1   =   s e l l  
 	 	 	 	 d o u b l e   a s k b i d           =   a s k ;   / /   c o u l d   b e   A s k   o r   B i d  
 	 	 	 	 d o u b l e   b i d a s k           =   b i d ;   / /   t h e   o p p o s i t e   o f   a s k b i d  
 	 	 	 	 d o u b l e   s l t p               =   0 ;       / /   c o u l d   b e   S L   o r   T P  
 	 	 	 	 d o u b l e   t p s l               =   0 ;       / /   t h e   o p p o s i t e   o f   s l t p  
 	 	 	 	 d o u b l e   f s l                 =   0 ;       / /   F r e e z e   L e v e l  
 	 	 	 	 d o u b l e   l i m i t             =   0 ;  
 	 	 	 	 d o u b l e   t _ s t o p           =   0 ;       / /   t r a i l i n g   S T O P  
 	 	 	 	 d o u b l e   t _ s t a r t         =   0 ;       / /   t r a i l i n g   S T A R T  
 	 	 	 	 d o u b l e   t _ s t e p           =   0 ;       / /   t r a i l i n g   S T E P  
 	 	 	 	 d o u b l e   t _ o p p             =   0 ;       / /   t r a i l i n g   O p p o s i t e   ( T P   w h e n   t r a i l i n g   S L   o r   S L   w h e n   t r a i l i n g   T P )  
 	 	  
 	 	 	 	 i f   ( T r a i l W h a t   >   0 )   {  
 	 	 	 	 	 s l t p   =   a t t r S t o p L o s s ( ) ;  
 	 	 	 	 	 t p s l   =   a t t r T a k e P r o f i t ( ) ;  
 	 	 	 	 }  
 	 	 	 	 e l s e   {  
 	 	 	 	 	 s l t p   =   a t t r T a k e P r o f i t ( ) ;  
 	 	 	 	 	 t p s l   =   a t t r S t o p L o s s ( ) ;  
 	 	 	 	 }  
 	 	  
 	 	 	 	 i f   ( O r d e r T y p e ( )   = =   0 )   {  
 	 	 	 	 	 p o l a r i t y   =   1 ;  
 	 	  
 	 	 	 	 	 i f   ( T r a i l i n g R e f e r e n c e P r i c e   = =   1 )  
 	 	 	 	 	 {  
 	 	 	 	 	 	 a s k b i d   =   b i d ;  
 	 	 	 	 	 	 b i d a s k   =   a s k ;  
 	 	 	 	 	 }  
 	 	 	 	 }  
 	 	 	 	 e l s e   i f   ( O r d e r T y p e ( )   = =   1 )   {  
 	 	 	 	 	 p o l a r i t y   =   - 1 ;  
 	 	 	 	 	 a s k b i d       =   b i d ;  
 	 	 	 	 	 b i d a s k       =   a s k ;  
 	 	  
 	 	 	 	 	 i f   ( T r a i l i n g R e f e r e n c e P r i c e   = =   1 )   {  
 	 	 	 	 	 	 a s k b i d   =   a s k ;  
 	 	 	 	 	 	 b i d a s k   =   b i d ;  
 	 	 	 	 	 }  
 	 	 	 	 }  
 	 	  
 	 	 	 	 i f   ( T r a i l i n g R e f e r e n c e P r i c e   = =   2 )   {  
 	 	 	 	 	 a s k b i d   =   ( a s k   +   b i d )   /   2 ;  
 	 	 	 	 	 b i d a s k   =   ( a s k   +   b i d )   /   2 ;  
 	 	 	 	 }  
 	 	  
 	 	 	 	 / /   T r a i l i n g   S t o p   S i z e  
 	 	 	 	           i f   ( T r a i l i n g S t o p M o d e   = =   " f i x e d " )                   { t _ s t o p   =   t o D i g i t s ( t S t o p P i p s ,   s y m b o l ) ; }    
 	 	 	 	 e l s e   i f   ( T r a i l i n g S t o p M o d e   = =   " p e r c e n t T P " )           { t _ s t o p   =   ( M a t h A b s ( O r d e r O p e n P r i c e ( )   -   t p s l ) )   *   ( t S t o p P e r c e n t T P   /   1 0 0 ) ; }  
 	 	 	 	 e l s e   i f   ( T r a i l i n g S t o p M o d e   = =   " p e r c e n t P r o f i t " )   { t _ s t o p   =   ( M a t h A b s ( a s k b i d   -   O r d e r O p e n P r i c e ( ) ) )   *   ( t S t o p P e r c e n t P r o f i t   /   1 0 0 ) ; }  
 	 	 	 	 e l s e   i f   ( T r a i l i n g S t o p M o d e   = =   " d y n a m i c S i z e " )       { t _ s t o p   =   t o D i g i t s ( _ f t S t o p _ ( ) ,   s y m b o l ) ; }  
 	 	 	 	 e l s e   i f   ( T r a i l i n g S t o p M o d e   = =   " d y n a m i c D i g i t s " )   { t _ s t o p   =   _ f t D i g i t s _ ( ) ; }  
 	 	 	 	 e l s e   i f   ( T r a i l i n g S t o p M o d e   = =   " d y n a m i c " )  
 	 	 	 	 {  
 	 	 	 	 	 / /   T O D O :   f t S t o p   i s   n o w   u s e d   f o r   b o t h ,   d y n a m i c   a n d   d y n a m i c S i z e   -   s e p a r a t e   i t  
 	 	 	 	 	 t _ s t o p   =   _ f t S t o p _ ( ) ;  
 	 	 	 	 	 t _ s t o p   =   ( p o l a r i t y   = =   1 )   ?   a s k   -   t _ s t o p   :   t _ s t o p   -   b i d ;  
 	 	 	 	 }  
 	 	 	 	 e l s e   i f   ( T r a i l i n g S t o p M o d e   = =   " m o n e y " )  
 	 	 	 	 {  
 	 	 	 	 	 t _ s t o p   =   t S t o p M o n e y ;  
 	 	  
 	 	 	 	 	 d o u b l e   l o t 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 _ C O N T R A C T _ S I Z E ) ;  
 	 	 	 	 	 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 )   /   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 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 _ s t o p   =   t _ s t o p   /     ( O r d e r L o t s ( )   *   P i p V a l u e ( s y m b o l ) ) ;  
 	 	 	 	 	 / /   T O D O :   r e m o v e   t h i s   t o D i g i t s ( ) ,   t h e   c a l c u l a t i o n   s h o u l d   b e   m a d e   d i r e c t l y   i n t o   d i g i t s  
 	 	 	 	 	 t _ s t o p   =   t o D i g i t s ( t _ s t o p   /   t i c k v a l u e ,   s y m b o l ) ;  
 	 	 	 	 }  
 	 	  
 	 	 	 	 / /   T r a i l i n g   S t a r t   L e v e l  
 	 	 	 	           i f   ( T r a i l i n g S t a r t M o d e   = =   " n o n e " )                           { t _ s t a r t   =   - E M P T Y _ V A L U E ; }  
 	 	 	 	 e l s e   i f   ( T r a i l i n g S t a r t M o d e   = =   " z e r o " )                           { t _ s t a r t   =   0 ; }  
 	 	 	 	 e l s e   i f   ( T r a i l i n g S t a r t M o d e   = =   " f i x e d " )                         { t _ s t a r t   =   t o D i g i t s ( t S t a r t P i p s ,   s y m b o l ) ; }  
 	 	 	 	 e l s e   i f   ( T r a i l i n g S t a r t M o d e   = =   " p e r c e n t T S " )                 { t _ s t a r t   =   t _ s t o p   *   ( t S t a r t P e r c e n t T S   /   1 0 0 ) ; }  
 	 	 	 	 e l s e   i f   ( T r a i l i n g S t a r t M o d e   = =   " p e r c e n t T P " )                 { t _ s t a r t   =   ( M a t h A b s ( O r d e r O p e n P r i c e ( )   -   t p s l ) )   *   ( t S t a r t P e r c e n t T P   /   1 0 0 ) ; }  
 	 	 	 	 e l s e   i f   ( T r a i l i n g S t a r t M o d e   = =   " p e r c e n t S L " )                 { t _ s t a r t   =   ( M a t h A b s ( O r d e r O p e n P r i c e ( )   -   s l t p ) )   *   ( t S t a r t P e r c e n t S L   /   1 0 0 ) ; }  
 	 	 	 	 e l s e   i f   ( T r a i l i n g S t a r t M o d e   = =   " f u n c t i o n " )                   { t _ s t a r t   =   t o D i g i t s ( _ f t S t a r t _ ( ) ,   s y m b o l ) ; }  
 	 	 	 	 e l s e   i f   ( T r a i l i n g S t a r t M o d e   = =   " f u n c t i o n F r a c t i o n " )   { t _ s t a r t   =   _ f t S t a r t F r a c t i o n _ ( ) ; }  
 	 	  
 	 	 	 	 / /   T r a i l i n g   S t e p   S i z e  
 	 	 	 	           i f   ( T r a i l i n g S t e p M o d e   = =   " f i x e d " )           { t _ s t e p   =   t o D i g i t s ( t S t e p P i p s ,   s y m b o l ) ; }  
 	 	 	 	 e l s e   i f   ( T r a i l i n g S t e p M o d e   = =   " p e r c e n t T S " )   { t _ s t e p   =   t _ s t o p   *   ( t S t e p P e r c e n t T S   /   1 0 0 ) ; }  
 	 	  
 	 	 	 	 / /   T r a i l i n g   O p p o s i t e   S i z e  
 	 	 	 	           i f   ( T r a i l i n g T P m o d e   = =   " n o n e " )             { t _ o p p   =   t p s l ; }  
 	 	 	 	 e l s e   i f   ( T r a i l i n g T P m o d e   = =   " c l e a r " )           { t _ o p p   =   0 ; }  
 	 	 	 	 e l s e   i f   ( T r a i l i n g T P m o d e   = =   " f i x e d " )           { t _ o p p   =   T r a i l W h a t   *   ( O r d e r O p e n P r i c e ( )   +   ( p o l a r i t y   *   t o D i g i t s ( t T P p i p s ,   s y m b o l ) ) ) ; }  
 	 	 	 	 e l s e   i f   ( T r a i l i n g T P m o d e   = =   " p e r c e n t T S " )   { t _ o p p   =   T r a i l W h a t   *   ( O r d e r O p e n P r i c e ( )   +   ( p o l a r i t y   *   t o D i g i t s ( t _ s t o p   *   ( t T P p e r c e n t T S   /   1 0 0 ) ,   s y m b o l ) ) ) ; }  
 	 	 	 	 e l s e   i f   ( T r a i l i n g T P m o d e   = =   " f u n c t i o n " )     { t _ o p p   =   _ f t T P _ ( ) ; }  
 	 	  
 	 	 	 	 / /   t h i s   m o d e   i s   l o c a t e d   h e r e   b e c a u s e   i t   o v e r r i d e s   S t a r t ,   S t o p   a n d   S t e p  
 	 	 	 	 / /   t h e   i d e a   h e r e   i s   t o   u s e   S t a r t   a s   t a r g e t   p r o f i t s  
 	 	 	 	 i f   ( T r a i l i n g S t o p M o d e   = =   " m u l t i p l e " )  
 	 	 	 	 {  
 	 	 	 	 	 b o o l   n e x t   =   f a l s e ;  
 	 	 	 	 	 s t r i n g   t m p 1 [ ] ;  
 	 	 	 	 	 s t r i n g   t m p 2 [ ] ;  
 	 	  
 	 	 	 	 	 S t r i n g E x p l o d e ( " , " ,   t S t o p M u l t i p l e ,   t m p 1 ) ;  
 	 	  
 	 	 	 	 	 f o r   ( i n t   i   =   A r r a y S i z e ( t m p 1 ) - 1 ;   i   > =   0 ;   i - - )  
 	 	 	 	 	 {  
 	 	 	 	 	 	 S t r i n g E x p l o d e ( " / " ,   t m p 1 [ i ] ,   t m p 2 ) ;  
 	 	  
 	 	 	 	 	 	 i f   ( A r r a y S i z e ( t m p 2 )   ! =   2 )   { c o n t i n u e ; }  
 	 	  
 	 	 	 	 	 	 / /   t r a i l i n g   s t a r t   w i l l   b e   u s e d   a s   t h e   t r e s h o l d   l e v e l  
 	 	 	 	 	 	 d o u b l e   n e w _ s t a r t   =   t o D i g i t s ( S t r i n g T o D o u b l e ( S t r i n g T r i m ( t m p 2 [ 0 ] ) ) ,   s y m b o l ) ;  
 	 	  
 	 	 	 	 	 	 / /   t h e   r e g u l a r   t r a i l i n g   s t a r t   i s   b i g g e r   t h a n   t h i s   l e v e l   - >   s k i p  
 	 	 	 	 	 	 i f   ( n e w _ s t a r t   <   t _ s t a r t )   { c o n t i n u e ; }  
 	 	  
 	 	 	 	 	 	 / /   c h e c k   w h e t h e r   t h e   c u r r e n t   p r i c e < - > o p   d i s t a n c e   i s   b i g g e r   t h a n   s o m e   o f   t h e   d e s i r e d   l e v e l s  
 	 	 	 	 	 	 d o u b l e   d i f f   =   N o r m a l i z e D o u b l e ( a s k b i d   -   O r d e r O p e n P r i c e ( ) ,   d i g i t s ) ;  
 	 	  
 	 	 	 	 	 	 i f   ( p o l a r i t y   *   T r a i l W h a t   *   d i f f   > =   n e w _ s t a r t )  
 	 	 	 	 	 	 {  
 	 	 	 	 	 	 	 / /   a n d   s e t u p   p a r a m e t e r s   s o   S L   w i l l   b e   m o v e d  
 	 	 	 	 	 	 	 t _ s t a r t   =   n e w _ s t a r t ;  
 	 	 	 	 	 	 	 t _ s t o p     =   p o l a r i t y   *   T r a i l W h a t   *   d i f f   -   t o D i g i t s ( S t r i n g T o D o u b l e ( S t r i n g T r i m ( t m p 2 [ 1 ] ) ) ,   s y m b o l ) ;  
 	 	  
 	 	 	 	 	 	 	 n e x t   =   t r u e ;  
 	 	 	 	 	 	 	 b r e a k ;  
 	 	 	 	 	 	 }  
 	 	 	 	 	 }  
 	 	  
 	 	 	 	 	 i f   ( n e x t   = =   f a l s e )   { c o n t i n u e ; }  
 	 	 	 	 }  
 	 	  
 	 	 	 	 s t o p s l e v e l       =   s t o p s l e v e 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   ( t _ s t o p   < =   0 )   { c o n t i n u e ; }  
 	 	  
 	 	 	 	 i f   ( O r d e r T y p e ( )   = =   0   & &   T r a i l W h a t   *   ( a s k b i d   -   O r d e r O p e n P r i c e ( ) )   >   t _ s t a r t )  
 	 	 	 	 {  
 	 	 	 	 	 i f   ( ( T r a i l W h a t   *   ( a s k b i d   -   s l t p )   > =   t _ s t o p   +   t _ s t e p )   | |   s l t p   = =   0 )  
 	 	 	 	 	 {  
 	 	 	 	 	 	 / /   c o n s i d e r   m i n i m u m   s t o p  
 	 	 	 	 	 	 f s l       =   M a t h A b s ( a s k b i d   -   t _ s t o p ) ;  
 	 	 	 	 	 	 l i m i t   =   b i d a s k   -   s t o p s l e v e l   *   T r a i l W h a t ;  
 	 	  
 	 	 	 	 	 	 i f   ( f s l   >   l i m i t )   { f s l   =   l i m i t ; }  
 	 	  
 	 	 	 	 	 	 i f   ( T r a i l W h a t   = =   1 )   / /   t r a i l   S L  
 	 	 	 	 	 	 {  
 	 	 	 	 	 	 	 i f   ( s l t p   = =   0   | |   s l t p   <   f s l )   {  
 	 	 	 	 	 	 	 	 M o d i f y S t o p s ( O r d e r T i c k e t ( ) ,   a s k b i d   -   t _ s t o p ,   t _ o p p ,   L e v e l C o l o r ) ;  
 	 	 	 	 	 	 	 }  
 	 	 	 	 	 	 }  
 	 	 	 	 	 	 e l s e   {   / /   t r a i l   T P  
 	 	 	 	 	 	 	 i f   ( s l t p   = =   0   | |   s l t p   >   f s l )   {  
 	 	 	 	 	 	 	 	 M o d i f y S t o p s ( O r d e r T i c k e t ( ) ,   t _ o p p ,   a s k b i d   +   t _ s t o p ,   L e v e l C o l o r ) ;  
 	 	 	 	 	 	 	 }  
 	 	 	 	 	 	 }  
 	 	 	 	 	 }  
 	 	 	 	 }  
 	 	 	 	 e l s e   i f   ( O r d e r T y p e ( )   = =   1   & &   T r a i l W h a t   *   ( O r d e r O p e n P r i c e ( )   -   a s k b i d )   >   t _ s t a r t )  
 	 	 	 	 {  
 	 	 	 	 	 i f   ( ( T r a i l W h a t   *   ( s l t p   -   a s k b i d )   > =   t _ s t o p   +   t _ s t e p )   | |   s l t p   = =   0 )  
 	 	 	 	 	 {  
 	 	 	 	 	 	 / /   c o n s i d e r   m i n i m u m   s t o p  
 	 	 	 	 	 	 f s l       =   M a t h A b s ( a s k b i d   +   t _ s t o p ) ;  
 	 	 	 	 	 	 l i m i t   =   b i d a s k   +   s t o p s l e v e l   *   T r a i l W h a t ;  
 	 	  
 	 	 	 	 	 	 i f   ( f s l   <   l i m i t )   { f s l   =   l i m i t ; }  
 	 	  
 	 	 	 	 	 	 i f   ( T r a i l W h a t   = =   1 )  
 	 	 	 	 	 	 {   / /   t r a i l   S L  
 	 	 	 	 	 	 	 i f   ( s l t p   = =   0   | |   s l t p   >   f s l )  
 	 	 	 	 	 	 	 {  
 	 	 	 	 	 	 	 	 M o d i f y S t o p s ( O r d e r T i c k e t ( ) ,   a s k b i d   +   t _ s t o p ,   t _ o p p ,   L e v e l C o l o r ) ;  
 	 	 	 	 	 	 	 }  
 	 	 	 	 	 	 }  
 	 	 	 	 	 	 e l s e  
 	 	 	 	 	 	 {   / /   t r a i l   T P  
 	 	 	 	 	 	 	 i f   ( s l t p   = =   0   | |   s l t p   <   f s l )  
 	 	 	 	 	 	 	 {  
 	 	 	 	 	 	 	 	 M o d i f y S t o p s ( O r d e r T i c k e t ( ) ,   t _ o p p ,   a s k b i d   -   t _ s t o p ,   L e v e l C o l o r ) ;  
 	 	 	 	 	 	 	 }  
 	 	 	 	 	 	 }  
 	 	 	 	 	 }  
 	 	 	 	 }  
 	 	 	 }  
 	 	 }  
 	 	  
 	 	 _ c a l l b a c k _ ( 1 ) ;  
 	 }  
 } ;  
  
 / /   " p i p s   a w a y   f r o m   t a k e - p r o f i t "   m o d e l  
 t e m p l a t e < t y p e n a m e   T 1 , t y p e n a m e   T 2 , t y p e n a m e   T 3 , t y p e n a m e   T 4 , t y p e n a m e   T 5 , t y p e n a m e   _ T 5 _ >  
 c l a s s   M D L _ L o o p P i p s A w a y T P :   p u b l i c   B l o c k C a l l s  
 {  
 	 p u b l i c :   / *   I n p u t   P a r a m e t e r s   * /  
 	 T 1   P i p s A w a y M o d e ;  
 	 T 2   P i p s A w a y R e f e r e n c e P r i c e ;  
 	 T 3   P i p s A w a y ;  
 	 T 4   P i p s A w a y P e r c e n t ;  
 	 T 5   f P i p s A w a y ;   v i r t u a l   _ T 5 _   _ f P i p s A w a y _ ( ) { r e t u r n ( _ T 5 _ ) 0 ; }  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   r )   { r e t u r n ; }  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 M D L _ L o o p P i p s A w a y T P ( )  
 	 {  
 	 	 P i p s A w a y M o d e   =   ( s t r i n g ) " f i x e d " ;  
 	 	 P i p s A w a y R e f e r e n c e P r i c e   =   ( i n t ) 0 ;  
 	 	 P i p s A w a y   =   ( d o u b l e ) 1 5 0 . 0 ;  
 	 	 P i p s A w a y P e r c e n t   =   ( d o u b l e ) 1 5 0 . 0 ;  
 	 }  
  
 	 p u b l i c :   / *   T h e   m a i n   m e t h o d   * /  
 	 v i r t u a l   v o i d   _ e x e c u t e _ ( )  
 	 {  
 	 	 i f   ( F X D _ B R E A K   = =   t r u e )   { r e t u r n ; }  
 	 	  
 	 	 L o o p e d R e s u m e ( ) ;  
 	 	  
 	 	 b o o l   n e x t           =   f a l s e ;  
 	 	 s t r i n g   s y m b o l   =   O r d e r S y m b o l ( ) ;  
 	 	  
 	 	 i f   ( a t t r T a k e P r o f i t ( )   < =   0 )   { r e t u r n ; }  
 	 	  
 	 	 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 ) ;  
 	 	 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 ) ;  
 	 	 d o u b l e   s l         =   0 ;  
 	 	 d o u b l e   t p         =   0 ;  
 	 	 d o u b l e   p i p s     =   P i p s A w a y ;  
 	 	 d o u b l e   p r i c e   =   0 ;  
 	 	  
 	 	 i f   ( P i p s A w a y M o d e   = =   " p e r c e n t S L " )  
 	 	 {  
 	 	       i f   ( a t t r S t o p L o s s ( )   < =   0 )   { r e t u r n ; }  
 	 	  
 	 	       s l       =   N o r m a l i z e D o u b l e ( M a t h A b s ( a t t r S t o p L o s s ( ) - O r d e r O p e n P r i c e ( ) ) ,   d i g i t s ) ;  
 	 	       p i p s   =   t o P i p s ( s l , s y m b o l ) * ( P i p s A w a y P e r c e n t / 1 0 0 ) ;  
 	 	 }  
 	 	 e l s e   i f   ( P i p s A w a y M o d e   = =   " p e r c e n t T P " )  
 	 	 {  
 	 	       t p       =   N o r m a l i z e D o u b l e ( M a t h A b s ( a t t r T a k e P r o f i t ( ) - O r d e r O p e n P r i c e ( ) ) ,   d i g i t s ) ;  
 	 	       p i p s   =   t o P i p s ( t p , s y m b o l ) * ( P i p s A w a y P e r c e n t / 1 0 0 ) ;  
 	 	 }  
 	 	 e l s e   i f   ( P i p s A w a y M o d e   = =   " f u n c t i o n " )  
 	 	 {  
 	 	       p i p s   =   _ f P i p s A w a y _ ( ) ;  
 	 	 }  
 	 	  
 	 	           i f   ( P i p s A w a y R e f e r e n c e P r i c e   = =   0 )   p r i c e   =   a s k ;  
 	 	 e l s e   i f   ( P i p s A w a y R e f e r e n c e P r i c e   = =   1 )   p r i c e   =   b i d ;  
 	 	 e l s e   i f   ( P i p s A w a y R e f e r e n c e P r i c e   = =   2 )   p r i c e   =   ( a s k   +   b i d )   /   2 ;  
 	 	  
 	 	 i f   ( I s O r d e r T y p e B u y ( ) )  
 	 	 {  
 	 	       i f ( ( a t t r T a k e P r o f i t ( ) - p r i c e )   > =   t o D i g i t s ( p i p s ,   s y m b o l ) )  
 	 	 	 {  
 	 	 	 	 n e x t   =   t r u e ;  
 	 	 	 }  
 	 	 }  
 	 	 e l s e  
 	 	 {  
 	 	       i f ( ( p r i c e - a t t r T a k e P r o f i t ( ) )   > =   t o D i g i t s ( p i p s ,   s y m b o l ) )  
 	 	 	 {  
 	 	 	 	 n e x t   =   t r u e ;  
 	 	 	 }  
 	 	 }  
 	 	  
 	 	 i f   ( n e x t   = =   t r u e )   { _ c a l l b a c k _ ( 1 ) ; }   e l s e   { _ c a l l b a c k _ ( 0 ) ; }  
 	 }  
 } ;  
  
 / /   " S e t   F l a g   ( t r u e - f a l s e ) "   m o d e l  
 t e m p l a t e < t y p e n a m e   T 1 , t y p e n a m e   T 2 >  
 c l a s s   M D L _ F l a g S e t B :   p u b l i c   B l o c k C a l l s  
 {  
 	 p u b l i c :   / *   I n p u t   P a r a m e t e r s   * /  
 	 T 1   F l a g N a m e ;  
 	 T 2   F l a g V a l u e ;  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   r )   { r e t u r n ; }  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 M D L _ F l a g S e t B ( )  
 	 {  
 	 	 F l a g N a m e   =   ( s t r i n g ) " M y F l a g " ;  
 	 	 F l a g V a l u e   =   ( b o o l ) t r u e ;  
 	 }  
  
 	 p u b l i c :   / *   T h e   m a i n   m e t h o d   * /  
 	 v i r t u a l   v o i d   _ e x e c u t e _ ( )  
 	 {  
 	 	 S e t F l a g B ( F l a g N a m e , F l a g V a l u e ) ;  
 	 	  
 	 	 _ c a l l b a c k _ ( 1 ) ;  
 	 }  
 } ;  
  
 / /   " C h e c k   F l a g   ( t r u e - f a l s e ) "   m o d e l  
 t e m p l a t e < t y p e n a m e   T 1 , t y p e n a m e   T 2 >  
 c l a s s   M D L _ F l a g C h e c k B :   p u b l i c   B l o c k C a l l s  
 {  
 	 p u b l i c :   / *   I n p u t   P a r a m e t e r s   * /  
 	 T 1   F l a g N a m e ;  
 	 T 2   F l a g V a l u e ;  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   r )   { r e t u r n ; }  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 M D L _ F l a g C h e c k B ( )  
 	 {  
 	 	 F l a g N a m e   =   ( s t r i n g ) " M y F l a g " ;  
 	 	 F l a g V a l u e   =   ( b o o l ) t r u e ;  
 	 }  
  
 	 p u b l i c :   / *   T h e   m a i n   m e t h o d   * /  
 	 v i r t u a l   v o i d   _ e x e c u t e _ ( )  
 	 {  
 	 	 i f   ( G e t F l a g B ( F l a g N a m e )   = =   F l a g V a l u e )   { _ c a l l b a c k _ ( 1 ) ; }   e l s e   { _ c a l l b a c k _ ( 0 ) ; }  
 	 }  
 } ;  
  
 / /   " M o d i f y   s t o p s   o f   p o s i t i o n s "   m o d e l  
 t e m p l a t e < t y p e n a m e   T 1 , t y p e n a m e   T 2 , t y p e n a m e   T 3 , t y p e n a m e   T 4 , t y p e n a m e   T 5 , t y p e n a m e   T 6 , t y p e n a m e   T 7 , t y p e n a m e   T 8 , t y p e n a m e   _ T 8 _ , t y p e n a m e   T 9 , t y p e n a m e   T 1 0 , t y p e n a m e   T 1 1 , t y p e n a m e   T 1 2 , t y p e n a m e   _ T 1 2 _ , t y p e n a m e   T 1 3 , t y p e n a m e   T 1 4 , t y p e n a m e   T 1 5 , t y p e n a m e   _ T 1 5 _ , t y p e n a m e   T 1 6 >  
 c l a s s   M D L _ M o d i f y O p e n e d :   p u b l i c   B l o c k C a l l s  
 {  
 	 p u b l i c :   / *   I n p u t   P a r a m e t e r s   * /  
 	 T 1   G r o u p M o d e ;  
 	 T 2   G r o u p ;  
 	 T 3   S y m b o l M o d e ;  
 	 T 4   S y m b o l ;  
 	 T 5   B u y s O r S e l l s ;  
 	 T 6   O r d e r M i n u t e s ;  
 	 T 7   R e l a t i v e T o ;  
 	 T 8   f R e l a t i v e P r i c e ;   v i r t u a l   _ T 8 _   _ f R e l a t i v e P r i c e _ ( ) { r e t u r n ( _ T 8 _ ) 0 ; }  
 	 T 9   N e w S L T P m o d e ;  
 	 T 1 0   N e w S t o p L o s s ;  
 	 T 1 1   N e w S t o p L o s s P e r c e n t ;  
 	 T 1 2   f N e w S t o p L o s s ;   v i r t u a l   _ T 1 2 _   _ f N e w S t o p L o s s _ ( ) { r e t u r n ( _ T 1 2 _ ) 0 ; }  
 	 T 1 3   N e w T a k e P r o f i t ;  
 	 T 1 4   N e w T a k e P r o f i t P e r c e n t ;  
 	 T 1 5   f N e w T a k e P r o f i t ;   v i r t u a l   _ T 1 5 _   _ f N e w T a k e P r o f i t _ ( ) { r e t u r n ( _ T 1 5 _ ) 0 ; }  
 	 T 1 6   L e v e l C o l o r ;  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   r )   { r e t u r n ; }  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 M D L _ M o d i f y O p e n e d ( )  
 	 {  
 	 	 G r o u p M o d e   =   ( s t r i n g ) " g r o u p " ;  
 	 	 G r o u p   =   ( s t r i n g ) " " ;  
 	 	 S y m b o l M o d e   =   ( s t r i n g ) " s y m b o l " ;  
 	 	 S y m b o l   =   ( s t r i n g ) C u r r e n t S y m b o l ( ) ;  
 	 	 B u y s O r S e l l s   =   ( s t r i n g ) " b o t h " ;  
 	 	 O r d e r M i n u t e s   =   ( i n t ) 0 ;  
 	 	 R e l a t i v e T o   =   ( s t r i n g ) " o p e n p r i c e " ;  
 	 	 N e w S L T P m o d e   =   ( s t r i n g ) " f i x e d " ;  
 	 	 N e w S t o p L o s s   =   ( d o u b l e ) 5 0 . 0 ;  
 	 	 N e w S t o p L o s s P e r c e n t   =   ( d o u b l e ) 5 0 . 0 ;  
 	 	 N e w T a k e P r o f i t   =   ( d o u b l e ) 5 0 . 0 ;  
 	 	 N e w T a k e P r o f i t P e r c e n t   =   ( d o u b l e ) 5 0 . 0 ;  
 	 	 L e v e l C o l o r   =   ( c o l o r ) c l r D e e p P i n k ;  
 	 }  
  
 	 p u b l i c :   / *   T h e   m a i n   m e t h o d   * /  
 	 v i r t u a l   v o i d   _ e x e c u t e _ ( )  
 	 {  
 	 	 f o r   ( i n t   i n d e x   =   T r a d e s T o t a l ( ) - 1 ;   i n d e x   > =   0 ;   i n d e x - - )  
 	 	 {  
 	 	 	 i f   ( T r a d e S e l e c t B y I n d e x ( i n d e x ,   G r o u p M o d e ,   G r o u p ,   S y m b o l M o d 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 ( )   -   O r d e 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 t r i n g   s y m b o l   =   O r d e r 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 ) ;  
 	 	 	 	 	 d o u b l e   o l d S L   =   N o r m a l i z e D o u b l e ( a t t r S t o p L o s s ( ) ,   d i g i t s ) ;  
 	 	 	 	 	 d o u b l e   o l d T P   =   N o r m a l i z e D o u b l e ( a t t r T a k e P r o f i t ( ) ,   d i g i t s ) ;  
 	 	 	 	 	 d o u b l e   O P         =   N o r m a l i z e D o u b l e ( O r d e r O p e n P r i c e ( ) ,   d i g i t s ) ;  
 	 	  
 	 	 	 	 	 / / - -   W h a t   i s   t h e   r e f e r e n c e   p r i c e ?  
 	 	 	 	 	 d o u b l e   p r i c e   =   0 ;  
 	 	  
 	 	 	 	 	 i f   ( R e l a t i v e T o   = =   " o p e n p r i c e " )  
 	 	 	 	 	 {  
 	 	 	 	 	 	 p r i c e   =   O P ;  
 	 	 	 	 	 }  
 	 	 	 	 	 e l s e   i f   ( R e l a t i v e T o   = =   " c u s t o m P r i c e " )  
 	 	 	 	 	 {  
 	 	 	 	 	 	 p r i c e   =   _ f R e l a t i v e P r i c e _ ( ) ;  
 	 	 	 	 	 }  
 	 	 	 	 	 e l s e  
 	 	 	 	 	 {  
 	 	 	 	 	 	 p r i c e   =   ( O r d e r T y p e ( )   = =   0 )   ?   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 a l c u l a t e   t h e   n e w   S L   a n d   T P  
 	 	 	 	 	 d o u b l e   S L   =   0 ;  
 	 	 	 	 	 d o u b l e   T P   =   0 ;  
 	 	  
 	 	 	 	 	 i f   ( N e w S L T P m o d e   = =   " f i x e d " )  
 	 	 	 	 	 {  
 	 	 	 	 	 	 S L   =   t o D i g i t s ( N e w S t o p L o s s ,   s y m b o l ) ;  
 	 	 	 	 	 	 T P   =   t o D i g i t s ( N e w T a k e P r o f i t ,   s y m b o l ) ;  
 	 	  
 	 	 	 	 	 	 i f   ( O r d e r T y p e ( )   = =   0 )  
 	 	 	 	 	 	 {  
 	 	 	 	 	 	 	 i f   ( S L   ! =   0 )   { S L   =   p r i c e   -   S L ; }  
 	 	 	 	 	 	 	 i f   ( T P   ! =   0 )   { T P   =   p r i c e   +   T P ; }  
 	 	 	 	 	 	 }  
 	 	 	 	 	 	 e l s e  
 	 	 	 	 	 	 {  
 	 	 	 	 	 	 	 i f   ( S L   ! =   0 )   { S L   =   p r i c e   +   S L ; }  
 	 	 	 	 	 	 	 i f   ( T P   ! =   0 )   { T P   =   p r i c e   -   T P ; }  
 	 	 	 	 	 	 }  
 	 	 	 	 	 }  
 	 	 	 	 	 e l s e   i f   ( N e w S L T P m o d e   = =   " p e r c e n t " )  
 	 	 	 	 	 {  
 	 	 	 	 	 	 i f   ( O r d e r T y p e ( )   = =   0 )  
 	 	 	 	 	 	 {  
 	 	 	 	 	 	 	 S L   =   p r i c e   -   ( ( ( O P   -   o l d S L )   *   N e w S t o p L o s s P e r c e n t )   /   1 0 0 ) ;  
 	 	 	 	 	 	 	 T P   =   p r i c e   +   ( ( ( o l d T P   -   O P )   *   N e w T a k e P r o f i t P e r c e n t )   /   1 0 0 ) ;  
 	 	 	 	 	 	 }  
 	 	 	 	 	 	 e l s e  
 	 	 	 	 	 	 {  
 	 	 	 	 	 	 	 S L   =   p r i c e   +   ( ( ( o l d S L   -   O P )   *   N e w S t o p L o s s P e r c e n t )   /   1 0 0 ) ;  
 	 	 	 	 	 	 	 T P   =   p r i c e   -   ( ( ( O P   -   o l d T P )   *   N e w T a k e P r o f i t P e r c e n t )   /   1 0 0 ) ;  
 	 	 	 	 	 	 }  
 	 	 	 	 	 }  
 	 	 	 	 	 e l s e   i f   ( N e w S L T P m o d e   = =   " f u n c t i o n " )  
 	 	 	 	 	 {  
 	 	 	 	 	 	 S L   =   _ f N e w S t o p L o s s _ ( ) ;  
 	 	 	 	 	 	 T P   =   _ f N e w T a k e P r o f i t _ ( ) ;  
 	 	 	 	 	 }  
 	 	  
 	 	 	 	 	 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 ) ;  
 	 	  
 	 	 	 	 	 i f   ( S L   ! =   o l d S L   | |   T P   ! =   o l d T P )  
 	 	 	 	 	 {  
 	 	 	 	 	 	 M o d i f y S t o p s ( O r d e r T i c k e t ( ) ,   S L ,   T P ,   L e v e l C o l o r ) ;  
 	 	 	 	 	 }  
 	 	 	 	 }  
 	 	 	 }  
 	 	 }  
 	 	  
 	 	 _ c a l l b a c k _ ( 1 ) ;  
 	 }  
 } ;  
  
 / /   " I f   p o s i t i o n "   m o d e l  
 t e m p l a t e < t y p e n a m e   T 1 , t y p e n a m e   T 2 , t y p e n a m e   T 3 , t y p e n a m e   T 4 , t y p e n a m e   T 5 >  
 c l a s s   M D L _ I f O p e n e d O r d e r s :   p u b l i c   B l o c k C a l l s  
 {  
 	 p u b l i c :   / *   I n p u t   P a r a m e t e r s   * /  
 	 T 1   G r o u p M o d e ;  
 	 T 2   G r o u p ;  
 	 T 3   S y m b o l M o d e ;  
 	 T 4   S y m b o l ;  
 	 T 5   B u y s O r S e l l s ;  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   r )   { r e t u r n ; }  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 M D L _ I f O p e n e d O r d e r s ( )  
 	 {  
 	 	 G r o u p M o d e   =   ( s t r i n g ) " g r o u p " ;  
 	 	 G r o u p   =   ( s t r i n g ) " " ;  
 	 	 S y m b o l M o d e   =   ( s t r i n g ) " s y m b o l " ;  
 	 	 S y m b o l   =   ( s t r i n g ) C u r r e n t S y m b o l ( ) ;  
 	 	 B u y s O r S e l l s   =   ( s t r i n g ) " b o t h " ;  
 	 }  
  
 	 p u b l i c :   / *   T h e   m a i n   m e t h o d   * /  
 	 v i r t u a l   v o i d   _ e x e c u t e _ ( )  
 	 {  
 	 	 b o o l   e x i s t   =   f a l s e ;  
 	 	  
 	 	 f o r   ( i n t   i n d e x   =   T r a d e s T o t a l ( ) - 1 ;   i n d e x   > =   0 ;   i n d e x - - )  
 	 	 {  
 	 	 	 i f   ( T r a d e S e l e c t B y I n d e x ( i n d e x ,   G r o u p M o d e ,   G r o u p ,   S y m b o l M o d 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   = =   t r u e )   { _ c a l l b a c k _ ( 1 ) ; }   e l s e   { _ c a l l b a c k _ ( 0 ) ; }  
 	 }  
 } ;  
  
 / /   " O R "   m o d e l  
 c l a s s   M D L _ L o g i c a l O R :   p u b l i c   B l o c k C a l l s  
 {  
 	 / *   S t a t i c   P a r a m e t e r s   * /  
 	 i n t   o l d _ t i c k ;  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   r )   { r e t u r n ; }  
  
 	 p u b l i c :   / *   T h e   m a i n   m e t h o d   * /  
 	 v i r t u a l   v o i d   _ e x e c u t e _ ( )  
 	 {  
 	 	 i n t   t i c k I D   =   F X D _ T I C K S _ F R O M _ S T A R T ;  
 	 	  
 	 	 i f   ( o l d _ t i c k   ! =   t i c k I D )  
 	 	 {  
 	 	 	 o l d _ t i c k   =   t i c k I D ;  
 	 	  
 	 	       _ c a l l b a c k _ ( 1 ) ;  
 	 	 }  
 	 }  
 } ;  
  
 / /   " C l o s e   p o s i t i o n s "   m o d e l  
 t e m p l a t e < t y p e n a m e   T 1 , t y p e n a m e   T 2 , t y p e n a m e   T 3 , t y p e n a m e   T 4 , t y p e n a m e   T 5 , t y p e n a m e   T 6 , t y p e n a m e   T 7 , t y p e n a m e   T 8 >  
 c l a s s   M D L _ C l o s e O p e n e d :   p u b l i c   B l o c k C a l l s  
 {  
 	 p u b l i c :   / *   I n p u t   P a r a m e t e r s   * /  
 	 T 1   G r o u p M o d e ;  
 	 T 2   G r o u p ;  
 	 T 3   S y m b o l M o d e ;  
 	 T 4   S y m b o l ;  
 	 T 5   B u y s O r S e l l s ;  
 	 T 6   O r d e r M i n u t e s ;  
 	 T 7   S l i p p a g e ;  
 	 T 8   A r r o w C o l o r ;  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   r )   { r e t u r n ; }  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 M D L _ C l o s e O p e n e d ( )  
 	 {  
 	 	 G r o u p M o d e   =   ( s t r i n g ) " g r o u p " ;  
 	 	 G r o u p   =   ( s t r i n g ) " " ;  
 	 	 S y m b o l M o d e   =   ( s t r i n g ) " s y m b o l " ;  
 	 	 S y m b o l   =   ( s t r i n g ) C u r r e n t S y m b o l ( ) ;  
 	 	 B u y s O r S e l l s   =   ( s t r i n g ) " b o t h " ;  
 	 	 O r d e r M i n u t e s   =   ( i n t ) 0 ;  
 	 	 S l i p p a g e   =   ( u l o n g ) 4 ;  
 	 	 A r r o w C o l o r   =   ( c o l o r ) c l r D e e p P i n k ;  
 	 }  
  
 	 p u b l i c :   / *   T h e   m a i n   m e t h o d   * /  
 	 v i r t u a l   v o i d   _ e x e c u t e _ ( )  
 	 {  
 	 	 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   i n d e x   =   T r a d e s T o t a l ( ) - 1 ;   i n d e x   > =   0 ;   i n d e x - - )  
 	 	 	 {  
 	 	 	 	 i f   ( T r a d e S e l e c t B y I n d e x ( i n d e x ,   G r o u p M o d e ,   G r o u p ,   S y m b o l M o d 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 ( )   -   O r d e 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 f   ( C l o s e T r a d e ( O r d e r T i c k e t ( ) ,   S l i p p a g e ,   A r r o w C o l o r ) )  
 	 	 	 	 	 	 {  
 	 	 	 	 	 	 	 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 ; }  
 	 	 }  
 	 	  
 	 	 _ c a l l b a c k _ ( 1 ) ;  
 	 }  
 } ;  
  
 / /   " A N D "   m o d e l  
 c l a s s   M D L _ L o g i c a l A N D :   p u b l i c   B l o c k C a l l s  
 {  
 	 / *   S t a t i c   P a r a m e t e r s   * /  
 	 i n t   l i s t [ ] ;  
 	 i n t   c h e c k [ ] ;  
 	 i n t   l i s t _ s i z e ;  
 	 i n t   o l d _ t i c k ;  
 	 b o o l   p a s s e d ;  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   r )   { r e t u r n ; }  
  
 	 p u b l i c :   / *   T h e   m a i n   m e t h o d   * /  
 	 v i r t u a l   v o i d   _ e x e c u t e _ ( )  
 	 {  
 	 	 b o o l   g o _ t o _ n e x t   =   f a l s e ;  
 	 	  
 	 	 i f   ( ! p a s s e d )  
 	 	 {  
 	 	 	 f x d G e t I n b o u n d B l o c k s ( _ _ b l o c k _ n u m b e r ,   l i s t ) ;  
 	 	       l i s t _ s i z e   =   A r r a y S i z e ( l i s t ) ;  
 	 	 	 p a s s e d   =   t r u e ;  
 	 	 }  
 	 	  
 	 	 i f   ( l i s t _ s i z e   = =   0 )  
 	 	 {  
 	 	       / /   T h i s   b l o c k   i s   a t   t h e   v e r y   t o p   = >   p a s s   e v e r y t i m e  
 	 	       g o _ t o _ n e x t   =   t r u e ;  
 	 	 }  
 	 	 e l s e  
 	 	 {  
 	 	       / /   T h i s   b l o c k   i s   c h i l d  
 	 	       i n t   t i c k s   =   F X D _ T I C K S _ F R O M _ S T A R T ;  
 	 	        
 	 	 	 i f   ( o l d _ t i c k   ! =   t i c k s )  
 	 	 	 {  
 	 	 	 	 o l d _ t i c k   =   t i c k s ;  
 	 	             A r r a y R e s i z e ( c h e c k ,   0 ) ;   / /   r e s e t  
 	 	       }  
 	 	 	  
 	 	       i f   (  
 	 	 	 	       A r r a y S e a r c h ( l i s t ,   _ _ p a r e n t _ n u m b e r )   >   - 1  
 	 	 	 	 & &   A r r a y S e a r c h ( c h e c k ,   _ _ p a r e n t _ n u m b e r )   = =   - 1  
 	 	 	 )  
 	 	 	 {  
 	 	             A r r a y E n s u r e V a l u e ( c h e c k ,   _ _ p a r e n t _ n u m b e r ) ;   / /   a d d   c u r r e n t   p a r e n t  
 	 	 	 	  
 	 	             i f   ( l i s t _ s i z e   = =   A r r a y S i z e ( c h e c k ) )  
 	 	 	 	 {  
 	 	 	 	 	 g o _ t o _ n e x t   =   t r u e ;  
 	 	 	 	 }  
 	 	       }  
 	 	        
 	 	 }  
 	 	  
 	 	 i f   ( g o _ t o _ n e x t   = =   t r u e )   { _ c a l l b a c k _ ( 1 ) ; }   e l s e   { _ c a l l b a c k _ ( 0 ) ; }  
 	 }  
 } ;  
  
 / /   " P a s s "   m o d e l  
 c l a s s   M D L _ P a s s :   p u b l i c   B l o c k C a l l s  
 {  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   r )   { r e t u r n ; }  
  
 	 p u b l i c :   / *   T h e   m a i n   m e t h o d   * /  
 	 v i r t u a l   v o i d   _ e x e c u t e _ ( )  
 	 {  
 	 	 _ c a l l b a c k _ ( 1 ) ;  
 	 }  
 } ;  
  
 / /   " C h e c k   t y p e   ( l a s t   c l o s e d ) "   m o d e l  
 t e m p l a t e < t y p e n a m e   T 1 , t y p e n a m e   T 2 , t y p e n a m e   T 3 , t y p e n a m e   T 4 , t y p e n a m e   T 5 , t y p e n a m e   T 6 >  
 c l a s s   M D L _ C h e c k L a s t O r d e r T y p e :   p u b l i c   B l o c k C a l l s  
 {  
 	 p u b l i c :   / *   I n p u t   P a r a m e t e r s   * /  
 	 T 1   G r o u p M o d e ;  
 	 T 2   G r o u p ;  
 	 T 3   S y m b o l M o d e ;  
 	 T 4   S y m b o l ;  
 	 T 5   L a s t O r d e r T y p e ;  
 	 T 6   O n c e P e r T r a d e ;  
 	 / *   S t a t i c   P a r a m e t e r s   * /  
 	 u l o n g   m e m o r y [ ] ;  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   r )   { r e t u r n ; }  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 M D L _ C h e c k L a s t O r d e r T y p e ( )  
 	 {  
 	 	 G r o u p M o d e   =   ( s t r i n g ) " g r o u p " ;  
 	 	 G r o u p   =   ( s t r i n g ) " " ;  
 	 	 S y m b o l M o d e   =   ( s t r i n g ) " s y m b o l " ;  
 	 	 S y m b o l   =   ( s t r i n g ) C u r r e n t S y m b o l ( ) ;  
 	 	 L a s t O r d e r T y p e   =   ( i n t ) 0 ;  
 	 	 O n c e P e r T r a d e   =   ( b o o l ) f a l s e ;  
 	 }  
  
 	 p u b l i c :   / *   T h e   m a i n   m e t h o d   * /  
 	 v i r t u a l   v o i d   _ e x e c u t e _ ( )  
 	 {  
 	 	 i n t   t o t a l                   =   0 ;  
 	 	 i n t   t o t a l _ t r             =   0 ;  
 	 	 i n t   t o t a l _ p o             =   0 ;  
 	 	 u l o n g   l a s t _ t i c k e t   =   0 ;  
 	 	 i n t   l a s t _ t y p e           =   - 1 ;  
 	 	 b o o l   n e x t                   =   f a l s e ;  
 	 	  
 	 	 / / - -   c h e c k   h i s t o r y   t r a d e s   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
 	 	 t o t a l _ t r   =   H i s t o r y T r a d e s T o t a l ( ) ;  
 	 	  
 	 	 f o r   ( i n t   i n d e x   =   t o t a l _ t r - 1 ;   i n d e x   > =   0 ;   i n d e x - - )  
 	 	 {  
 	 	 	 i f   ( H i s t o r y T r a d e S e l e c t B y I n d e x ( i n d e x ,   G r o u p M o d e ,   G r o u p ,   S y m b o l M o d e ,   S y m b o l ) )  
 	 	 	 {  
 	 	 	 	 l a s t _ t i c k e t   =   O r d e r T i c k e t ( ) ;  
 	 	 	 	 l a s t _ t y p e       =   O r d e r T y p e ( ) ;  
 	 	 	 	  
 	 	 	 	 b r e a k ;  
 	 	 	 }  
 	 	 }  
 	 	  
 	 	 / / - -   c h e c k   h i s t o r y   p e n d i n g   o r d e r s   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
 	 	 t o t a l _ p o   =   H i s t o r y P e n d i n g O r d e r s T o t a l ( ) ;  
 	 	  
 	 	 f o r   ( i n t   i n d e x   =   t o t a l _ p o - 1 ;   i n d e x   > =   0 ;   i n d e x - - )  
 	 	 {  
 	 	 	 i f   ( H i s t o r y P e n d i n g O r d e r S e l e c t B y I n d e x ( i n d e x ,   G r o u p M o d e ,   G r o u p ,   S y m b o l M o d e ,   S y m b o l ) )  
 	 	 	 {  
 	 	 	 	 i f   ( ( u l o n g ) O r d e r T i c k e t ( )   >   l a s t _ t i c k e t )  
 	 	 	 	 {  
 	 	 	 	 	 l a s t _ t i c k e t   =   O r d e r T i c k e t ( ) ;  
 	 	 	 	 	 l a s t _ t y p e       =   O r d e r T y p e ( ) ;  
 	 	 	 	 }  
 	 	 	 	  
 	 	 	 	 b r e a k ;  
 	 	 	 }  
 	 	 }  
 	 	  
 	 	 / / - -   p r o c e s s   t h e   r e s u l t s   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
 	 	 i f   ( t o t a l _ t r   = =   0   & &   t o t a l _ p o   = =   0 )  
 	 	 {  
 	 	 	 n e x t   =   t r u e ;  
 	 	 }  
 	 	 e l s e  
 	 	 {  
 	 	 	 i f   ( O n c e P e r T r a d e   = =   t r u e   & &   I n A r r a y ( m e m o r y ,   ( u l o n g ) O r d e r T i c k e t ( ) ) )  
 	 	 	 {  
 	 	 	 	 n e x t   =   f a l s e ;  
 	 	 	 }  
 	 	 	 e l s e  
 	 	 	 {  
 	 	 	 	 i f   ( O n c e P e r T r a d e   = =   t r u e )   { A r r a y E n s u r e V a l u e ( m e m o r y ,   ( u l o n g ) O r d e r T i c k e t ( ) ) ; }  
 	 	  
 	 	 	 	 i f   ( l a s t _ t y p e   = =   L a s t O r d e r T y p e )  
 	 	 	 	 {  
 	 	 	 	 	 n e x t   =   t r u e ;  
 	 	 	 	 }  
 	 	 	 }  
 	 	 }  
 	 	  
 	 	 / / - -   p a s s   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
 	 	 i f   ( n e x t   = =   t r u e )   { _ c a l l b a c k _ ( 1 ) ; }   e l s e   { _ c a l l b a c k _ ( 0 ) ; }  
 	 }  
 } ;  
  
  
 / / - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
  
 / /   " N u m e r i c "   m o d e l  
 c l a s s   M D L I C _ v a l u e _ v a l u e  
 {  
 	 p u b l i c :   / *   I n p u t   P a r a m e t e r s   * /  
 	 d o u b l e   V a l u e ;  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   r )   { r e t u r n ; }  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 M D L I C _ v a l u e _ v a l u e ( )  
 	 {  
 	 	 V a l u e   =   ( d o u b l e ) 1 . 0 ;  
 	 }  
  
 	 p u b l i c :   / *   T h e   m a i n   m e t h o d   * /  
 	 d o u b l e   _ e x e c u t e _ ( )  
 	 {  
 	 	 r e t u r n   V a l u e ;  
 	 }  
 } ;  
  
 / /   " M y   I n d i c a t o r s "   m o d e l  
 c l a s s   M D L I C _ m y i n d i c a t o r s _ m y i n d i c a t o r s _ 1  
 {  
 	 p u b l i c :   / *   I n p u t   P a r a m e t e r s   * /  
 	 s t r i n g   S y m b o l ;  
 	 E N U M _ T I M E F R A M E S   P e r i o d ;  
 	 s t r i n g   M o d e O u t p u t ;  
 	 s t r i n g   T i m e S t a m p ;  
 	 i n t   V i s i b l e I D ;  
 	 i n t   V i s i b l e S h i f t ;  
 	 i n t   V i s i b l e L i m i t ;  
 	 i n t   R a n g e C a n d l e S t a r t ;  
 	 i n t   R a n g e C a n d l e E n d ;  
 	 s t r i n g   R a n g e T i m e S o u r c e ;  
 	 s t r i n g   R a n g e T i m e S t a r t ;  
 	 s t r i n g   R a n g e T i m e E n d ;  
 	 d o u b l e   R a n g e D a y O f f s e t ;  
 	 s t r i n g   R a n g e V a l u e ;  
 	 i n t   S h i f t ;  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   r )   { r e t u r n ; }  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 M D L I C _ m y i n d i c a t o r s _ m y i n d i c a t o r s _ 1 ( )  
 	 {  
 	 	 S y m b o l   =   ( s t r i n g ) C u r r e n t S y m b o l ( ) ;  
 	 	 P e r i o d   =   ( E N U M _ T I M E F R A M E S ) C u r r e n t T i m e f r a m e ( ) ;  
 	 	 M o d e O u t p u t   =   ( s t r i n g ) " i d " ;  
 	 	 T i m e S t a m p   =   ( s t r i n g ) " 0 0 : 0 0 " ;  
 	 	 V i s i b l e I D   =   ( i n t ) 0 ;  
 	 	 V i s i b l e S h i f t   =   ( i n t ) 0 ;  
 	 	 V i s i b l e L i m i t   =   ( i n t ) 1 0 0 ;  
 	 	 R a n g e C a n d l e S t a r t   =   ( i n t ) 0 ;  
 	 	 R a n g e C a n d l e E n d   =   ( i n t ) 1 0 ;  
 	 	 R a n g e T i m e S o u r c e   =   ( s t r i n g ) " s e r v e r " ;  
 	 	 R a n g e T i m e S t a r t   =   ( s t r i n g ) " 0 1 : 0 0 " ;  
 	 	 R a n g e T i m e E n d   =   ( s t r i n g ) " 0 8 : 0 0 " ;  
 	 	 R a n g e D a y O f f s e t   =   ( d o u b l e ) 0 . 0 ;  
 	 	 R a n g e V a l u e   =   ( s t r i n g ) " m a x " ;  
 	 	 S h i f t   =   ( i n t ) 0 ;  
 	 }  
  
 	 p u b l i c :   / *   T h e   m a i n   m e t h o d   * /  
 	 d o u b l e   _ e x e c u t e _ ( )  
 	 {  
 	 	 / / = =   M Q L 5   s p e c i f i c s   B E G I N   = = / /  
 	 	 / /   T h e   p r o b l e m   i s   t h a t   i C u s t o m ( )   a l w a y s   r e t u r n s   n e w   h a n d l e   w h e n   c a l l e d ,   r e g a r d l e s s   o f   t h e   i n p u t   p a r a m e t e r s .  
 	 	 i n t   h a n d l e   =   I N V A L I D _ H A N D L E ;  
 	 	  
 	 	 / /   t u r n   t h e   i n p u t   p a r a m e t e r s   i n t o   a   k e y  
 	 	 s t r i n g   k e y   =   " " ;  
 	 	 S t r i n g C o n c a t e n a t e ( k e y ,   S y m b o l ,   P e r i o d ,   " A T R   V a l u e   I n d i c a t o r "   ,   ( E N U M _ V a l u e _ T y p e ) P i p s ,   ( s t r i n g ) " " ,   ( i n t ) 1 4 ,   ( E N U M _ T I M E F R A M E S ) P E R I O D _ C U R R E N T ,   ( d o u b l e ) 1 . 0 ,   ( s t r i n g ) " " ,   ( E N U M _ C O R N E R ) R I G H T _ U P P E R ,   ( i n t ) 3 0 ,   ( i n t ) 3 0 ,   ( c o l o r ) c l r R e d ,   ( i n t ) 1 0 ) ;  
 	 	  
 	 	 / /   f o r   o u r   p a r a m e t e r s ,   d o   w e   a l r e a d y   h a v e   a n   i n d i c a t o r   h a n d l e ?  
 	 	 i n t   a r r a y _ k e y   =   A r r a y S e a r c h ( F X D _ I C U S T O M _ H A N D L E S _ K E Y S ,   k e y ) ;  
 	 	  
 	 	 / /   i f   w e   d o n ' t   h a v e   a   h a n d l e ,   t h e n   c r e a t e   o n e  
 	 	 i f   ( a r r a y _ k e y   = =   - 1 )  
 	 	 {  
 	 	 	 h a n d l e   =   i C u s t o m ( S y m b o l ,   P e r i o d ,   " A T R   V a l u e   I n d i c a t o r "   ,   ( E N U M _ V a l u e _ T y p e ) P i p s ,   ( s t r i n g ) " " ,   ( i n t ) 1 4 ,   ( E N U M _ T I M E F R A M E S ) P E R I O D _ C U R R E N T ,   ( d o u b l e ) 1 . 0 ,   ( s t r i n g ) " " ,   ( E N U M _ C O R N E R ) R I G H T _ U P P E R ,   ( i n t ) 3 0 ,   ( i n t ) 3 0 ,   ( c o l o r ) c l r R e d ,   ( i n t ) 1 0 ,   P R I C E _ C L O S E ) ;  
 	 	 	  
 	 	 	 i f   ( h a n d l e   = =   I N V A L I D _ H A N D L E )   {  
 	 	 	 	 r e t u r n   E M P T Y _ V A L U E ; 	  
 	 	 	 }  
 	 	 	  
 	 	 	 i n t   s i z e   =   A r r a y S i z e ( F X D _ I C U S T O M _ H A N D L E S _ K E Y S ) ;  
 	 	  
 	 	 	 A r r a y R e s i z e ( F X D _ I C U S T O M _ H A N D L E S _ K E Y S ,   s i z e + 1 ) ;  
 	 	 	 A r r a y R e s i z e ( F X D _ I C U S T O M _ H A N D L E S _ I D S ,   s i z e + 1 ) ;  
 	 	 	  
 	 	 	 F X D _ I C U S T O M _ H A N D L E S _ K E Y S [ s i z e ]   =   k e y ;  
 	 	 	 F X D _ I C U S T O M _ H A N D L E S _ I D S [ s i z e ]   =   h a n d l e ;  
 	 	 	  
 	 	 	 a r r a y _ k e y   =   s i z e ;  
 	 	 }  
 	 	 / /   y e s ,   w e   h a v e   a   h a n d l e ,   t h e n   g e t   i t  
 	 	 e l s e   {  
 	 	 	 h a n d l e   =   F X D _ I C U S T O M _ H A N D L E S _ I D S [ a r r a y _ k e y ] ;  
 	 	 }  
 	 	  
 	 	 / / = =   M Q L 5   s p e c i f i c s   E N D   = = / /  
 	 	  
 	 	 / / ! ! !   I   m u s t   d e f i n e   a l l   i n p u t   p r o p e r t i e s   h e r e ,   b e c a u s e   t h e y   a r e   n o t   a u t o m a t i c a l l y   d e f i n e d .  
 	 	 / /   T h i s   f u n c t i o n   i s   n o t   g l o b a l   p r o t o t y p e ,   o n e   n e w   f u n c t i o n   i s   c r e a t e d   f o r   e a c h   c a s e .   T h i s   i s   b e c a u s e   %   i C u s t o m   %   m u s t   b e   u n i q u e  
 	 	  
 	 	 s t r i n g   s y m b o l   =   S y m b o l ;  
 	 	 E N U M _ T I M E F R A M E S   t i m e f r a m e   =   P e r i o d ;  
 	 	 i n t   b u f f e r         =   0 ;  
 	 	 i n t   s h i f t           =   S h i f t   +   F X D _ M O R E _ S H I F T ;  
 	 	  
 	 	 d o u b l e   r e t v a l   =   E M P T Y _ V A L U E ;  
 	 	 i n t   i ;  
 	 	 d o u b l e   i v a l ;  
 	 	  
 	 	 i f   ( M o d e O u t p u t   = =   " i d " )  
 	 	 {  
 	 	 	 r e t v a l   =   f x d C u s t o m I n d i c a t o r ( h a n d l e ,   b u f f e r ,   s h i f t ) ;  
 	 	 }  
 	 	 e l s e   i f   ( M o d e O u t p u t   = =   " t i m e " )  
 	 	 {  
 	 	 	 d a t e t i m e   t i m e ;  
 	 	 	  
 	 	 	 i f   ( 0   & &   S t r i n g F i n d ( T i m e S t a m p ,   " : " )   = =   - 1 )  
 	 	 	 { 	  
 	 	 	 	 t i m e   =   ( d a t e t i m e ) S t r i n g T o I n t e g e r ( T i m e S t a m p ) ;   / /   h a n g s   i n   M Q L 4 ! ! !  
 	 	 	 }  
 	 	 	 e l s e  
 	 	 	 {  
 	 	 	 	 t i m e   =   S t r i n g T o T i m e ( T i m e S t a m p ) ;  
 	 	 	 }  
 	 	 	  
 	 	 	 s h i f t   =   i C a n d l e I D ( s y m b o l ,   t i m e f r a m e ,   t i m e ) ;  
 	 	 	 r e t v a l   =   f x d C u s t o m I n d i c a t o r ( h a n d l e ,   b u f f e r ,   s h i f t ) ;  
 	 	 }  
 	 	 e l s e   i f   ( M o d e O u t p u t   = =   " v i s i b l e "   | |   M o d e O u t p u t   = =   " i d _ b y _ v i s i b l e " )  
 	 	 {  
 	 	 	 i f   ( V i s i b l e L i m i t   = =   0 )   { V i s i b l e L i m i t   =   B a r s ( s y m b o l ,   t i m e f r a m e ) ; }  
 	 	 	  
 	 	 	 i n t   v i d   =   0 ;  
 	 	 	  
 	 	 	 f o r   ( i   =   s h i f t ;   i   < =   V i s i b l e L i m i t ;   i + + )  
 	 	 	 {  
 	 	 	 	 i v a l   =   f x d C u s t o m I n d i c a t o r ( h a n d l e ,   b u f f e r ,   s h i f t   +   i ) ;  
 	 	 	 	  
 	 	 	 	 i f   ( i v a l   = =   E M P T Y _ V A L U E   | |   i v a l   = =   0 )   { c o n t i n u e ; }  
 	 	 	 	 i f   ( v i d   > =   V i s i b l e I D )   {  
 	 	 	 	 	 i f   ( M o d e O u t p u t   = =   " v i s i b l e " )   { r e t v a l   =   i v a l ; }  
 	 	 	 	 	 e l s e   { r e t v a l   =   i ; }  
 	 	 	 	 	 b r e a k ; 	  
 	 	 	 	 }  
 	 	 	 	 	  
 	 	 	 	 v i d + + ;  
 	 	 	 }  
 	 	 }  
 	 	 e l s e   i f   ( M o d e O u t p u t   = =   " r a n g e " )  
 	 	 {  
 	 	 	 / /   r e v e r s e   v a l u e s ,   i f   n e e d e d  
 	 	 	 i f   ( R a n g e C a n d l e S t a r t   >   R a n g e C a n d l e E n d )   {  
 	 	 	 	 i n t   c t m p   =   R a n g e C a n d l e E n d ;  
 	 	 	 	 R a n g e C a n d l e E n d   =   R a n g e C a n d l e S t a r t ;  
 	 	 	 	 R a n g e C a n d l e S t a r t   =   c t m p ;  
 	 	 	 }  
 	 	  
 	 	 	 i f   ( R a n g e V a l u e   = =   " m a x " )  
 	 	 	 {  
 	 	 	 	 r e t v a l   =   - E M P T Y _ V A L U E ;  
 	 	 	 	  
 	 	 	 	 f o r   ( i   =   R a n g e C a n d l e S t a r t ;   i   < =   R a n g e C a n d l e E n d ;   i + + )  
 	 	 	 	 {  
 	 	 	 	 	 i v a l   =   f x d C u s t o m I n d i c a t o r ( h a n d l e ,   b u f f e r ,   s h i f t   +   i ) ;  
 	 	 	 	 	 i f   ( i v a l   = =   E M P T Y _ V A L U E   | |   i v a l   = =   0 )   { c o n t i n u e ; }  
 	 	 	 	 	 i f   ( i v a l   >   r e t v a l )   { r e t v a l   =   i v a l ; }  
 	 	 	 	 }  
 	 	 	 	  
 	 	 	 	 i f   ( r e t v a l   = =   - E M P T Y _ V A L U E )   { r e t v a l   =   E M P T Y _ V A L U E ; }  
 	 	 	 }  
 	 	 	 e l s e   i f   ( R a n g e V a l u e   = =   " m i n " )  
 	 	 	 {  
 	 	 	 	 r e t v a l   =   E M P T Y _ V A L U E ;  
 	 	 	 	  
 	 	 	 	 f o r   ( i   =   R a n g e C a n d l e S t a r t ;   i   < =   R a n g e C a n d l e E n d ;   i + + )  
 	 	 	 	 {  
 	 	 	 	 	 i v a l   =   f x d C u s t o m I n d i c a t o r ( h a n d l e ,   b u f f e r ,   s h i f t   +   i ) ;  
 	 	 	 	 	 i f   ( i v a l   = =   E M P T Y _ V A L U E   | |   i v a l   = =   0 )   { c o n t i n u e ; }  
 	 	 	 	 	 i f   ( i v a l   <   r e t v a l )   { r e t v a l   =   i v a l ; }  
 	 	 	 	 }  
 	 	 	 }  
 	 	 }  
 	 	 e l s e   i f   ( M o d e O u t p u t   = =   " r a n g e _ t i m e " )  
 	 	 {  
 	 	 	 d a t e t i m e   o f f s e t   =   0 ;  
 	 	 	 i f   ( R a n g e T i m e S o u r c e   = =   " g m t " )   { o f f s e t   =   ( i n t ) ( T i m e C u r r e n t ( )   -   T i m e L o c a l ( )   +   T i m e G M T O f f s e t ( ) ) ; }  
 	 	 	 e l s e   i f   ( R a n g e T i m e S o u r c e   = =   " s e r v e r " )   { o f f s e t   =   ( i n t ) ( T i m e C u r r e n t ( )   -   T i m e L o c a l ( ) ) ; }  
 	 	 	  
 	 	 	 d a t e t i m e   t i m e 1   =   S t r i n g T o T i m e ( R a n g e T i m e S t a r t ) - ( d a t e t i m e ) ( 8 6 4 0 0 * R a n g e D a y O f f s e t )   +   o f f s e t ;  
 	 	 	 d a t e t i m e   t i m e 2   =   S t r i n g T o T i m e ( R a n g e T i m e E n d ) - ( d a t e t i m e ) ( 8 6 4 0 0 * R a n g e D a y O f f s e t )   +   o f f s e t ;  
 	 	  
 	 	 	 i n t   x 1   =   i B a r S h i f t ( s y m b o l ,   t i m e f r a m e ,   t i m e 1 ,   f a l s e ) ;  
 	 	 	 i n t   x 2   =   i B a r S h i f t ( s y m b o l ,   t i m e f r a m e ,   t i m e 2 ,   f a l s e ) ;  
 	 	 	 i f   ( x 1 < x 2 )   { x 1 = i B a r S h i f t ( s y m b o l , t i m e f r a m e , ( t i m e 1 - 8 6 4 0 0 ) , f a l s e ) ; }  
 	 	 	  
 	 	 	 i f   ( R a n g e V a l u e   = =   " m a x " )  
 	 	 	 {  
 	 	 	 	 r e t v a l   =   - E M P T Y _ V A L U E ;  
 	 	 	 	  
 	 	 	 	 f o r   ( i = x 2 ;   i < = x 1 ;   i + + )  
 	 	 	 	 {  
 	 	 	 	 	 i v a l   =   f x d C u s t o m I n d i c a t o r ( h a n d l e ,   b u f f e r ,   s h i f t   +   i ) ;  
 	 	 	 	 	 i f   ( i v a l   = =   E M P T Y _ V A L U E   | |   i v a l   = =   0 )   { c o n t i n u e ; }  
 	 	 	 	 	 i f   ( i v a l   >   r e t v a l )   { r e t v a l   =   i v a l ; }  
 	 	 	 	 }  
 	 	 	 	  
 	 	 	 	 i f   ( r e t v a l   = =   - E M P T Y _ V A L U E )   { r e t v a l   =   E M P T Y _ V A L U E ; }  
 	 	 	 }  
 	 	 	 e l s e   i f   ( R a n g e V a l u e   = =   " m i n " )  
 	 	 	 {  
 	 	 	 	 r e t v a l   =   E M P T Y _ V A L U E ;  
 	 	 	 	  
 	 	 	 	 f o r   ( i = x 2 ;   i < = x 1 ;   i + + )  
 	 	 	 	 {  
 	 	 	 	 	 i v a l   =   f x d C u s t o m I n d i c a t o r ( h a n d l e ,   b u f f e r ,   s h i f t   +   i ) ;  
 	 	 	 	 	 i f   ( i v a l   = =   E M P T Y _ V A L U E   | |   i v a l   = =   0 )   { c o n t i n u e ; }  
 	 	 	 	 	 i f   ( i v a l   <   r e t v a l )   { r e t v a l   =   i v a l ; }  
 	 	 	 	 }  
 	 	 	 }  
 	 	 }  
 	 	  
 	 	 r e t u r n   ( r e t v a l ) ;  
 	 }  
 } ;  
  
 / /   " A v e r a g e   T r u e   R a n g e "   m o d e l  
 c l a s s   M D L I C _ i n d i c a t o r s _ i A T R  
 {  
 	 p u b l i c :   / *   I n p u t   P a r a m e t e r s   * /  
 	 i n t   A T R p e r i o d ;  
 	 s t r i n g   S y m b o l ;  
 	 E N U M _ T I M E F R A M E S   P e r i o d ;  
 	 i n t   S h i f t ;  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   r )   { r e t u r n ; }  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 M D L I C _ i n d i c a t o r s _ i A T R ( )  
 	 {  
 	 	 A T R p e r i o d   =   ( i n t ) 1 4 ;  
 	 	 S y m b o l   =   ( s t r i n g ) C u r r e n t S y m b o l ( ) ;  
 	 	 P e r i o d   =   ( E N U M _ T I M E F R A M E S ) C u r r e n t T i m e f r a m e ( ) ;  
 	 	 S h i f t   =   ( i n t ) 0 ;  
 	 }  
  
 	 p u b l i c :   / *   T h e   m a i n   m e t h o d   * /  
 	 d o u b l e   _ e x e c u t e _ ( )  
 	 {  
 	 	 r e t u r n   i A T R ( S y m b o l ,   P e r i o d ,   A T R p e r i o d ,   S h i f t   +   F X D _ M O R E _ S H I F T ) ;  
 	 }  
 } ;  
  
 / /   " T i m e "   m o d e l  
 c l a s s   M D L I C _ v a l u e _ t i m e  
 {  
 	 p u b l i c :   / *   I n p u t   P a r a m e t e r s   * /  
 	 i n t   M o d e T i m e ;  
 	 i n t   T i m e S o u r c e ;  
 	 s t r i n g   T i m e S t a m p ;  
 	 i n t   T i m e C a n d l e I D ;  
 	 s t r i n g   T i m e M a r k e t ;  
 	 E N U M _ T I M E F R A M E S   T i m e C a n d l e T i m e f r a m e ;  
 	 i n t   T i m e C o m p o n e n t Y e a r ;  
 	 i n t   T i m e C o m p o n e n t M o n t h ;  
 	 d o u b l e   T i m e C o m p o n e n t D a y ;  
 	 d o u b l e   T i m e C o m p o n e n t H o u r ;  
 	 d o u b l e   T i m e C o m p o n e n t M i n u t e ;  
 	 i n t   T i m e C o m p o n e n t S e c o n d ;  
 	 i n t   M o d e T i m e S h i f t ;  
 	 i n t   T i m e S h i f t Y e a r s ;  
 	 i n t   T i m e S h i f t M o n t h s ;  
 	 i n t   T i m e S h i f t W e e k s ;  
 	 d o u b l e   T i m e S h i f t D a y s ;  
 	 d o u b l e   T i m e S h i f t H o u r s ;  
 	 d o u b l e   T i m e S h i f t M i n u t e s ;  
 	 i n t   T i m e S h i f t S e c o n d s ;  
 	 b o o l   T i m e S k i p W e e k d a y s ;  
 	 / *   S t a t i c   P a r a m e t e r s   * /  
 	 d a t e t i m e   r e t v a l ;  
 	 d a t e t i m e   r e t v a l 0 ;  
 	 i n t   M o d e T i m e 0 ;  
 	 i n t   s m o d e s h i f t ;  
 	 i n t   y e a r s 0 ;  
 	 i n t   m o n t h s 0 ;  
 	 d a t e t i m e   T i m e [ ] ;  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   r )   { r e t u r n ; }  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 M D L I C _ v a l u e _ t i m e ( )  
 	 {  
 	 	 M o d e T i m e   =   ( i n t ) 0 ;  
 	 	 T i m e S o u r c e   =   ( i n t ) 0 ;  
 	 	 T i m e S t a m p   =   ( s t r i n g ) " 0 0 : 0 0 " ;  
 	 	 T i m e C a n d l e I D   =   ( i n t ) 1 ;  
 	 	 T i m e M a r k e t   =   ( s t r i n g ) " " ;  
 	 	 T i m e C a n d l e T i m e f r a m e   =   ( E N U M _ T I M E F R A M E S ) 0 ;  
 	 	 T i m e C o m p o n e n t Y e a r   =   ( i n t ) 0 ;  
 	 	 T i m e C o m p o n e n t M o n t h   =   ( i n t ) 0 ;  
 	 	 T i m e C o m p o n e n t D a y   =   ( d o u b l e ) 0 . 0 ;  
 	 	 T i m e C o m p o n e n t H o u r   =   ( d o u b l e ) 1 2 . 0 ;  
 	 	 T i m e C o m p o n e n t M i n u t e   =   ( d o u b l e ) 0 . 0 ;  
 	 	 T i m e C o m p o n e n t S e c o n d   =   ( i n t ) 0 ;  
 	 	 M o d e T i m e S h i f t   =   ( i n t ) 0 ;  
 	 	 T i m e S h i f t Y e a r s   =   ( i n t ) 0 ;  
 	 	 T i m e S h i f t M o n t h s   =   ( i n t ) 0 ;  
 	 	 T i m e S h i f t W e e k s   =   ( i n t ) 0 ;  
 	 	 T i m e S h i f t D a y s   =   ( d o u b l e ) 0 . 0 ;  
 	 	 T i m e S h i f t H o u r s   =   ( d o u b l e ) 0 . 0 ;  
 	 	 T i m e S h i f t M i n u t e s   =   ( d o u b l e ) 0 . 0 ;  
 	 	 T i m e S h i f t S e c o n d s   =   ( i n t ) 0 ;  
 	 	 T i m e S k i p W e e k d a y s   =   ( b o o l ) f a l s e ;  
 	 	 / *   S t a t i c   P a r a m e t e r s   ( i n i t i a l   v a l u e )   * /  
 	 	 r e t v a l   =     0 ;  
 	 	 r e t v a l 0   =     0 ;  
 	 	 M o d e T i m e 0   =     0 ;  
 	 	 s m o d e s h i f t   =     0 ;  
 	 	 y e a r s 0   =     0 ;  
 	 	 m o n t h s 0   =     0 ;  
 	 }  
  
 	 p u b l i c :   / *   T h e   m a i n   m e t h o d   * /  
 	 d a t e t i m e   _ e x e c u t e _ ( )  
 	 {  
 	 	 / /   t h i s   i s   s t a t i c   f o r   s p e e d   r e a s o n s  
 	 	  
 	 	 i f   ( T i m e M a r k e t   = =   " " )   T i m e M a r k e t   =   S y m b o l ( ) ;  
 	 	  
 	 	 i f   ( M o d e T i m e   = =   0 )  
 	 	 {  
 	 	 	           i f   ( T i m e S o u r c e   = =   0 )   { r e t v a l   =   T i m e C u r r e n t ( ) ; }  
 	 	 	 e l s e   i f   ( T i m e S o u r c e   = =   1 )   { r e t v a l   =   T i m e L o c a l ( ) ; }  
 	 	 	 e l s e   i f   ( T i m e S o u r c e   = =   2 )   { r e t v a l   =   T i m e G M T ( ) ; }  
 	 	 }  
 	 	 e l s e   i f   ( M o d e T i m e   = =   1 )  
 	 	 {  
 	 	 	 r e t v a l     =   S t r i n g T o T i m e ( T i m e S t a m p ) ;  
 	 	 	 r e t v a l 0   =   r e t v a l ;  
 	 	 }  
 	 	 e l s e   i f   ( M o d e T i m e = = 2 )  
 	 	 {  
 	 	 	 r e t v a l   =   T i m e F r o m C o m p o n e n t s ( T i m e S o u r c e ,   T i m e C o m p o n e n t Y e a r ,   T i m e C o m p o n e n t M o n t h ,   T i m e C o m p o n e n t D a y ,   T i m e C o m p o n e n t H o u r ,   T i m e C o m p o n e n t M i n u t e ,   T i m e C o m p o n e n t S e c o n d ) ;  
 	 	 }  
 	 	 e l s e   i f   ( M o d e T i m e   = =   3 )  
 	 	 {  
 	 	 	 A r r a y S e t A s S e r i e s ( T i m e , t r u e ) ;  
 	 	 	 C o p y T i m e ( T i m e M a r k e t , T i m e C a n d l e T i m e f r a m e , T i m e C a n d l e I D , 1 , T i m e ) ;  
 	 	 	 r e t v a l   =   T i m e [ 0 ] ;  
 	 	 }  
 	 	  
 	 	 i f   ( M o d e T i m e S h i f t   >   0 )  
 	 	 {  
 	 	 	 i n t   s h   =   1 ;  
 	 	  
 	 	 	 i f   ( M o d e T i m e S h i f t   = =   1 )   { s h   =   - 1 ; }  
 	 	  
 	 	 	 i f   (  
 	 	 	 	       M o d e T i m e S h i f t   ! =   s m o d e s h i f t  
 	 	 	 	 | |   T i m e S h i f t Y e a r s   ! =   y e a r s 0  
 	 	 	 	 | |   T i m e S h i f t M o n t h s   ! =   m o n t h s 0  
 	 	 	 )  
 	 	 	 {  
 	 	 	 	 y e a r s 0     =   T i m e S h i f t Y e a r s ;  
 	 	 	 	 m o n t h s 0   =   T i m e S h i f t M o n t h s ;  
 	 	  
 	 	 	 	 i f   ( T i m e S h i f t Y e a r s   >   0   | |   T i m e S h i f t M o n t h s   >   0 )  
 	 	 	 	 {  
 	 	 	 	 	 i n t   y e a r   =   0 ,   m o n t h   =   0 ,   w e e k   =   0 ,   d a y   =   0 ,   h o u r   =   0 ,   m i n u t e   =   0 ,   s e c o n d   =   0 ;  
 	 	  
 	 	 	 	 	 i f   ( M o d e T i m e   = =   3 )  
 	 	 	 	 	 {  
 	 	 	 	 	 	 y e a r       =   T i m e C o m p o n e n t Y e a r ;  
 	 	 	 	 	 	 m o n t h     =   T i m e C o m p o n e n t Y e a r ;  
 	 	 	 	 	 	 d a y         =   ( i n t ) M a t h F l o o r ( T i m e C o m p o n e n t D a y ) ;  
 	 	 	 	 	 	 h o u r       =   ( i n t ) ( M a t h F l o o r ( T i m e C o m p o n e n t H o u r )   +   ( 2 4   *   ( T i m e C o m p o n e n t D a y   -   M a t h F l o o r ( T i m e C o m p o n e n t D a y ) ) ) ) ;  
 	 	 	 	 	 	 m i n u t e   =   ( i n t ) ( M a t h F l o o r ( T i m e C o m p o n e n t M i n u t e )   +   ( 6 0   *   ( T i m e C o m p o n e n t H o u r   -   M a t h F l o o r ( T i m e C o m p o n e n t H o u r ) ) ) ) ;  
 	 	 	 	 	 	 s e c o n d   =   ( i n t ) ( T i m e C o m p o n e n t S e c o n d   +   ( 6 0   *   ( T i m e C o m p o n e n t M i n u t e   -   M a t h F l o o r ( T i m e C o m p o n e n t M i n u t e ) ) ) ) ;  
 	 	 	 	 	 }  
 	 	 	 	 	 e l s e   {  
 	 	 	 	 	 	 y e a r       =   T i m e Y e a r ( r e t v a l ) ;  
 	 	 	 	 	 	 m o n t h     =   T i m e M o n t h ( r e t v a l ) ;  
 	 	 	 	 	 	 d a y         =   T i m e D a y ( r e t v a l ) ;  
 	 	 	 	 	 	 h o u r       =   T i m e H o u r ( r e t v a l ) ;  
 	 	 	 	 	 	 m i n u t e   =   T i m e M i n u t e ( r e t v a l ) ;  
 	 	 	 	 	 	 s e c o n d   =   T i m e S e c o n d s ( r e t v a l ) ;  
 	 	 	 	 	 }  
 	 	  
 	 	 	 	 	 y e a r     =   y e a r   +   T i m e S h i f t Y e a r s   *   s h ;  
 	 	 	 	 	 m o n t h   =   m o n t h   +   T i m e S h i f t M o n t h s   *   s h ;  
 	 	  
 	 	 	 	 	           i f   ( m o n t h   <   0 )   { m o n t h   =   1 2   -   m o n t h ; }  
 	 	 	 	 	 e l s e   i f   ( m o n t h   >   1 2 )   { m o n t h   =   m o n t h   -   1 2 ; }  
 	 	  
 	 	 	 	 	 r e t v a l   =   S t r i n g T o T i m e ( I n t e g e r T o S t r i n g ( y e a r ) + " . " + I n t e g e r T o S t r i n g ( m o n t h ) + " . " + I n t e g e r T o S t r i n g ( d a y ) + "   " + I n t e g e r T o S t r i n g ( h o u r ) + " : " + I n t e g e r T o S t r i n g ( m i n u t e ) + " : " + I n t e g e r T o S t r i n g ( s e c o n d ) ) ;  
 	 	 	 	 }  
 	 	 	 }  
 	 	  
 	 	 	 r e t v a l   =   r e t v a l   +   ( s h   *   ( ( 6 0 4 8 0 0   *   T i m e S h i f t W e e k s )   +   S e c o n d s F r o m C o m p o n e n t s ( T i m e S h i f t D a y s ,   T i m e S h i f t H o u r s ,   T i m e S h i f t M i n u t e s ,   T i m e S h i f t S e c o n d s ) ) ) ;  
 	 	  
 	 	 	 i f   ( T i m e S k i p W e e k d a y s   = =   t r u e )  
 	 	 	 {  
 	 	 	 	 i n t   w e e k d a y   =   T i m e D a y O f W e e k ( r e t v a l ) ;  
 	 	  
 	 	 	 	 i f   ( s h   >   0 )   {   / /   f o r w a r d  
 	 	 	 	 	           i f   ( w e e k d a y   = =   0 )   { r e t v a l   =   r e t v a l   +   8 6 4 0 0 ; }  
 	 	 	 	 	 e l s e   i f   ( w e e k d a y   = =   6 )   { r e t v a l   =   r e t v a l   +   1 7 2 8 0 0 ; }  
 	 	 	 	 }  
 	 	 	 	 e l s e   i f   ( s h   <   0 )   {   / /   b a c k  
 	 	 	 	 	           i f   ( w e e k d a y   = =   0 )   { r e t v a l   =   r e t v a l   -   1 7 2 8 0 0 ; }  
 	 	 	 	 	 e l s e   i f   ( w e e k d a y   = =   6 )   { r e t v a l   =   r e t v a l   -   8 6 4 0 0 ; }  
 	 	 	 	 }  
 	 	 	 }  
 	 	 }  
 	 	  
 	 	 s m o d e s h i f t   =   M o d e T i m e S h i f t ;  
 	 	 M o d e T i m e 0     =   M o d e T i m e ;  
 	 	  
 	 	 r e t u r n   ( d a t e t i m e ) r e t v a l ;  
 	 }  
 } ;  
  
 / /   " M y   I n d i c a t o r s "   m o d e l  
 c l a s s   M D L I C _ m y i n d i c a t o r s _ m y i n d i c a t o r s _ 2  
 {  
 	 p u b l i c :   / *   I n p u t   P a r a m e t e r s   * /  
 	 s t r i n g   S y m b o l ;  
 	 E N U M _ T I M E F R A M E S   P e r i o d ;  
 	 s t r i n g   M o d e O u t p u t ;  
 	 s t r i n g   T i m e S t a m p ;  
 	 i n t   V i s i b l e I D ;  
 	 i n t   V i s i b l e S h i f t ;  
 	 i n t   V i s i b l e L i m i t ;  
 	 i n t   R a n g e C a n d l e S t a r t ;  
 	 i n t   R a n g e C a n d l e E n d ;  
 	 s t r i n g   R a n g e T i m e S o u r c e ;  
 	 s t r i n g   R a n g e T i m e S t a r t ;  
 	 s t r i n g   R a n g e T i m e E n d ;  
 	 d o u b l e   R a n g e D a y O f f s e t ;  
 	 s t r i n g   R a n g e V a l u e ;  
 	 i n t   S h i f t ;  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   r )   { r e t u r n ; }  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 M D L I C _ m y i n d i c a t o r s _ m y i n d i c a t o r s _ 2 ( )  
 	 {  
 	 	 S y m b o l   =   ( s t r i n g ) C u r r e n t S y m b o l ( ) ;  
 	 	 P e r i o d   =   ( E N U M _ T I M E F R A M E S ) C u r r e n t T i m e f r a m e ( ) ;  
 	 	 M o d e O u t p u t   =   ( s t r i n g ) " i d " ;  
 	 	 T i m e S t a m p   =   ( s t r i n g ) " 0 0 : 0 0 " ;  
 	 	 V i s i b l e I D   =   ( i n t ) 0 ;  
 	 	 V i s i b l e S h i f t   =   ( i n t ) 0 ;  
 	 	 V i s i b l e L i m i t   =   ( i n t ) 1 0 0 ;  
 	 	 R a n g e C a n d l e S t a r t   =   ( i n t ) 0 ;  
 	 	 R a n g e C a n d l e E n d   =   ( i n t ) 1 0 ;  
 	 	 R a n g e T i m e S o u r c e   =   ( s t r i n g ) " s e r v e r " ;  
 	 	 R a n g e T i m e S t a r t   =   ( s t r i n g ) " 0 1 : 0 0 " ;  
 	 	 R a n g e T i m e E n d   =   ( s t r i n g ) " 0 8 : 0 0 " ;  
 	 	 R a n g e D a y O f f s e t   =   ( d o u b l e ) 0 . 0 ;  
 	 	 R a n g e V a l u e   =   ( s t r i n g ) " m a x " ;  
 	 	 S h i f t   =   ( i n t ) 0 ;  
 	 }  
  
 	 p u b l i c :   / *   T h e   m a i n   m e t h o d   * /  
 	 d o u b l e   _ e x e c u t e _ ( )  
 	 {  
 	 	 / / = =   M Q L 5   s p e c i f i c s   B E G I N   = = / /  
 	 	 / /   T h e   p r o b l e m   i s   t h a t   i C u s t o m ( )   a l w a y s   r e t u r n s   n e w   h a n d l e   w h e n   c a l l e d ,   r e g a r d l e s s   o f   t h e   i n p u t   p a r a m e t e r s .  
 	 	 i n t   h a n d l e   =   I N V A L I D _ H A N D L E ;  
 	 	  
 	 	 / /   t u r n   t h e   i n p u t   p a r a m e t e r s   i n t o   a   k e y  
 	 	 s t r i n g   k e y   =   " " ;  
 	 	 S t r i n g C o n c a t e n a t e ( k e y ,   S y m b o l ,   P e r i o d ,   " T I I "   ,   ( u i n t ) 2 0 ,   ( u i n t ) 3 0 ,   ( E N U M _ M A _ M E T H O D ) M O D E _ S M A ,   ( E N U M _ A P P L I E D _ P R I C E ) P R I C E _ C L O S E ,   ( d o u b l e ) 8 0 . 0 ,   ( d o u b l e ) 2 0 . 0 ) ;  
 	 	  
 	 	 / /   f o r   o u r   p a r a m e t e r s ,   d o   w e   a l r e a d y   h a v e   a n   i n d i c a t o r   h a n d l e ?  
 	 	 i n t   a r r a y _ k e y   =   A r r a y S e a r c h ( F X D _ I C U S T O M _ H A N D L E S _ K E Y S ,   k e y ) ;  
 	 	  
 	 	 / /   i f   w e   d o n ' t   h a v e   a   h a n d l e ,   t h e n   c r e a t e   o n e  
 	 	 i f   ( a r r a y _ k e y   = =   - 1 )  
 	 	 {  
 	 	 	 h a n d l e   =   i C u s t o m ( S y m b o l ,   P e r i o d ,   " T I I "   ,   ( u i n t ) 2 0 ,   ( u i n t ) 3 0 ,   ( E N U M _ M A _ M E T H O D ) M O D E _ S M A ,   ( E N U M _ A P P L I E D _ P R I C E ) P R I C E _ C L O S E ,   ( d o u b l e ) 8 0 . 0 ,   ( d o u b l e ) 2 0 . 0 ,   P R I C E _ C L O S E ) ;  
 	 	 	  
 	 	 	 i f   ( h a n d l e   = =   I N V A L I D _ H A N D L E )   {  
 	 	 	 	 r e t u r n   E M P T Y _ V A L U E ; 	  
 	 	 	 }  
 	 	 	  
 	 	 	 i n t   s i z e   =   A r r a y S i z e ( F X D _ I C U S T O M _ H A N D L E S _ K E Y S ) ;  
 	 	  
 	 	 	 A r r a y R e s i z e ( F X D _ I C U S T O M _ H A N D L E S _ K E Y S ,   s i z e + 1 ) ;  
 	 	 	 A r r a y R e s i z e ( F X D _ I C U S T O M _ H A N D L E S _ I D S ,   s i z e + 1 ) ;  
 	 	 	  
 	 	 	 F X D _ I C U S T O M _ H A N D L E S _ K E Y S [ s i z e ]   =   k e y ;  
 	 	 	 F X D _ I C U S T O M _ H A N D L E S _ I D S [ s i z e ]   =   h a n d l e ;  
 	 	 	  
 	 	 	 a r r a y _ k e y   =   s i z e ;  
 	 	 }  
 	 	 / /   y e s ,   w e   h a v e   a   h a n d l e ,   t h e n   g e t   i t  
 	 	 e l s e   {  
 	 	 	 h a n d l e   =   F X D _ I C U S T O M _ H A N D L E S _ I D S [ a r r a y _ k e y ] ;  
 	 	 }  
 	 	  
 	 	 / / = =   M Q L 5   s p e c i f i c s   E N D   = = / /  
 	 	  
 	 	 / / ! ! !   I   m u s t   d e f i n e   a l l   i n p u t   p r o p e r t i e s   h e r e ,   b e c a u s e   t h e y   a r e   n o t   a u t o m a t i c a l l y   d e f i n e d .  
 	 	 / /   T h i s   f u n c t i o n   i s   n o t   g l o b a l   p r o t o t y p e ,   o n e   n e w   f u n c t i o n   i s   c r e a t e d   f o r   e a c h   c a s e .   T h i s   i s   b e c a u s e   %   i C u s t o m   %   m u s t   b e   u n i q u e  
 	 	  
 	 	 s t r i n g   s y m b o l   =   S y m b o l ;  
 	 	 E N U M _ T I M E F R A M E S   t i m e f r a m e   =   P e r i o d ;  
 	 	 i n t   b u f f e r         =   0 ;  
 	 	 i n t   s h i f t           =   S h i f t   +   F X D _ M O R E _ S H I F T ;  
 	 	  
 	 	 d o u b l e   r e t v a l   =   E M P T Y _ V A L U E ;  
 	 	 i n t   i ;  
 	 	 d o u b l e   i v a l ;  
 	 	  
 	 	 i f   ( M o d e O u t p u t   = =   " i d " )  
 	 	 {  
 	 	 	 r e t v a l   =   f x d C u s t o m I n d i c a t o r ( h a n d l e ,   b u f f e r ,   s h i f t ) ;  
 	 	 }  
 	 	 e l s e   i f   ( M o d e O u t p u t   = =   " t i m e " )  
 	 	 {  
 	 	 	 d a t e t i m e   t i m e ;  
 	 	 	  
 	 	 	 i f   ( 0   & &   S t r i n g F i n d ( T i m e S t a m p ,   " : " )   = =   - 1 )  
 	 	 	 { 	  
 	 	 	 	 t i m e   =   ( d a t e t i m e ) S t r i n g T o I n t e g e r ( T i m e S t a m p ) ;   / /   h a n g s   i n   M Q L 4 ! ! !  
 	 	 	 }  
 	 	 	 e l s e  
 	 	 	 {  
 	 	 	 	 t i m e   =   S t r i n g T o T i m e ( T i m e S t a m p ) ;  
 	 	 	 }  
 	 	 	  
 	 	 	 s h i f t   =   i C a n d l e I D ( s y m b o l ,   t i m e f r a m e ,   t i m e ) ;  
 	 	 	 r e t v a l   =   f x d C u s t o m I n d i c a t o r ( h a n d l e ,   b u f f e r ,   s h i f t ) ;  
 	 	 }  
 	 	 e l s e   i f   ( M o d e O u t p u t   = =   " v i s i b l e "   | |   M o d e O u t p u t   = =   " i d _ b y _ v i s i b l e " )  
 	 	 {  
 	 	 	 i f   ( V i s i b l e L i m i t   = =   0 )   { V i s i b l e L i m i t   =   B a r s ( s y m b o l ,   t i m e f r a m e ) ; }  
 	 	 	  
 	 	 	 i n t   v i d   =   0 ;  
 	 	 	  
 	 	 	 f o r   ( i   =   s h i f t ;   i   < =   V i s i b l e L i m i t ;   i + + )  
 	 	 	 {  
 	 	 	 	 i v a l   =   f x d C u s t o m I n d i c a t o r ( h a n d l e ,   b u f f e r ,   s h i f t   +   i ) ;  
 	 	 	 	  
 	 	 	 	 i f   ( i v a l   = =   E M P T Y _ V A L U E   | |   i v a l   = =   0 )   { c o n t i n u e ; }  
 	 	 	 	 i f   ( v i d   > =   V i s i b l e I D )   {  
 	 	 	 	 	 i f   ( M o d e O u t p u t   = =   " v i s i b l e " )   { r e t v a l   =   i v a l ; }  
 	 	 	 	 	 e l s e   { r e t v a l   =   i ; }  
 	 	 	 	 	 b r e a k ; 	  
 	 	 	 	 }  
 	 	 	 	 	  
 	 	 	 	 v i d + + ;  
 	 	 	 }  
 	 	 }  
 	 	 e l s e   i f   ( M o d e O u t p u t   = =   " r a n g e " )  
 	 	 {  
 	 	 	 / /   r e v e r s e   v a l u e s ,   i f   n e e d e d  
 	 	 	 i f   ( R a n g e C a n d l e S t a r t   >   R a n g e C a n d l e E n d )   {  
 	 	 	 	 i n t   c t m p   =   R a n g e C a n d l e E n d ;  
 	 	 	 	 R a n g e C a n d l e E n d   =   R a n g e C a n d l e S t a r t ;  
 	 	 	 	 R a n g e C a n d l e S t a r t   =   c t m p ;  
 	 	 	 }  
 	 	  
 	 	 	 i f   ( R a n g e V a l u e   = =   " m a x " )  
 	 	 	 {  
 	 	 	 	 r e t v a l   =   - E M P T Y _ V A L U E ;  
 	 	 	 	  
 	 	 	 	 f o r   ( i   =   R a n g e C a n d l e S t a r t ;   i   < =   R a n g e C a n d l e E n d ;   i + + )  
 	 	 	 	 {  
 	 	 	 	 	 i v a l   =   f x d C u s t o m I n d i c a t o r ( h a n d l e ,   b u f f e r ,   s h i f t   +   i ) ;  
 	 	 	 	 	 i f   ( i v a l   = =   E M P T Y _ V A L U E   | |   i v a l   = =   0 )   { c o n t i n u e ; }  
 	 	 	 	 	 i f   ( i v a l   >   r e t v a l )   { r e t v a l   =   i v a l ; }  
 	 	 	 	 }  
 	 	 	 	  
 	 	 	 	 i f   ( r e t v a l   = =   - E M P T Y _ V A L U E )   { r e t v a l   =   E M P T Y _ V A L U E ; }  
 	 	 	 }  
 	 	 	 e l s e   i f   ( R a n g e V a l u e   = =   " m i n " )  
 	 	 	 {  
 	 	 	 	 r e t v a l   =   E M P T Y _ V A L U E ;  
 	 	 	 	  
 	 	 	 	 f o r   ( i   =   R a n g e C a n d l e S t a r t ;   i   < =   R a n g e C a n d l e E n d ;   i + + )  
 	 	 	 	 {  
 	 	 	 	 	 i v a l   =   f x d C u s t o m I n d i c a t o r ( h a n d l e ,   b u f f e r ,   s h i f t   +   i ) ;  
 	 	 	 	 	 i f   ( i v a l   = =   E M P T Y _ V A L U E   | |   i v a l   = =   0 )   { c o n t i n u e ; }  
 	 	 	 	 	 i f   ( i v a l   <   r e t v a l )   { r e t v a l   =   i v a l ; }  
 	 	 	 	 }  
 	 	 	 }  
 	 	 }  
 	 	 e l s e   i f   ( M o d e O u t p u t   = =   " r a n g e _ t i m e " )  
 	 	 {  
 	 	 	 d a t e t i m e   o f f s e t   =   0 ;  
 	 	 	 i f   ( R a n g e T i m e S o u r c e   = =   " g m t " )   { o f f s e t   =   ( i n t ) ( T i m e C u r r e n t ( )   -   T i m e L o c a l ( )   +   T i m e G M T O f f s e t ( ) ) ; }  
 	 	 	 e l s e   i f   ( R a n g e T i m e S o u r c e   = =   " s e r v e r " )   { o f f s e t   =   ( i n t ) ( T i m e C u r r e n t ( )   -   T i m e L o c a l ( ) ) ; }  
 	 	 	  
 	 	 	 d a t e t i m e   t i m e 1   =   S t r i n g T o T i m e ( R a n g e T i m e S t a r t ) - ( d a t e t i m e ) ( 8 6 4 0 0 * R a n g e D a y O f f s e t )   +   o f f s e t ;  
 	 	 	 d a t e t i m e   t i m e 2   =   S t r i n g T o T i m e ( R a n g e T i m e E n d ) - ( d a t e t i m e ) ( 8 6 4 0 0 * R a n g e D a y O f f s e t )   +   o f f s e t ;  
 	 	  
 	 	 	 i n t   x 1   =   i B a r S h i f t ( s y m b o l ,   t i m e f r a m e ,   t i m e 1 ,   f a l s e ) ;  
 	 	 	 i n t   x 2   =   i B a r S h i f t ( s y m b o l ,   t i m e f r a m e ,   t i m e 2 ,   f a l s e ) ;  
 	 	 	 i f   ( x 1 < x 2 )   { x 1 = i B a r S h i f t ( s y m b o l , t i m e f r a m e , ( t i m e 1 - 8 6 4 0 0 ) , f a l s e ) ; }  
 	 	 	  
 	 	 	 i f   ( R a n g e V a l u e   = =   " m a x " )  
 	 	 	 {  
 	 	 	 	 r e t v a l   =   - E M P T Y _ V A L U E ;  
 	 	 	 	  
 	 	 	 	 f o r   ( i = x 2 ;   i < = x 1 ;   i + + )  
 	 	 	 	 {  
 	 	 	 	 	 i v a l   =   f x d C u s t o m I n d i c a t o r ( h a n d l e ,   b u f f e r ,   s h i f t   +   i ) ;  
 	 	 	 	 	 i f   ( i v a l   = =   E M P T Y _ V A L U E   | |   i v a l   = =   0 )   { c o n t i n u e ; }  
 	 	 	 	 	 i f   ( i v a l   >   r e t v a l )   { r e t v a l   =   i v a l ; }  
 	 	 	 	 }  
 	 	 	 	  
 	 	 	 	 i f   ( r e t v a l   = =   - E M P T Y _ V A L U E )   { r e t v a l   =   E M P T Y _ V A L U E ; }  
 	 	 	 }  
 	 	 	 e l s e   i f   ( R a n g e V a l u e   = =   " m i n " )  
 	 	 	 {  
 	 	 	 	 r e t v a l   =   E M P T Y _ V A L U E ;  
 	 	 	 	  
 	 	 	 	 f o r   ( i = x 2 ;   i < = x 1 ;   i + + )  
 	 	 	 	 {  
 	 	 	 	 	 i v a l   =   f x d C u s t o m I n d i c a t o r ( h a n d l e ,   b u f f e r ,   s h i f t   +   i ) ;  
 	 	 	 	 	 i f   ( i v a l   = =   E M P T Y _ V A L U E   | |   i v a l   = =   0 )   { c o n t i n u e ; }  
 	 	 	 	 	 i f   ( i v a l   <   r e t v a l )   { r e t v a l   =   i v a l ; }  
 	 	 	 	 }  
 	 	 	 }  
 	 	 }  
 	 	  
 	 	 r e t u r n   ( r e t v a l ) ;  
 	 }  
 } ;  
  
 / /   " M y   I n d i c a t o r s "   m o d e l  
 c l a s s   M D L I C _ m y i n d i c a t o r s _ m y i n d i c a t o r s _ 3  
 {  
 	 p u b l i c :   / *   I n p u t   P a r a m e t e r s   * /  
 	 s t r i n g   S y m b o l ;  
 	 E N U M _ T I M E F R A M E S   P e r i o d ;  
 	 s t r i n g   M o d e O u t p u t ;  
 	 s t r i n g   T i m e S t a m p ;  
 	 i n t   V i s i b l e I D ;  
 	 i n t   V i s i b l e S h i f t ;  
 	 i n t   V i s i b l e L i m i t ;  
 	 i n t   R a n g e C a n d l e S t a r t ;  
 	 i n t   R a n g e C a n d l e E n d ;  
 	 s t r i n g   R a n g e T i m e S o u r c e ;  
 	 s t r i n g   R a n g e T i m e S t a r t ;  
 	 s t r i n g   R a n g e T i m e E n d ;  
 	 d o u b l e   R a n g e D a y O f f s e t ;  
 	 s t r i n g   R a n g e V a l u e ;  
 	 i n t   S h i f t ;  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   r )   { r e t u r n ; }  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 M D L I C _ m y i n d i c a t o r s _ m y i n d i c a t o r s _ 3 ( )  
 	 {  
 	 	 S y m b o l   =   ( s t r i n g ) C u r r e n t S y m b o l ( ) ;  
 	 	 P e r i o d   =   ( E N U M _ T I M E F R A M E S ) C u r r e n t T i m e f r a m e ( ) ;  
 	 	 M o d e O u t p u t   =   ( s t r i n g ) " i d " ;  
 	 	 T i m e S t a m p   =   ( s t r i n g ) " 0 0 : 0 0 " ;  
 	 	 V i s i b l e I D   =   ( i n t ) 0 ;  
 	 	 V i s i b l e S h i f t   =   ( i n t ) 0 ;  
 	 	 V i s i b l e L i m i t   =   ( i n t ) 1 0 0 ;  
 	 	 R a n g e C a n d l e S t a r t   =   ( i n t ) 0 ;  
 	 	 R a n g e C a n d l e E n d   =   ( i n t ) 1 0 ;  
 	 	 R a n g e T i m e S o u r c e   =   ( s t r i n g ) " s e r v e r " ;  
 	 	 R a n g e T i m e S t a r t   =   ( s t r i n g ) " 0 1 : 0 0 " ;  
 	 	 R a n g e T i m e E n d   =   ( s t r i n g ) " 0 8 : 0 0 " ;  
 	 	 R a n g e D a y O f f s e t   =   ( d o u b l e ) 0 . 0 ;  
 	 	 R a n g e V a l u e   =   ( s t r i n g ) " m a x " ;  
 	 	 S h i f t   =   ( i n t ) 0 ;  
 	 }  
  
 	 p u b l i c :   / *   T h e   m a i n   m e t h o d   * /  
 	 d o u b l e   _ e x e c u t e _ ( )  
 	 {  
 	 	 / / = =   M Q L 5   s p e c i f i c s   B E G I N   = = / /  
 	 	 / /   T h e   p r o b l e m   i s   t h a t   i C u s t o m ( )   a l w a y s   r e t u r n s   n e w   h a n d l e   w h e n   c a l l e d ,   r e g a r d l e s s   o f   t h e   i n p u t   p a r a m e t e r s .  
 	 	 i n t   h a n d l e   =   I N V A L I D _ H A N D L E ;  
 	 	  
 	 	 / /   t u r n   t h e   i n p u t   p a r a m e t e r s   i n t o   a   k e y  
 	 	 s t r i n g   k e y   =   " " ;  
 	 	 S t r i n g C o n c a t e n a t e ( k e y ,   S y m b o l ,   P e r i o d ,   " T I I "   ,   ( u i n t ) 2 0 ,   ( u i n t ) 3 0 ,   ( E N U M _ M A _ M E T H O D ) M O D E _ S M A ,   ( E N U M _ A P P L I E D _ P R I C E ) P R I C E _ C L O S E ,   ( d o u b l e ) 8 0 . 0 ,   ( d o u b l e ) 2 0 . 0 ) ;  
 	 	  
 	 	 / /   f o r   o u r   p a r a m e t e r s ,   d o   w e   a l r e a d y   h a v e   a n   i n d i c a t o r   h a n d l e ?  
 	 	 i n t   a r r a y _ k e y   =   A r r a y S e a r c h ( F X D _ I C U S T O M _ H A N D L E S _ K E Y S ,   k e y ) ;  
 	 	  
 	 	 / /   i f   w e   d o n ' t   h a v e   a   h a n d l e ,   t h e n   c r e a t e   o n e  
 	 	 i f   ( a r r a y _ k e y   = =   - 1 )  
 	 	 {  
 	 	 	 h a n d l e   =   i C u s t o m ( S y m b o l ,   P e r i o d ,   " T I I "   ,   ( u i n t ) 2 0 ,   ( u i n t ) 3 0 ,   ( E N U M _ M A _ M E T H O D ) M O D E _ S M A ,   ( E N U M _ A P P L I E D _ P R I C E ) P R I C E _ C L O S E ,   ( d o u b l e ) 8 0 . 0 ,   ( d o u b l e ) 2 0 . 0 ,   P R I C E _ C L O S E ) ;  
 	 	 	  
 	 	 	 i f   ( h a n d l e   = =   I N V A L I D _ H A N D L E )   {  
 	 	 	 	 r e t u r n   E M P T Y _ V A L U E ; 	  
 	 	 	 }  
 	 	 	  
 	 	 	 i n t   s i z e   =   A r r a y S i z e ( F X D _ I C U S T O M _ H A N D L E S _ K E Y S ) ;  
 	 	  
 	 	 	 A r r a y R e s i z e ( F X D _ I C U S T O M _ H A N D L E S _ K E Y S ,   s i z e + 1 ) ;  
 	 	 	 A r r a y R e s i z e ( F X D _ I C U S T O M _ H A N D L E S _ I D S ,   s i z e + 1 ) ;  
 	 	 	  
 	 	 	 F X D _ I C U S T O M _ H A N D L E S _ K E Y S [ s i z e ]   =   k e y ;  
 	 	 	 F X D _ I C U S T O M _ H A N D L E S _ I D S [ s i z e ]   =   h a n d l e ;  
 	 	 	  
 	 	 	 a r r a y _ k e y   =   s i z e ;  
 	 	 }  
 	 	 / /   y e s ,   w e   h a v e   a   h a n d l e ,   t h e n   g e t   i t  
 	 	 e l s e   {  
 	 	 	 h a n d l e   =   F X D _ I C U S T O M _ H A N D L E S _ I D S [ a r r a y _ k e y ] ;  
 	 	 }  
 	 	  
 	 	 / / = =   M Q L 5   s p e c i f i c s   E N D   = = / /  
 	 	  
 	 	 / / ! ! !   I   m u s t   d e f i n e   a l l   i n p u t   p r o p e r t i e s   h e r e ,   b e c a u s e   t h e y   a r e   n o t   a u t o m a t i c a l l y   d e f i n e d .  
 	 	 / /   T h i s   f u n c t i o n   i s   n o t   g l o b a l   p r o t o t y p e ,   o n e   n e w   f u n c t i o n   i s   c r e a t e d   f o r   e a c h   c a s e .   T h i s   i s   b e c a u s e   %   i C u s t o m   %   m u s t   b e   u n i q u e  
 	 	  
 	 	 s t r i n g   s y m b o l   =   S y m b o l ;  
 	 	 E N U M _ T I M E F R A M E S   t i m e f r a m e   =   P e r i o d ;  
 	 	 i n t   b u f f e r         =   0 ;  
 	 	 i n t   s h i f t           =   S h i f t   +   F X D _ M O R E _ S H I F T ;  
 	 	  
 	 	 d o u b l e   r e t v a l   =   E M P T Y _ V A L U E ;  
 	 	 i n t   i ;  
 	 	 d o u b l e   i v a l ;  
 	 	  
 	 	 i f   ( M o d e O u t p u t   = =   " i d " )  
 	 	 {  
 	 	 	 r e t v a l   =   f x d C u s t o m I n d i c a t o r ( h a n d l e ,   b u f f e r ,   s h i f t ) ;  
 	 	 }  
 	 	 e l s e   i f   ( M o d e O u t p u t   = =   " t i m e " )  
 	 	 {  
 	 	 	 d a t e t i m e   t i m e ;  
 	 	 	  
 	 	 	 i f   ( 0   & &   S t r i n g F i n d ( T i m e S t a m p ,   " : " )   = =   - 1 )  
 	 	 	 { 	  
 	 	 	 	 t i m e   =   ( d a t e t i m e ) S t r i n g T o I n t e g e r ( T i m e S t a m p ) ;   / /   h a n g s   i n   M Q L 4 ! ! !  
 	 	 	 }  
 	 	 	 e l s e  
 	 	 	 {  
 	 	 	 	 t i m e   =   S t r i n g T o T i m e ( T i m e S t a m p ) ;  
 	 	 	 }  
 	 	 	  
 	 	 	 s h i f t   =   i C a n d l e I D ( s y m b o l ,   t i m e f r a m e ,   t i m e ) ;  
 	 	 	 r e t v a l   =   f x d C u s t o m I n d i c a t o r ( h a n d l e ,   b u f f e r ,   s h i f t ) ;  
 	 	 }  
 	 	 e l s e   i f   ( M o d e O u t p u t   = =   " v i s i b l e "   | |   M o d e O u t p u t   = =   " i d _ b y _ v i s i b l e " )  
 	 	 {  
 	 	 	 i f   ( V i s i b l e L i m i t   = =   0 )   { V i s i b l e L i m i t   =   B a r s ( s y m b o l ,   t i m e f r a m e ) ; }  
 	 	 	  
 	 	 	 i n t   v i d   =   0 ;  
 	 	 	  
 	 	 	 f o r   ( i   =   s h i f t ;   i   < =   V i s i b l e L i m i t ;   i + + )  
 	 	 	 {  
 	 	 	 	 i v a l   =   f x d C u s t o m I n d i c a t o r ( h a n d l e ,   b u f f e r ,   s h i f t   +   i ) ;  
 	 	 	 	  
 	 	 	 	 i f   ( i v a l   = =   E M P T Y _ V A L U E   | |   i v a l   = =   0 )   { c o n t i n u e ; }  
 	 	 	 	 i f   ( v i d   > =   V i s i b l e I D )   {  
 	 	 	 	 	 i f   ( M o d e O u t p u t   = =   " v i s i b l e " )   { r e t v a l   =   i v a l ; }  
 	 	 	 	 	 e l s e   { r e t v a l   =   i ; }  
 	 	 	 	 	 b r e a k ; 	  
 	 	 	 	 }  
 	 	 	 	 	  
 	 	 	 	 v i d + + ;  
 	 	 	 }  
 	 	 }  
 	 	 e l s e   i f   ( M o d e O u t p u t   = =   " r a n g e " )  
 	 	 {  
 	 	 	 / /   r e v e r s e   v a l u e s ,   i f   n e e d e d  
 	 	 	 i f   ( R a n g e C a n d l e S t a r t   >   R a n g e C a n d l e E n d )   {  
 	 	 	 	 i n t   c t m p   =   R a n g e C a n d l e E n d ;  
 	 	 	 	 R a n g e C a n d l e E n d   =   R a n g e C a n d l e S t a r t ;  
 	 	 	 	 R a n g e C a n d l e S t a r t   =   c t m p ;  
 	 	 	 }  
 	 	  
 	 	 	 i f   ( R a n g e V a l u e   = =   " m a x " )  
 	 	 	 {  
 	 	 	 	 r e t v a l   =   - E M P T Y _ V A L U E ;  
 	 	 	 	  
 	 	 	 	 f o r   ( i   =   R a n g e C a n d l e S t a r t ;   i   < =   R a n g e C a n d l e E n d ;   i + + )  
 	 	 	 	 {  
 	 	 	 	 	 i v a l   =   f x d C u s t o m I n d i c a t o r ( h a n d l e ,   b u f f e r ,   s h i f t   +   i ) ;  
 	 	 	 	 	 i f   ( i v a l   = =   E M P T Y _ V A L U E   | |   i v a l   = =   0 )   { c o n t i n u e ; }  
 	 	 	 	 	 i f   ( i v a l   >   r e t v a l )   { r e t v a l   =   i v a l ; }  
 	 	 	 	 }  
 	 	 	 	  
 	 	 	 	 i f   ( r e t v a l   = =   - E M P T Y _ V A L U E )   { r e t v a l   =   E M P T Y _ V A L U E ; }  
 	 	 	 }  
 	 	 	 e l s e   i f   ( R a n g e V a l u e   = =   " m i n " )  
 	 	 	 {  
 	 	 	 	 r e t v a l   =   E M P T Y _ V A L U E ;  
 	 	 	 	  
 	 	 	 	 f o r   ( i   =   R a n g e C a n d l e S t a r t ;   i   < =   R a n g e C a n d l e E n d ;   i + + )  
 	 	 	 	 {  
 	 	 	 	 	 i v a l   =   f x d C u s t o m I n d i c a t o r ( h a n d l e ,   b u f f e r ,   s h i f t   +   i ) ;  
 	 	 	 	 	 i f   ( i v a l   = =   E M P T Y _ V A L U E   | |   i v a l   = =   0 )   { c o n t i n u e ; }  
 	 	 	 	 	 i f   ( i v a l   <   r e t v a l )   { r e t v a l   =   i v a l ; }  
 	 	 	 	 }  
 	 	 	 }  
 	 	 }  
 	 	 e l s e   i f   ( M o d e O u t p u t   = =   " r a n g e _ t i m e " )  
 	 	 {  
 	 	 	 d a t e t i m e   o f f s e t   =   0 ;  
 	 	 	 i f   ( R a n g e T i m e S o u r c e   = =   " g m t " )   { o f f s e t   =   ( i n t ) ( T i m e C u r r e n t ( )   -   T i m e L o c a l ( )   +   T i m e G M T O f f s e t ( ) ) ; }  
 	 	 	 e l s e   i f   ( R a n g e T i m e S o u r c e   = =   " s e r v e r " )   { o f f s e t   =   ( i n t ) ( T i m e C u r r e n t ( )   -   T i m e L o c a l ( ) ) ; }  
 	 	 	  
 	 	 	 d a t e t i m e   t i m e 1   =   S t r i n g T o T i m e ( R a n g e T i m e S t a r t ) - ( d a t e t i m e ) ( 8 6 4 0 0 * R a n g e D a y O f f s e t )   +   o f f s e t ;  
 	 	 	 d a t e t i m e   t i m e 2   =   S t r i n g T o T i m e ( R a n g e T i m e E n d ) - ( d a t e t i m e ) ( 8 6 4 0 0 * R a n g e D a y O f f s e t )   +   o f f s e t ;  
 	 	  
 	 	 	 i n t   x 1   =   i B a r S h i f t ( s y m b o l ,   t i m e f r a m e ,   t i m e 1 ,   f a l s e ) ;  
 	 	 	 i n t   x 2   =   i B a r S h i f t ( s y m b o l ,   t i m e f r a m e ,   t i m e 2 ,   f a l s e ) ;  
 	 	 	 i f   ( x 1 < x 2 )   { x 1 = i B a r S h i f t ( s y m b o l , t i m e f r a m e , ( t i m e 1 - 8 6 4 0 0 ) , f a l s e ) ; }  
 	 	 	  
 	 	 	 i f   ( R a n g e V a l u e   = =   " m a x " )  
 	 	 	 {  
 	 	 	 	 r e t v a l   =   - E M P T Y _ V A L U E ;  
 	 	 	 	  
 	 	 	 	 f o r   ( i = x 2 ;   i < = x 1 ;   i + + )  
 	 	 	 	 {  
 	 	 	 	 	 i v a l   =   f x d C u s t o m I n d i c a t o r ( h a n d l e ,   b u f f e r ,   s h i f t   +   i ) ;  
 	 	 	 	 	 i f   ( i v a l   = =   E M P T Y _ V A L U E   | |   i v a l   = =   0 )   { c o n t i n u e ; }  
 	 	 	 	 	 i f   ( i v a l   >   r e t v a l )   { r e t v a l   =   i v a l ; }  
 	 	 	 	 }  
 	 	 	 	  
 	 	 	 	 i f   ( r e t v a l   = =   - E M P T Y _ V A L U E )   { r e t v a l   =   E M P T Y _ V A L U E ; }  
 	 	 	 }  
 	 	 	 e l s e   i f   ( R a n g e V a l u e   = =   " m i n " )  
 	 	 	 {  
 	 	 	 	 r e t v a l   =   E M P T Y _ V A L U E ;  
 	 	 	 	  
 	 	 	 	 f o r   ( i = x 2 ;   i < = x 1 ;   i + + )  
 	 	 	 	 {  
 	 	 	 	 	 i v a l   =   f x d C u s t o m I n d i c a t o r ( h a n d l e ,   b u f f e r ,   s h i f t   +   i ) ;  
 	 	 	 	 	 i f   ( i v a l   = =   E M P T Y _ V A L U E   | |   i v a l   = =   0 )   { c o n t i n u e ; }  
 	 	 	 	 	 i f   ( i v a l   <   r e t v a l )   { r e t v a l   =   i v a l ; }  
 	 	 	 	 }  
 	 	 	 }  
 	 	 }  
 	 	  
 	 	 r e t u r n   ( r e t v a l ) ;  
 	 }  
 } ;  
  
 / /   " A d a p t i v e   M o v i n g   A v e r a g e "   m o d e l  
 c l a s s   M D L I C _ i n d i c a t o r s _ i A M A  
 {  
 	 p u b l i c :   / *   I n p u t   P a r a m e t e r s   * /  
 	 i n t   A M A p e r i o d ;  
 	 i n t   F a s t M A p e r i o d ;  
 	 i n t   S l o w M A p e r i o d ;  
 	 i n t   A M A s h i f t ;  
 	 E N U M _ A P P L I E D _ P R I C E   A p p l i e d P r i c e ;  
 	 s t r i n g   S y m b o l ;  
 	 E N U M _ T I M E F R A M E S   P e r i o d ;  
 	 i n t   S h i f t ;  
 	 / *   S t a t i c   P a r a m e t e r s   * /  
 	 i n t   d i g i t s ;  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   r )   { r e t u r n ; }  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 M D L I C _ i n d i c a t o r s _ i A M A ( )  
 	 {  
 	 	 A M A p e r i o d   =   ( i n t ) 1 0 ;  
 	 	 F a s t M A p e r i o d   =   ( i n t ) 2 ;  
 	 	 S l o w M A p e r i o d   =   ( i n t ) 3 0 ;  
 	 	 A M A s h i f t   =   ( i n t ) 0 ;  
 	 	 A p p l i e d P r i c e   =   ( E N U M _ A P P L I E D _ P R I C E ) P R I C E _ C L O S E ;  
 	 	 S y m b o l   =   ( s t r i n g ) C u r r e n t S y m b o l ( ) ;  
 	 	 P e r i o d   =   ( E N U M _ T I M E F R A M E S ) C u r r e n t T i m e f r a m e ( ) ;  
 	 	 S h i f t   =   ( i n t ) 0 ;  
 	 	 / *   S t a t i c   P a r a m e t e r s   ( i n i t i a l   v a l 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 ) ;  
 	 }  
  
 	 p u b l i c :   / *   T h e   m a i n   m e t h o d   * /  
 	 d o u b l e   _ e x e c u t e _ ( )  
 	 {  
 	 	 d o u b l e   v a l u e   =   f x d C u s t o m I n d i c a t o r ( i A M A ( S y m b o l , P e r i o d , A M A p e r i o d , F a s t M A p e r i o d , S l o w M A p e r i o d , A M A s h i f t , A p p l i e d P r i c e ) , 0 , S h i f t + F X D _ M O R E _ S H I F T ) ;  
 	 	  
 	 	 r e t u r n   N o r m a l i z e D o u b l e ( v a l u e ,   d i g i t s ) ;  
 	 }  
 } ;  
  
 / /   " M y   I n d i c a t o r s "   m o d e l  
 c l a s s   M D L I C _ m y i n d i c a t o r s _ m y i n d i c a t o r s _ 4  
 {  
 	 p u b l i c :   / *   I n p u t   P a r a m e t e r s   * /  
 	 s t r i n g   S y m b o l ;  
 	 E N U M _ T I M E F R A M E S   P e r i o d ;  
 	 s t r i n g   M o d e O u t p u t ;  
 	 s t r i n g   T i m e S t a m p ;  
 	 i n t   V i s i b l e I D ;  
 	 i n t   V i s i b l e S h i f t ;  
 	 i n t   V i s i b l e L i m i t ;  
 	 i n t   R a n g e C a n d l e S t a r t ;  
 	 i n t   R a n g e C a n d l e E n d ;  
 	 s t r i n g   R a n g e T i m e S o u r c e ;  
 	 s t r i n g   R a n g e T i m e S t a r t ;  
 	 s t r i n g   R a n g e T i m e E n d ;  
 	 d o u b l e   R a n g e D a y O f f s e t ;  
 	 s t r i n g   R a n g e V a l u e ;  
 	 i n t   S h i f t ;  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   r )   { r e t u r n ; }  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 M D L I C _ m y i n d i c a t o r s _ m y i n d i c a t o r s _ 4 ( )  
 	 {  
 	 	 S y m b o l   =   ( s t r i n g ) C u r r e n t S y m b o l ( ) ;  
 	 	 P e r i o d   =   ( E N U M _ T I M E F R A M E S ) C u r r e n t T i m e f r a m e ( ) ;  
 	 	 M o d e O u t p u t   =   ( s t r i n g ) " i d " ;  
 	 	 T i m e S t a m p   =   ( s t r i n g ) " 0 0 : 0 0 " ;  
 	 	 V i s i b l e I D   =   ( i n t ) 0 ;  
 	 	 V i s i b l e S h i f t   =   ( i n t ) 0 ;  
 	 	 V i s i b l e L i m i t   =   ( i n t ) 1 0 0 ;  
 	 	 R a n g e C a n d l e S t a r t   =   ( i n t ) 0 ;  
 	 	 R a n g e C a n d l e E n d   =   ( i n t ) 1 0 ;  
 	 	 R a n g e T i m e S o u r c e   =   ( s t r i n g ) " s e r v e r " ;  
 	 	 R a n g e T i m e S t a r t   =   ( s t r i n g ) " 0 1 : 0 0 " ;  
 	 	 R a n g e T i m e E n d   =   ( s t r i n g ) " 0 8 : 0 0 " ;  
 	 	 R a n g e D a y O f f s e t   =   ( d o u b l e ) 0 . 0 ;  
 	 	 R a n g e V a l u e   =   ( s t r i n g ) " m a x " ;  
 	 	 S h i f t   =   ( i n t ) 0 ;  
 	 }  
  
 	 p u b l i c :   / *   T h e   m a i n   m e t h o d   * /  
 	 d o u b l e   _ e x e c u t e _ ( )  
 	 {  
 	 	 / / = =   M Q L 5   s p e c i f i c s   B E G I N   = = / /  
 	 	 / /   T h e   p r o b l e m   i s   t h a t   i C u s t o m ( )   a l w a y s   r e t u r n s   n e w   h a n d l e   w h e n   c a l l e d ,   r e g a r d l e s s   o f   t h e   i n p u t   p a r a m e t e r s .  
 	 	 i n t   h a n d l e   =   I N V A L I D _ H A N D L E ;  
 	 	  
 	 	 / /   t u r n   t h e   i n p u t   p a r a m e t e r s   i n t o   a   k e y  
 	 	 s t r i n g   k e y   =   " " ;  
 	 	 S t r i n g C o n c a t e n a t e ( k e y ,   S y m b o l ,   P e r i o d ,   " A T R   V a l u e   I n d i c a t o r "   ,   ( E N U M _ V a l u e _ T y p e ) P i p s ,   ( s t r i n g ) " " ,   ( i n t ) 1 4 ,   ( E N U M _ T I M E F R A M E S ) P E R I O D _ C U R R E N T ,   ( d o u b l e ) 1 . 0 ,   ( s t r i n g ) " " ,   ( E N U M _ C O R N E R ) R I G H T _ U P P E R ,   ( i n t ) 3 0 ,   ( i n t ) 3 0 ,   ( c o l o r ) c l r R e d ,   ( i n t ) 1 0 ) ;  
 	 	  
 	 	 / /   f o r   o u r   p a r a m e t e r s ,   d o   w e   a l r e a d y   h a v e   a n   i n d i c a t o r   h a n d l e ?  
 	 	 i n t   a r r a y _ k e y   =   A r r a y S e a r c h ( F X D _ I C U S T O M _ H A N D L E S _ K E Y S ,   k e y ) ;  
 	 	  
 	 	 / /   i f   w e   d o n ' t   h a v e   a   h a n d l e ,   t h e n   c r e a t e   o n e  
 	 	 i f   ( a r r a y _ k e y   = =   - 1 )  
 	 	 {  
 	 	 	 h a n d l e   =   i C u s t o m ( S y m b o l ,   P e r i o d ,   " A T R   V a l u e   I n d i c a t o r "   ,   ( E N U M _ V a l u e _ T y p e ) P i p s ,   ( s t r i n g ) " " ,   ( i n t ) 1 4 ,   ( E N U M _ T I M E F R A M E S ) P E R I O D _ C U R R E N T ,   ( d o u b l e ) 1 . 0 ,   ( s t r i n g ) " " ,   ( E N U M _ C O R N E R ) R I G H T _ U P P E R ,   ( i n t ) 3 0 ,   ( i n t ) 3 0 ,   ( c o l o r ) c l r R e d ,   ( i n t ) 1 0 ,   P R I C E _ C L O S E ) ;  
 	 	 	  
 	 	 	 i f   ( h a n d l e   = =   I N V A L I D _ H A N D L E )   {  
 	 	 	 	 r e t u r n   E M P T Y _ V A L U E ; 	  
 	 	 	 }  
 	 	 	  
 	 	 	 i n t   s i z e   =   A r r a y S i z e ( F X D _ I C U S T O M _ H A N D L E S _ K E Y S ) ;  
 	 	  
 	 	 	 A r r a y R e s i z e ( F X D _ I C U S T O M _ H A N D L E S _ K E Y S ,   s i z e + 1 ) ;  
 	 	 	 A r r a y R e s i z e ( F X D _ I C U S T O M _ H A N D L E S _ I D S ,   s i z e + 1 ) ;  
 	 	 	  
 	 	 	 F X D _ I C U S T O M _ H A N D L E S _ K E Y S [ s i z e ]   =   k e y ;  
 	 	 	 F X D _ I C U S T O M _ H A N D L E S _ I D S [ s i z e ]   =   h a n d l e ;  
 	 	 	  
 	 	 	 a r r a y _ k e y   =   s i z e ;  
 	 	 }  
 	 	 / /   y e s ,   w e   h a v e   a   h a n d l e ,   t h e n   g e t   i t  
 	 	 e l s e   {  
 	 	 	 h a n d l e   =   F X D _ I C U S T O M _ H A N D L E S _ I D S [ a r r a y _ k e y ] ;  
 	 	 }  
 	 	  
 	 	 / / = =   M Q L 5   s p e c i f i c s   E N D   = = / /  
 	 	  
 	 	 / / ! ! !   I   m u s t   d e f i n e   a l l   i n p u t   p r o p e r t i e s   h e r e ,   b e c a u s e   t h e y   a r e   n o t   a u t o m a t i c a l l y   d e f i n e d .  
 	 	 / /   T h i s   f u n c t i o n   i s   n o t   g l o b a l   p r o t o t y p e ,   o n e   n e w   f u n c t i o n   i s   c r e a t e d   f o r   e a c h   c a s e .   T h i s   i s   b e c a u s e   %   i C u s t o m   %   m u s t   b e   u n i q u e  
 	 	  
 	 	 s t r i n g   s y m b o l   =   S y m b o l ;  
 	 	 E N U M _ T I M E F R A M E S   t i m e f r a m e   =   P e r i o d ;  
 	 	 i n t   b u f f e r         =   0 ;  
 	 	 i n t   s h i f t           =   S h i f t   +   F X D _ M O R E _ S H I F T ;  
 	 	  
 	 	 d o u b l e   r e t v a l   =   E M P T Y _ V A L U E ;  
 	 	 i n t   i ;  
 	 	 d o u b l e   i v a l ;  
 	 	  
 	 	 i f   ( M o d e O u t p u t   = =   " i d " )  
 	 	 {  
 	 	 	 r e t v a l   =   f x d C u s t o m I n d i c a t o r ( h a n d l e ,   b u f f e r ,   s h i f t ) ;  
 	 	 }  
 	 	 e l s e   i f   ( M o d e O u t p u t   = =   " t i m e " )  
 	 	 {  
 	 	 	 d a t e t i m e   t i m e ;  
 	 	 	  
 	 	 	 i f   ( 0   & &   S t r i n g F i n d ( T i m e S t a m p ,   " : " )   = =   - 1 )  
 	 	 	 { 	  
 	 	 	 	 t i m e   =   ( d a t e t i m e ) S t r i n g T o I n t e g e r ( T i m e S t a m p ) ;   / /   h a n g s   i n   M Q L 4 ! ! !  
 	 	 	 }  
 	 	 	 e l s e  
 	 	 	 {  
 	 	 	 	 t i m e   =   S t r i n g T o T i m e ( T i m e S t a m p ) ;  
 	 	 	 }  
 	 	 	  
 	 	 	 s h i f t   =   i C a n d l e I D ( s y m b o l ,   t i m e f r a m e ,   t i m e ) ;  
 	 	 	 r e t v a l   =   f x d C u s t o m I n d i c a t o r ( h a n d l e ,   b u f f e r ,   s h i f t ) ;  
 	 	 }  
 	 	 e l s e   i f   ( M o d e O u t p u t   = =   " v i s i b l e "   | |   M o d e O u t p u t   = =   " i d _ b y _ v i s i b l e " )  
 	 	 {  
 	 	 	 i f   ( V i s i b l e L i m i t   = =   0 )   { V i s i b l e L i m i t   =   B a r s ( s y m b o l ,   t i m e f r a m e ) ; }  
 	 	 	  
 	 	 	 i n t   v i d   =   0 ;  
 	 	 	  
 	 	 	 f o r   ( i   =   s h i f t ;   i   < =   V i s i b l e L i m i t ;   i + + )  
 	 	 	 {  
 	 	 	 	 i v a l   =   f x d C u s t o m I n d i c a t o r ( h a n d l e ,   b u f f e r ,   s h i f t   +   i ) ;  
 	 	 	 	  
 	 	 	 	 i f   ( i v a l   = =   E M P T Y _ V A L U E   | |   i v a l   = =   0 )   { c o n t i n u e ; }  
 	 	 	 	 i f   ( v i d   > =   V i s i b l e I D )   {  
 	 	 	 	 	 i f   ( M o d e O u t p u t   = =   " v i s i b l e " )   { r e t v a l   =   i v a l ; }  
 	 	 	 	 	 e l s e   { r e t v a l   =   i ; }  
 	 	 	 	 	 b r e a k ; 	  
 	 	 	 	 }  
 	 	 	 	 	  
 	 	 	 	 v i d + + ;  
 	 	 	 }  
 	 	 }  
 	 	 e l s e   i f   ( M o d e O u t p u t   = =   " r a n g e " )  
 	 	 {  
 	 	 	 / /   r e v e r s e   v a l u e s ,   i f   n e e d e d  
 	 	 	 i f   ( R a n g e C a n d l e S t a r t   >   R a n g e C a n d l e E n d )   {  
 	 	 	 	 i n t   c t m p   =   R a n g e C a n d l e E n d ;  
 	 	 	 	 R a n g e C a n d l e E n d   =   R a n g e C a n d l e S t a r t ;  
 	 	 	 	 R a n g e C a n d l e S t a r t   =   c t m p ;  
 	 	 	 }  
 	 	  
 	 	 	 i f   ( R a n g e V a l u e   = =   " m a x " )  
 	 	 	 {  
 	 	 	 	 r e t v a l   =   - E M P T Y _ V A L U E ;  
 	 	 	 	  
 	 	 	 	 f o r   ( i   =   R a n g e C a n d l e S t a r t ;   i   < =   R a n g e C a n d l e E n d ;   i + + )  
 	 	 	 	 {  
 	 	 	 	 	 i v a l   =   f x d C u s t o m I n d i c a t o r ( h a n d l e ,   b u f f e r ,   s h i f t   +   i ) ;  
 	 	 	 	 	 i f   ( i v a l   = =   E M P T Y _ V A L U E   | |   i v a l   = =   0 )   { c o n t i n u e ; }  
 	 	 	 	 	 i f   ( i v a l   >   r e t v a l )   { r e t v a l   =   i v a l ; }  
 	 	 	 	 }  
 	 	 	 	  
 	 	 	 	 i f   ( r e t v a l   = =   - E M P T Y _ V A L U E )   { r e t v a l   =   E M P T Y _ V A L U E ; }  
 	 	 	 }  
 	 	 	 e l s e   i f   ( R a n g e V a l u e   = =   " m i n " )  
 	 	 	 {  
 	 	 	 	 r e t v a l   =   E M P T Y _ V A L U E ;  
 	 	 	 	  
 	 	 	 	 f o r   ( i   =   R a n g e C a n d l e S t a r t ;   i   < =   R a n g e C a n d l e E n d ;   i + + )  
 	 	 	 	 {  
 	 	 	 	 	 i v a l   =   f x d C u s t o m I n d i c a t o r ( h a n d l e ,   b u f f e r ,   s h i f t   +   i ) ;  
 	 	 	 	 	 i f   ( i v a l   = =   E M P T Y _ V A L U E   | |   i v a l   = =   0 )   { c o n t i n u e ; }  
 	 	 	 	 	 i f   ( i v a l   <   r e t v a l )   { r e t v a l   =   i v a l ; }  
 	 	 	 	 }  
 	 	 	 }  
 	 	 }  
 	 	 e l s e   i f   ( M o d e O u t p u t   = =   " r a n g e _ t i m e " )  
 	 	 {  
 	 	 	 d a t e t i m e   o f f s e t   =   0 ;  
 	 	 	 i f   ( R a n g e T i m e S o u r c e   = =   " g m t " )   { o f f s e t   =   ( i n t ) ( T i m e C u r r e n t ( )   -   T i m e L o c a l ( )   +   T i m e G M T O f f s e t ( ) ) ; }  
 	 	 	 e l s e   i f   ( R a n g e T i m e S o u r c e   = =   " s e r v e r " )   { o f f s e t   =   ( i n t ) ( T i m e C u r r e n t ( )   -   T i m e L o c a l ( ) ) ; }  
 	 	 	  
 	 	 	 d a t e t i m e   t i m e 1   =   S t r i n g T o T i m e ( R a n g e T i m e S t a r t ) - ( d a t e t i m e ) ( 8 6 4 0 0 * R a n g e D a y O f f s e t )   +   o f f s e t ;  
 	 	 	 d a t e t i m e   t i m e 2   =   S t r i n g T o T i m e ( R a n g e T i m e E n d ) - ( d a t e t i m e ) ( 8 6 4 0 0 * R a n g e D a y O f f s e t )   +   o f f s e t ;  
 	 	  
 	 	 	 i n t   x 1   =   i B a r S h i f t ( s y m b o l ,   t i m e f r a m e ,   t i m e 1 ,   f a l s e ) ;  
 	 	 	 i n t   x 2   =   i B a r S h i f t ( s y m b o l ,   t i m e f r a m e ,   t i m e 2 ,   f a l s e ) ;  
 	 	 	 i f   ( x 1 < x 2 )   { x 1 = i B a r S h i f t ( s y m b o l , t i m e f r a m e , ( t i m e 1 - 8 6 4 0 0 ) , f a l s e ) ; }  
 	 	 	  
 	 	 	 i f   ( R a n g e V a l u e   = =   " m a x " )  
 	 	 	 {  
 	 	 	 	 r e t v a l   =   - E M P T Y _ V A L U E ;  
 	 	 	 	  
 	 	 	 	 f o r   ( i = x 2 ;   i < = x 1 ;   i + + )  
 	 	 	 	 {  
 	 	 	 	 	 i v a l   =   f x d C u s t o m I n d i c a t o r ( h a n d l e ,   b u f f e r ,   s h i f t   +   i ) ;  
 	 	 	 	 	 i f   ( i v a l   = =   E M P T Y _ V A L U E   | |   i v a l   = =   0 )   { c o n t i n u e ; }  
 	 	 	 	 	 i f   ( i v a l   >   r e t v a l )   { r e t v a l   =   i v a l ; }  
 	 	 	 	 }  
 	 	 	 	  
 	 	 	 	 i f   ( r e t v a l   = =   - E M P T Y _ V A L U E )   { r e t v a l   =   E M P T Y _ V A L U E ; }  
 	 	 	 }  
 	 	 	 e l s e   i f   ( R a n g e V a l u e   = =   " m i n " )  
 	 	 	 {  
 	 	 	 	 r e t v a l   =   E M P T Y _ V A L U E ;  
 	 	 	 	  
 	 	 	 	 f o r   ( i = x 2 ;   i < = x 1 ;   i + + )  
 	 	 	 	 {  
 	 	 	 	 	 i v a l   =   f x d C u s t o m I n d i c a t o r ( h a n d l e ,   b u f f e r ,   s h i f t   +   i ) ;  
 	 	 	 	 	 i f   ( i v a l   = =   E M P T Y _ V A L U E   | |   i v a l   = =   0 )   { c o n t i n u e ; }  
 	 	 	 	 	 i f   ( i v a l   <   r e t v a l )   { r e t v a l   =   i v a l ; }  
 	 	 	 	 }  
 	 	 	 }  
 	 	 }  
 	 	  
 	 	 r e t u r n   ( r e t v a l ) ;  
 	 }  
 } ;  
  
 / /   " A s k ,   B i d ,   M i d "   m o d e l  
 c l a s s   M D L I C _ p r i c e s _ p r i c e s  
 {  
 	 p u b l i c :   / *   I n p u t   P a r a m e t e r s   * /  
 	 s t r i n g   P r i c e ;  
 	 i n t   T i c k I D ;  
 	 s t r i n g   S y m b o l ;  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   r )   { r e t u r n ; }  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 M D L I C _ p r i c e s _ p r i c e s ( )  
 	 {  
 	 	 P r i c e   =   ( s t r i n g ) " A S K " ;  
 	 	 T i c k I D   =   ( i n t ) 0 ;  
 	 	 S y m b o l   =   ( s t r i n g ) C u r r e n t S y m b o l ( ) ;  
 	 }  
  
 	 p u b l i c :   / *   T h e   m a i n   m e t h o d   * /  
 	 d o u b l e   _ e x e c u t e _ ( )  
 	 {  
 	 	 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 ) ;  
 	 	  
 	 	 d o u b l e   r e t v a l   =   0 ;  
 	 	 i n t   t I D               =   T i c k I D   +   F X D _ M O R E _ S H I F T ;  
 	 	  
 	 	           i f   ( P r i c e   = =   " A S K " )             { r e t v a l   =   T i c k s D a t a ( S y m b o l , S Y M B O L _ A S K , t I D ) ; }  
 	 	 e l s e   i f   ( P r i c e   = =   " B I D " )             { r e t v a l   =   T i c k s D a t a ( S y m b o l , S Y M B O L _ B I D , t I D ) ; }  
 	 	 e l s e   i f   ( P r i c e   = =   " M I D " )             { r e t v a l   =   ( ( T i c k s D a t a ( S y m b o l , S Y M B O L _ A S K , t I D ) + T i c k s D a t a ( S y m b o l , S Y M B O L _ B I D , t I D ) ) / 2 ) ; }  
 	 	 e l s e   i f   ( P r i c e   = =   " B I D H I G H " )     { 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 H I G H ) ; }  
 	 	 e l s e   i f   ( P r i c e   = =   " B I D L O W " )       { 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 L O W ) ; }  
 	 	 e l s e   i f   ( P r i c e   = =   " A S K H I G H " )     { 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 H I G H ) ; }  
 	 	 e l s e   i f   ( P r i c e   = =   " A S K L O W " )       { 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 L O W ) ; }  
 	 	 e l s e   i f   ( P r i c e   = =   " L A S T " )           { 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 _ L A S T ) ; }  
 	 	 e l s e   i f   ( P r i c e   = =   " L A S T H I G H " )   { 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 _ L A S T H I G H ) ; }  
 	 	 e l s e   i f   ( P r i c e   = =   " L A S T L O W " )     { 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 _ L A S T L O W ) ; }  
 	 	  
 	 	 r e t u r n   N o r m a l i z e D o u b l e ( r e t v a l ,   d i g i t s ) ;  
 	 }  
 } ;  
  
 / /   " L o w e s t   P r i c e   ( C a n d l e s   p e r i o d ) "   m o d e l  
 c l a s s   M D L I C _ p r i c e s _ L o w e s t F r o m T o C a n d l e s  
 {  
 	 p u b l i c :   / *   I n p u t   P a r a m e t e r s   * /  
 	 i n t   S t a r t B a r ;  
 	 i n t   E n d B a r ;  
 	 i n t   W h a t T o G e t ;  
 	 s t r i n g   S y m b o l ;  
 	 E N U M _ T I M E F R A M E S   P e r i o d ;  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   r )   { r e t u r n ; }  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 M D L I C _ p r i c e s _ L o w e s t F r o m T o C a n d l e s ( )  
 	 {  
 	 	 S t a r t B a r   =   ( i n t ) 0 ;  
 	 	 E n d B a r   =   ( i n t ) 1 0 ;  
 	 	 W h a t T o G e t   =   ( i n t ) 1 ;  
 	 	 S y m b o l   =   ( s t r i n g ) C u r r e n t S y m b o l ( ) ;  
 	 	 P e r i o d   =   ( E N U M _ T I M E F R A M E S ) C u r r e n t T i m e f r a m e ( ) ;  
 	 }  
  
 	 p u b l i c :   / *   T h e   m a i n   m e t h o d   * /  
 	 d o u b l e   _ e x e c u t e _ ( )  
 	 {  
 	 	 r e t u r n   L o w e s t F r o m T o ( S y m b o l , P e r i o d , S t a r t B a r , E n d B a r , W h a t T o G e t ) ;  
 	 }  
 } ;  
  
 / /   " H i g h e s t   P r i c e   ( C a n d l e s   p e r i o d ) "   m o d e l  
 c l a s s   M D L I C _ p r i c e s _ H i g h e s t F r o m T o C a n d l e s  
 {  
 	 p u b l i c :   / *   I n p u t   P a r a m e t e r s   * /  
 	 i n t   S t a r t B a r ;  
 	 i n t   E n d B a r ;  
 	 i n t   W h a t T o G e t ;  
 	 s t r i n g   S y m b o l ;  
 	 E N U M _ T I M E F R A M E S   P e r i o d ;  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   r )   { r e t u r n ; }  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 M D L I C _ p r i c e s _ H i g h e s t F r o m T o C a n d l e s ( )  
 	 {  
 	 	 S t a r t B a r   =   ( i n t ) 0 ;  
 	 	 E n d B a r   =   ( i n t ) 1 0 ;  
 	 	 W h a t T o G e t   =   ( i n t ) 1 ;  
 	 	 S y m b o l   =   ( s t r i n g ) C u r r e n t S y m b o l ( ) ;  
 	 	 P e r i o d   =   ( E N U M _ T I M E F R A M E S ) C u r r e n t T i m e f r a m e ( ) ;  
 	 }  
  
 	 p u b l i c :   / *   T h e   m a i n   m e t h o d   * /  
 	 d o u b l e   _ e x e c u t e _ ( )  
 	 {  
 	 	 r e t u r n   H i g h e s t F r o m T o ( S y m b o l , P e r i o d , S t a r t B a r , E n d B a r , W h a t T o G e t ) ;  
 	 }  
 } ;  
  
 / /   " P a r a b o l i c   S A R "   m o d e l  
 c l a s s   M D L I C _ i n d i c a t o r s _ i S A R  
 {  
 	 p u b l i c :   / *   I n p u t   P a r a m e t e r s   * /  
 	 d o u b l e   S t e p ;  
 	 d o u b l e   M a x i m u m ;  
 	 s t r i n g   S y m b o l ;  
 	 E N U M _ T I M E F R A M E S   P e r i o d ;  
 	 i n t   S h i f t ;  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   r )   { r e t u r n ; }  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 M D L I C _ i n d i c a t o r s _ i S A R ( )  
 	 {  
 	 	 S t e p   =   ( d o u b l e ) 0 . 0 2 ;  
 	 	 M a x i m u m   =   ( d o u b l e ) 0 . 2 ;  
 	 	 S y m b o l   =   ( s t r i n g ) C u r r e n t S y m b o l ( ) ;  
 	 	 P e r i o d   =   ( E N U M _ T I M E F R A M E S ) C u r r e n t T i m e f r a m e ( ) ;  
 	 	 S h i f t   =   ( i n t ) 0 ;  
 	 }  
  
 	 p u b l i c :   / *   T h e   m a i n   m e t h o d   * /  
 	 d o u b l e   _ e x e c u t e _ ( )  
 	 {  
 	 	 r e t u r n   i S A R ( S y m b o l ,   P e r i o d ,   S t e p ,   M a x i m u m ,   S h i f t   +   F X D _ M O R E _ S H I F T ) ;  
 	 }  
 } ;  
  
 / /   " C a n d l e "   m o d e l  
 c l a s s   M D L I C _ c a n d l e s _ c a n d l e s  
 {  
 	 p u b l i c :   / *   I n p u t   P a r a m e t e r s   * /  
 	 s t r i n g   i O H L C ;  
 	 s t r i n g   M o d e C a n d l e F i n d B y ;  
 	 i n t   C a n d l e I D ;  
 	 s t r i n g   T i m e S t a m p ;  
 	 s t r i n g   S y m b o l ;  
 	 E N U M _ T I M E F R A M E S   P e r i o d ;  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   r )   { r e t u r n ; }  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 M D L I C _ c a n d l e s _ c a n d l e s ( )  
 	 {  
 	 	 i O H L C   =   ( s t r i n g ) " i C l o s e " ;  
 	 	 M o d e C a n d l e F i n d B y   =   ( s t r i n g ) " i d " ;  
 	 	 C a n d l e I D   =   ( i n t ) 0 ;  
 	 	 T i m e S t a m p   =   ( s t r i n g ) " 0 0 : 0 0 " ;  
 	 	 S y m b o l   =   ( s t r i n g ) C u r r e n t S y m b o l ( ) ;  
 	 	 P e r i o d   =   ( E N U M _ T I M E F R A M E S ) C u r r e n t T i m e f r a m e ( ) ;  
 	 }  
  
 	 p u b l i c :   / *   T h e   m a i n   m e t h o d   * /  
 	 d o u b l e   _ e x e c u t e _ ( )  
 	 {  
 	 	 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 ) ;  
 	 	  
 	 	 d o u b l e   O [ ] ;  
 	 	 d o u b l e   H [ ] ;  
 	 	 d o u b l e   L [ ] ;  
 	 	 d o u b l e   C [ ] ;    
 	 	 l o n g   c T i c k V o l u m e [ ] ;  
 	 	 l o n g   c R e a l V o l u m e [ ] ;  
 	 	 d a t e t i m e   T [ ] ;  
 	 	  
 	 	 d o u b l e   r e t v a l   =   E M P T Y _ V A L U E ;  
 	 	  
 	 	 / /   c a n d l e ' s   i d   w i l l   c h a n g e ,   s o   w e   d o n ' t   w a n t   t o   m e s s   w i t h   t h e   v a r i a b l e   C a n d l e I D ;  
 	 	 i n t   c I D   =   C a n d l e I D ;  
 	 	  
 	 	 i f   ( M o d e C a n d l e F i n d B y   = =   " t i m e " )  
 	 	 {  
 	 	 	 c I D   =   i C a n d l e I D ( S y m b o l ,   P e r i o d ,   S t r i n g T o T i m e E x ( T i m e S t a m p ,   " s e r v e r " ) ) ;  
 	 	 }  
 	 	  
 	 	 c I D   =   c I D   +   F X D _ M O R E _ S H I F T ;  
 	 	  
 	 	 / / - -   t h e   c o m m o n   l e v e l s   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
 	 	 i f   ( i O H L C   = =   " i O p e n " )  
 	 	 {  
 	 	 	 i f   ( C o p y O p e n ( S y m b o l , P e r i o d , c I D , 1 , O )   >   - 1 )   r e t v a l   =   O [ 0 ] ;  
 	 	 }  
 	 	 e l s e   i f   ( i O H L C   = =   " i H i g h " )  
 	 	 {  
 	 	 	 i f   ( C o p y H i g h ( S y m b o l , P e r i o d , c I D , 1 , H )   >   - 1 )   r e t v a l   =   H [ 0 ] ;  
 	 	 }  
 	 	 e l s e   i f   ( i O H L C   = =   " i L o w " )  
 	 	 {  
 	 	 	 i f   ( C o p y L o w ( S y m b o l , P e r i o d , c I D , 1 , L )   >   - 1 )   r e t v a l   =   L [ 0 ] ;  
 	 	 }  
 	 	 e l s e   i f   ( i O H L C   = =   " i C l o s e " )  
 	 	 {  
 	 	 	 i f   ( C o p y C l o s e ( S y m b o l , P e r i o d , c I D , 1 , C )   >   - 1 )   r e t v a l   =   C [ 0 ] ;  
 	 	 }  
 	 	  
 	 	 / / - -   n o n - p r i c e   v a l u e s     - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
 	 	 e l s e   i f   ( i O H L C   = =   " i V o l u m e "   | |   i O H L C   = =   " i T i c k V o l u m e " )  
 	 	 {  
 	 	 	 i f   ( C o p y T i c k V o l u m e ( S y m b o l , P e r i o d , c I D , 1 , c T i c k V o l u m e )   >   - 1 )   r e t v a l   =   ( d o u b l e ) c T i c k V o l u m e [ 0 ] ;  
 	 	 	  
 	 	 	 r e t u r n   r e t v a l ;  
 	 	 }  
 	 	 e l s e   i f   ( i O H L C   = =   " i R e a l V o l u m e " )  
 	 	 {  
 	 	 	 i f   ( C o p y R e a l V o l u m e ( S y m b o l , P e r i o d , c I D , 1 , c R e a l V o l u m e )   >   - 1 )   r e t v a l   =   ( d o u b l e ) c R e a l V o l u m e [ 0 ] ;  
 	 	 	  
 	 	 	 r e t u r n   r e t v a l ;  
 	 	 }  
 	 	 e l s e   i f   ( i O H L C   = =   " i T i m e " )  
 	 	 {  
 	 	 	 i f   ( C o p y T i m e ( S y m b o l , P e r i o d , c I D , 1 , T )   >   - 1 )   r e t v a l   =   ( d o u b l e ) T [ 0 ] ;  
 	 	 	  
 	 	 	 r e t u r n   r e t v a l ;  
 	 	 }  
 	 	  
 	 	 / / - -   s i m p l e   c a l c u l a t i o n s   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
 	 	 e l s e   i f   ( i O H L C   = =   " i M e d i a n " )  
 	 	 {  
 	 	 	 i f   (  
 	 	 	 	       C o p y L o w ( S y m b o l , P e r i o d , c I D , 1 , L )   >   - 1  
 	 	 	 	 & &   C o p y H i g h ( S y m b o l , P e r i o d , c I D , 1 , H )   >   - 1  
 	 	 	 )  
 	 	 	 {  
 	 	 	 	 r e t v a l   =   ( ( L [ 0 ] + H [ 0 ] ) / 2 ) ;  
 	 	 	 }  
 	 	 }  
 	 	 e l s e   i f   ( i O H L C   = =   " i T y p i c a l " )  
 	 	 {  
 	 	 	 i f   (  
 	 	 	 	       C o p y L o w ( S y m b o l , P e r i o d , c I D , 1 , L )   >   - 1  
 	 	 	 	 & &   C o p y H i g h ( S y m b o l , P e r i o d , c I D , 1 , H )   >   - 1  
 	 	 	 	 & &   C o p y C l o s e ( S y m b o l , P e r i o d , c I D , 1 , C )   >   - 1  
 	 	 	 )  
 	 	 	 {  
 	 	 	 	 r e t v a l   =   ( ( L [ 0 ] + H [ 0 ] + C [ 0 ] ) / 3 ) ;  
 	 	 	 }  
 	 	 }  
 	 	 e l s e   i f   ( i O H L C   = =   " i A v e r a g e " )  
 	 	 {  
 	 	 	 i f   (  
 	 	 	 	       C o p y L o w ( S y m b o l , P e r i o d , c I D , 1 , L )   >   - 1  
 	 	 	 	 & &   C o p y H i g h ( S y m b o l , P e r i o d , c I D , 1 , H )   >   - 1  
 	 	 	 	 & &   C o p y C l o s e ( S y m b o l , P e r i o d , c I D , 1 , C )   >   - 1  
 	 	 	 )  
 	 	 	 {  
 	 	 	 	 r e t v a l   =   ( ( L [ 0 ] + H [ 0 ] + C [ 0 ] + C [ 0 ] ) / 4 ) ;  
 	 	 	 }  
 	 	 }  
 	 	  
 	 	 / / - -   m o r e   c o m p l e x   l e v e l s   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
 	 	 e l s e   i f   ( i O H L C = = " i T o t a l " )  
 	 	 {  
 	 	 	 i f   (  
 	 	 	 	       C o p y H i g h ( S y m b o l , P e r i o d , c I D , 1 , H )   >   - 1  
 	 	 	 	 & &   C o p y L o w ( S y m b o l , P e r i o d , c I D , 1 , L )   >   - 1  
 	 	 	 )  
 	 	 	 {  
 	 	 	 	 r e t v a l   =   t o P i p s ( M a t h A b s ( H [ 0 ] - L [ 0 ] ) , S y m b o l ) ;  
 	 	 	 }  
 	 	 }  
 	 	 e l s e   i f   ( i O H L C   = =   " i B o d y " )  
 	 	 {  
 	 	 	 i f   (  
 	 	 	 	       C o p y O p e n ( S y m b o l , P e r i o d , c I D , 1 , O )   >   - 1  
 	 	 	 	 & &   C o p y C l o s e ( S y m b o l , P e r i o d , c I D , 1 , C )   >   - 1  
 	 	 	 )  
 	 	 	 {  
 	 	 	 	 r e t v a l   =   t o P i p s ( M a t h A b s ( C [ 0 ] - O [ 0 ] ) , S y m b o l ) ;  
 	 	 	 }  
 	 	 }  
 	 	 e l s e   i f   ( i O H L C   = =   " i U p p e r W i c k " )  
 	 	 {  
 	 	 	 i f   (  
 	 	 	 	       C o p y H i g h ( S y m b o l , P e r i o d , c I D , 1 , H )   >   - 1  
 	 	 	 	 & &   C o p y O p e n ( S y m b o l , P e r i o d , c I D , 1 , O )   >   - 1  
 	 	 	 	 & &   C o p y C l o s e ( S y m b o l , P e r i o d , c I D , 1 , C )   >   - 1  
 	 	 	 	 & &   C o p y L o w ( S y m b o l , P e r i o d , c I D , 1 , L )   >   - 1  
 	 	 	 )  
 	 	 	 {  
 	 	 	 	 r e t v a l   =   ( C [ 0 ]   >   O [ 0 ] )   ?   t o P i p s ( M a t h A b s ( H [ 0 ] - C [ 0 ] ) , S y m b o l )   :   t o P i p s ( M a t h A b s ( H [ 0 ] - O [ 0 ] ) , S y m b o l ) ;  
 	 	 	 }  
 	 	 }  
 	 	 e l s e   i f   ( i O H L C   = =   " i B o t t o m W i c k " )  
 	 	 {  
 	 	 	 i f   (  
 	 	 	 	       C o p y H i g h ( S y m b o l , P e r i o d , c I D , 1 , H )   >   - 1  
 	 	 	 	 & &   C o p y O p e n ( S y m b o l , P e r i o d , c I D , 1 , O )   >   - 1  
 	 	 	 	 & &   C o p y C l o s e ( S y m b o l , P e r i o d , c I D , 1 , C )   >   - 1  
 	 	 	 	 & &   C o p y L o w ( S y m b o l , P e r i o d , c I D , 1 , L )   >   - 1  
 	 	 	 )  
 	 	 	 {  
 	 	 	 	 r e t v a l   =   ( C [ 0 ]   >   O [ 0 ] )   ?   t o P i p s ( M a t h A b s ( O [ 0 ] - L [ 0 ] ) , S y m b o l )   :   t o P i p s ( M a t h A b s ( C [ 0 ] - L [ 0 ] ) , S y m b o l ) ;  
 	 	 	 }  
 	 	 }  
 	 	 e l s e   i f   ( i O H L C   = =   " i G a p " )  
 	 	 {  
 	 	 	 i f   (  
 	 	 	 	       C o p y O p e n ( S y m b o l , P e r i o d , c I D , 1 , O )   >   - 1  
 	 	 	 	 & &   C o p y C l o s e ( S y m b o l , P e r i o d , c I D + 1 , 1 , C )   >   - 1  
 	 	 	 )  
 	 	 	 {  
 	 	 	 	 r e t v a l   =   t o P i p s ( M a t h A b s ( O [ 0 ] - C [ 0 ] ) , S y m b o l ) ;  
 	 	 	 }  
 	 	 }  
 	 	 e l s e   i f   ( i O H L C   = =   " i B u l l T o t a l " )  
 	 	 {  
 	 	 	 i f   (  
 	 	 	 	       C o p y O p e n ( S y m b o l , P e r i o d , c I D , 1 , O )   >   - 1  
 	 	 	 	 & &   C o p y C l o s e ( S y m b o l , P e r i o d , c I D , 1 , C )   >   - 1  
 	 	 	 	 & &   C o p y H i g h ( S y m b o l , P e r i o d , c I D , 1 , H )   >   - 1  
 	 	 	 	 & &   C o p y L o w ( S y m b o l , P e r i o d , c I D , 1 , L )   >   - 1  
 	 	 	 	 & &   C [ 0 ]   >   O [ 0 ]  
 	 	 	 )  
 	 	 	 {  
 	 	 	 	 r e t v a l   =   t o P i p s ( ( H [ 0 ] - L [ 0 ] ) , S y m b o l ) ;  
 	 	 	 }  
 	 	 }  
 	 	 e l s e   i f   ( i O H L C   = =   " i B u l l B o d y " )  
 	 	 {  
 	 	 	 i f   (  
 	 	 	 	       C o p y O p e n ( S y m b o l , P e r i o d , c I D , 1 , O )   >   - 1  
 	 	 	 	 & &   C o p y C l o s e ( S y m b o l , P e r i o d , c I D , 1 , C )   >   - 1  
 	 	 	 	 & &   C [ 0 ]   >   O [ 0 ]  
 	 	 	 )  
 	 	 	 {  
 	 	 	 	 r e t v a l   =   t o P i p s ( ( C [ 0 ] - O [ 0 ] ) , S y m b o l ) ;  
 	 	 	 }  
 	 	 }  
 	 	 e l s e   i f   ( i O H L C   = =   " i B u l l U p p e r W i c k " )  
 	 	 {  
 	 	 	 i f   (  
 	 	 	 	       C o p y H i g h ( S y m b o l , P e r i o d , c I D , 1 , H )   >   - 1  
 	 	 	 	 & &   C o p y O p e n ( S y m b o l , P e r i o d , c I D , 1 , O )   >   - 1  
 	 	 	 	 & &   C o p y C l o s e ( S y m b o l , P e r i o d , c I D , 1 , C )   >   - 1  
 	 	 	 	 & &   C [ 0 ]   >   O [ 0 ]  
 	 	 	 )  
 	 	 	 {  
 	 	 	 	 r e t v a l   =   t o P i p s ( ( H [ 0 ] - C [ 0 ] ) , S y m b o l ) ;  
 	 	 	 }  
 	 	 }  
 	 	 e l s e   i f   ( i O H L C   = =   " i B u l l B o t t o m W i c k " )  
 	 	 {  
 	 	 	 i f   (  
 	 	 	 	       C o p y L o w ( S y m b o l , P e r i o d , c I D , 1 , L )   >   - 1  
 	 	 	 	 & &   C o p y O p e n ( S y m b o l , P e r i o d , c I D , 1 , O )   >   - 1  
 	 	 	 	 & &   C o p y C l o s e ( S y m b o l , P e r i o d , c I D , 1 , C )   >   - 1  
 	 	 	 	 & &   C [ 0 ]   >   O [ 0 ]  
 	 	 	 )  
 	 	 	 {  
 	 	 	 	 r e t v a l   =   t o P i p s ( ( O [ 0 ] - L [ 0 ] ) , S y m b o l ) ;  
 	 	 	 }  
 	 	 }  
 	 	 e l s e   i f   ( i O H L C   = =   " i B e a r T o t a l " )  
 	 	 {  
 	 	 	 i f   (  
 	 	 	 	       C o p y O p e n ( S y m b o l , P e r i o d , c I D , 1 , O )   >   - 1  
 	 	 	 	 & &   C o p y C l o s e ( S y m b o l , P e r i o d , c I D , 1 , C )   >   - 1  
 	 	 	 	 & &   C o p y H i g h ( S y m b o l , P e r i o d , c I D , 1 , H )   >   - 1  
 	 	 	 	 & &   C o p y L o w ( S y m b o l , P e r i o d , c I D , 1 , L )   >   - 1  
 	 	 	 	 & &   C [ 0 ]   <   O [ 0 ]  
 	 	 	 )  
 	 	 	 {  
 	 	 	 	 r e t v a l   =   t o P i p s ( ( H [ 0 ] - L [ 0 ] ) , S y m b o l ) ;  
 	 	 	 }  
 	 	 }  
 	 	 e l s e   i f   ( i O H L C   = =   " i B e a r B o d y " )  
 	 	 {  
 	 	 	 i f   (  
 	 	 	 	       C o p y O p e n ( S y m b o l , P e r i o d , c I D , 1 , O )   >   - 1  
 	 	 	 	 & &   C o p y C l o s e ( S y m b o l , P e r i o d , c I D , 1 , C )   >   - 1  
 	 	 	 	 & &   C [ 0 ]   <   O [ 0 ]  
 	 	 	 )  
 	 	 	 {  
 	 	 	 	 r e t v a l   =   t o P i p s ( ( O [ 0 ] - C [ 0 ] ) , S y m b o l ) ;  
 	 	 	 }  
 	 	 }  
 	 	 e l s e   i f   ( i O H L C   = =   " i B e a r U p p e r W i c k " )  
 	 	 {  
 	 	 	 i f   (  
 	 	 	 	       C o p y H i g h ( S y m b o l , P e r i o d , c I D , 1 , H )   >   - 1  
 	 	 	 	 & &   C o p y O p e n ( S y m b o l , P e r i o d , c I D , 1 , O )   >   - 1  
 	 	 	 	 & &   C o p y C l o s e ( S y m b o l , P e r i o d , c I D , 1 , C )   >   - 1  
 	 	 	 	 & &   C [ 0 ]   <   O [ 0 ]  
 	 	 	 )  
 	 	 	 {  
 	 	 	 	 r e t v a l   =   t o P i p s ( ( H [ 0 ] - O [ 0 ] ) , S y m b o l ) ;  
 	 	 	 }  
 	 	 }  
 	 	 e l s e   i f   ( i O H L C   = =   " i B e a r B o t t o m W i c k " )  
 	 	 {  
 	 	 	 i f   (  
 	 	 	 	       C o p y L o w ( S y m b o l , P e r i o d , c I D , 1 , L )   >   - 1  
 	 	 	 	 & &   C o p y O p e n ( S y m b o l , P e r i o d , c I D , 1 , O )   >   - 1  
 	 	 	 	 & &   C o p y C l o s e ( S y m b o l , P e r i o d , c I D , 1 , C )   >   - 1  
 	 	 	 	 & &   C [ 0 ]   <   O [ 0 ]  
 	 	 	 )  
 	 	 	 {  
 	 	 	 	 r e t v a l   =   t o P i p s ( ( C [ 0 ] - L [ 0 ] ) , 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 ( r e t v a l ,   d i g i t s ) ;  
 	 }  
 } ;  
  
 / /   " A c c e l e r a t o r   O s c i l l a t o r "   m o d e l  
 c l a s s   M D L I C _ i n d i c a t o r s _ i A C  
 {  
 	 p u b l i c :   / *   I n p u t   P a r a m e t e r s   * /  
 	 s t r i n g   S y m b o l ;  
 	 E N U M _ T I M E F R A M E S   P e r i o d ;  
 	 i n t   S h i f t ;  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   r )   { r e t u r n ; }  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 M D L I C _ i n d i c a t o r s _ i A C ( )  
 	 {  
 	 	 S y m b o l   =   ( s t r i n g ) C u r r e n t S y m b o l ( ) ;  
 	 	 P e r i o d   =   ( E N U M _ T I M E F R A M E S ) C u r r e n t T i m e f r a m e ( ) ;  
 	 	 S h i f t   =   ( i n t ) 0 ;  
 	 }  
  
 	 p u b l i c :   / *   T h e   m a i n   m e t h o d   * /  
 	 d o u b l e   _ e x e c u t e _ ( )  
 	 {  
 	 	 r e t u r n   i A C ( S y m b o l ,   P e r i o d ,   S h i f t   +   F X D _ M O R E _ S H I F T ) ;  
 	 }  
 } ;  
  
 / /   " M y   I n d i c a t o r s "   m o d e l  
 c l a s s   M D L I C _ m y i n d i c a t o r s _ m y i n d i c a t o r s _ 5  
 {  
 	 p u b l i c :   / *   I n p u t   P a r a m e t e r s   * /  
 	 s t r i n g   S y m b o l ;  
 	 E N U M _ T I M E F R A M E S   P e r i o d ;  
 	 s t r i n g   M o d e O u t p u t ;  
 	 s t r i n g   T i m e S t a m p ;  
 	 i n t   V i s i b l e I D ;  
 	 i n t   V i s i b l e S h i f t ;  
 	 i n t   V i s i b l e L i m i t ;  
 	 i n t   R a n g e C a n d l e S t a r t ;  
 	 i n t   R a n g e C a n d l e E n d ;  
 	 s t r i n g   R a n g e T i m e S o u r c e ;  
 	 s t r i n g   R a n g e T i m e S t a r t ;  
 	 s t r i n g   R a n g e T i m e E n d ;  
 	 d o u b l e   R a n g e D a y O f f s e t ;  
 	 s t r i n g   R a n g e V a l u e ;  
 	 i n t   S h i f t ;  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   r )   { r e t u r n ; }  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 M D L I C _ m y i n d i c a t o r s _ m y i n d i c a t o r s _ 5 ( )  
 	 {  
 	 	 S y m b o l   =   ( s t r i n g ) C u r r e n t S y m b o l ( ) ;  
 	 	 P e r i o d   =   ( E N U M _ T I M E F R A M E S ) C u r r e n t T i m e f r a m e ( ) ;  
 	 	 M o d e O u t p u t   =   ( s t r i n g ) " i d " ;  
 	 	 T i m e S t a m p   =   ( s t r i n g ) " 0 0 : 0 0 " ;  
 	 	 V i s i b l e I D   =   ( i n t ) 0 ;  
 	 	 V i s i b l e S h i f t   =   ( i n t ) 0 ;  
 	 	 V i s i b l e L i m i t   =   ( i n t ) 1 0 0 ;  
 	 	 R a n g e C a n d l e S t a r t   =   ( i n t ) 0 ;  
 	 	 R a n g e C a n d l e E n d   =   ( i n t ) 1 0 ;  
 	 	 R a n g e T i m e S o u r c e   =   ( s t r i n g ) " s e r v e r " ;  
 	 	 R a n g e T i m e S t a r t   =   ( s t r i n g ) " 0 1 : 0 0 " ;  
 	 	 R a n g e T i m e E n d   =   ( s t r i n g ) " 0 8 : 0 0 " ;  
 	 	 R a n g e D a y O f f s e t   =   ( d o u b l e ) 0 . 0 ;  
 	 	 R a n g e V a l u e   =   ( s t r i n g ) " m a x " ;  
 	 	 S h i f t   =   ( i n t ) 0 ;  
 	 }  
  
 	 p u b l i c :   / *   T h e   m a i n   m e t h o d   * /  
 	 d o u b l e   _ e x e c u t e _ ( )  
 	 {  
 	 	 / / = =   M Q L 5   s p e c i f i c s   B E G I N   = = / /  
 	 	 / /   T h e   p r o b l e m   i s   t h a t   i C u s t o m ( )   a l w a y s   r e t u r n s   n e w   h a n d l e   w h e n   c a l l e d ,   r e g a r d l e s s   o f   t h e   i n p u t   p a r a m e t e r s .  
 	 	 i n t   h a n d l e   =   I N V A L I D _ H A N D L E ;  
 	 	  
 	 	 / /   t u r n   t h e   i n p u t   p a r a m e t e r s   i n t o   a   k e y  
 	 	 s t r i n g   k e y   =   " " ;  
 	 	 S t r i n g C o n c a t e n a t e ( k e y ,   S y m b o l ,   P e r i o d ,   " b u l l s b e a r s p o w e r "   ,   ( i n t ) 5 0 ,   ( E N U M _ M A _ M E T H O D ) M O D E _ E M A ,   ( E N U M _ A P P L I E D _ P R I C E ) P R I C E _ C L O S E ) ;  
 	 	  
 	 	 / /   f o r   o u r   p a r a m e t e r s ,   d o   w e   a l r e a d y   h a v e   a n   i n d i c a t o r   h a n d l e ?  
 	 	 i n t   a r r a y _ k e y   =   A r r a y S e a r c h ( F X D _ I C U S T O M _ H A N D L E S _ K E Y S ,   k e y ) ;  
 	 	  
 	 	 / /   i f   w e   d o n ' t   h a v e   a   h a n d l e ,   t h e n   c r e a t e   o n e  
 	 	 i f   ( a r r a y _ k e y   = =   - 1 )  
 	 	 {  
 	 	 	 h a n d l e   =   i C u s t o m ( S y m b o l ,   P e r i o d ,   " b u l l s b e a r s p o w e r "   ,   ( i n t ) 5 0 ,   ( E N U M _ M A _ M E T H O D ) M O D E _ E M A ,   ( E N U M _ A P P L I E D _ P R I C E ) P R I C E _ C L O S E ,   P R I C E _ C L O S E ) ;  
 	 	 	  
 	 	 	 i f   ( h a n d l e   = =   I N V A L I D _ H A N D L E )   {  
 	 	 	 	 r e t u r n   E M P T Y _ V A L U E ; 	  
 	 	 	 }  
 	 	 	  
 	 	 	 i n t   s i z e   =   A r r a y S i z e ( F X D _ I C U S T O M _ H A N D L E S _ K E Y S ) ;  
 	 	  
 	 	 	 A r r a y R e s i z e ( F X D _ I C U S T O M _ H A N D L E S _ K E Y S ,   s i z e + 1 ) ;  
 	 	 	 A r r a y R e s i z e ( F X D _ I C U S T O M _ H A N D L E S _ I D S ,   s i z e + 1 ) ;  
 	 	 	  
 	 	 	 F X D _ I C U S T O M _ H A N D L E S _ K E Y S [ s i z e ]   =   k e y ;  
 	 	 	 F X D _ I C U S T O M _ H A N D L E S _ I D S [ s i z e ]   =   h a n d l e ;  
 	 	 	  
 	 	 	 a r r a y _ k e y   =   s i z e ;  
 	 	 }  
 	 	 / /   y e s ,   w e   h a v e   a   h a n d l e ,   t h e n   g e t   i t  
 	 	 e l s e   {  
 	 	 	 h a n d l e   =   F X D _ I C U S T O M _ H A N D L E S _ I D S [ a r r a y _ k e y ] ;  
 	 	 }  
 	 	  
 	 	 / / = =   M Q L 5   s p e c i f i c s   E N D   = = / /  
 	 	  
 	 	 / / ! ! !   I   m u s t   d e f i n e   a l l   i n p u t   p r o p e r t i e s   h e r e ,   b e c a u s e   t h e y   a r e   n o t   a u t o m a t i c a l l y   d e f i n e d .  
 	 	 / /   T h i s   f u n c t i o n   i s   n o t   g l o b a l   p r o t o t y p e ,   o n e   n e w   f u n c t i o n   i s   c r e a t e d   f o r   e a c h   c a s e .   T h i s   i s   b e c a u s e   %   i C u s t o m   %   m u s t   b e   u n i q u e  
 	 	  
 	 	 s t r i n g   s y m b o l   =   S y m b o l ;  
 	 	 E N U M _ T I M E F R A M E S   t i m e f r a m e   =   P e r i o d ;  
 	 	 i n t   b u f f e r         =   0 ;  
 	 	 i n t   s h i f t           =   S h i f t   +   F X D _ M O R E _ S H I F T ;  
 	 	  
 	 	 d o u b l e   r e t v a l   =   E M P T Y _ V A L U E ;  
 	 	 i n t   i ;  
 	 	 d o u b l e   i v a l ;  
 	 	  
 	 	 i f   ( M o d e O u t p u t   = =   " i d " )  
 	 	 {  
 	 	 	 r e t v a l   =   f x d C u s t o m I n d i c a t o r ( h a n d l e ,   b u f f e r ,   s h i f t ) ;  
 	 	 }  
 	 	 e l s e   i f   ( M o d e O u t p u t   = =   " t i m e " )  
 	 	 {  
 	 	 	 d a t e t i m e   t i m e ;  
 	 	 	  
 	 	 	 i f   ( 0   & &   S t r i n g F i n d ( T i m e S t a m p ,   " : " )   = =   - 1 )  
 	 	 	 { 	  
 	 	 	 	 t i m e   =   ( d a t e t i m e ) S t r i n g T o I n t e g e r ( T i m e S t a m p ) ;   / /   h a n g s   i n   M Q L 4 ! ! !  
 	 	 	 }  
 	 	 	 e l s e  
 	 	 	 {  
 	 	 	 	 t i m e   =   S t r i n g T o T i m e ( T i m e S t a m p ) ;  
 	 	 	 }  
 	 	 	  
 	 	 	 s h i f t   =   i C a n d l e I D ( s y m b o l ,   t i m e f r a m e ,   t i m e ) ;  
 	 	 	 r e t v a l   =   f x d C u s t o m I n d i c a t o r ( h a n d l e ,   b u f f e r ,   s h i f t ) ;  
 	 	 }  
 	 	 e l s e   i f   ( M o d e O u t p u t   = =   " v i s i b l e "   | |   M o d e O u t p u t   = =   " i d _ b y _ v i s i b l e " )  
 	 	 {  
 	 	 	 i f   ( V i s i b l e L i m i t   = =   0 )   { V i s i b l e L i m i t   =   B a r s ( s y m b o l ,   t i m e f r a m e ) ; }  
 	 	 	  
 	 	 	 i n t   v i d   =   0 ;  
 	 	 	  
 	 	 	 f o r   ( i   =   s h i f t ;   i   < =   V i s i b l e L i m i t ;   i + + )  
 	 	 	 {  
 	 	 	 	 i v a l   =   f x d C u s t o m I n d i c a t o r ( h a n d l e ,   b u f f e r ,   s h i f t   +   i ) ;  
 	 	 	 	  
 	 	 	 	 i f   ( i v a l   = =   E M P T Y _ V A L U E   | |   i v a l   = =   0 )   { c o n t i n u e ; }  
 	 	 	 	 i f   ( v i d   > =   V i s i b l e I D )   {  
 	 	 	 	 	 i f   ( M o d e O u t p u t   = =   " v i s i b l e " )   { r e t v a l   =   i v a l ; }  
 	 	 	 	 	 e l s e   { r e t v a l   =   i ; }  
 	 	 	 	 	 b r e a k ; 	  
 	 	 	 	 }  
 	 	 	 	 	  
 	 	 	 	 v i d + + ;  
 	 	 	 }  
 	 	 }  
 	 	 e l s e   i f   ( M o d e O u t p u t   = =   " r a n g e " )  
 	 	 {  
 	 	 	 / /   r e v e r s e   v a l u e s ,   i f   n e e d e d  
 	 	 	 i f   ( R a n g e C a n d l e S t a r t   >   R a n g e C a n d l e E n d )   {  
 	 	 	 	 i n t   c t m p   =   R a n g e C a n d l e E n d ;  
 	 	 	 	 R a n g e C a n d l e E n d   =   R a n g e C a n d l e S t a r t ;  
 	 	 	 	 R a n g e C a n d l e S t a r t   =   c t m p ;  
 	 	 	 }  
 	 	  
 	 	 	 i f   ( R a n g e V a l u e   = =   " m a x " )  
 	 	 	 {  
 	 	 	 	 r e t v a l   =   - E M P T Y _ V A L U E ;  
 	 	 	 	  
 	 	 	 	 f o r   ( i   =   R a n g e C a n d l e S t a r t ;   i   < =   R a n g e C a n d l e E n d ;   i + + )  
 	 	 	 	 {  
 	 	 	 	 	 i v a l   =   f x d C u s t o m I n d i c a t o r ( h a n d l e ,   b u f f e r ,   s h i f t   +   i ) ;  
 	 	 	 	 	 i f   ( i v a l   = =   E M P T Y _ V A L U E   | |   i v a l   = =   0 )   { c o n t i n u e ; }  
 	 	 	 	 	 i f   ( i v a l   >   r e t v a l )   { r e t v a l   =   i v a l ; }  
 	 	 	 	 }  
 	 	 	 	  
 	 	 	 	 i f   ( r e t v a l   = =   - E M P T Y _ V A L U E )   { r e t v a l   =   E M P T Y _ V A L U E ; }  
 	 	 	 }  
 	 	 	 e l s e   i f   ( R a n g e V a l u e   = =   " m i n " )  
 	 	 	 {  
 	 	 	 	 r e t v a l   =   E M P T Y _ V A L U E ;  
 	 	 	 	  
 	 	 	 	 f o r   ( i   =   R a n g e C a n d l e S t a r t ;   i   < =   R a n g e C a n d l e E n d ;   i + + )  
 	 	 	 	 {  
 	 	 	 	 	 i v a l   =   f x d C u s t o m I n d i c a t o r ( h a n d l e ,   b u f f e r ,   s h i f t   +   i ) ;  
 	 	 	 	 	 i f   ( i v a l   = =   E M P T Y _ V A L U E   | |   i v a l   = =   0 )   { c o n t i n u e ; }  
 	 	 	 	 	 i f   ( i v a l   <   r e t v a l )   { r e t v a l   =   i v a l ; }  
 	 	 	 	 }  
 	 	 	 }  
 	 	 }  
 	 	 e l s e   i f   ( M o d e O u t p u t   = =   " r a n g e _ t i m e " )  
 	 	 {  
 	 	 	 d a t e t i m e   o f f s e t   =   0 ;  
 	 	 	 i f   ( R a n g e T i m e S o u r c e   = =   " g m t " )   { o f f s e t   =   ( i n t ) ( T i m e C u r r e n t ( )   -   T i m e L o c a l ( )   +   T i m e G M T O f f s e t ( ) ) ; }  
 	 	 	 e l s e   i f   ( R a n g e T i m e S o u r c e   = =   " s e r v e r " )   { o f f s e t   =   ( i n t ) ( T i m e C u r r e n t ( )   -   T i m e L o c a l ( ) ) ; }  
 	 	 	  
 	 	 	 d a t e t i m e   t i m e 1   =   S t r i n g T o T i m e ( R a n g e T i m e S t a r t ) - ( d a t e t i m e ) ( 8 6 4 0 0 * R a n g e D a y O f f s e t )   +   o f f s e t ;  
 	 	 	 d a t e t i m e   t i m e 2   =   S t r i n g T o T i m e ( R a n g e T i m e E n d ) - ( d a t e t i m e ) ( 8 6 4 0 0 * R a n g e D a y O f f s e t )   +   o f f s e t ;  
 	 	  
 	 	 	 i n t   x 1   =   i B a r S h i f t ( s y m b o l ,   t i m e f r a m e ,   t i m e 1 ,   f a l s e ) ;  
 	 	 	 i n t   x 2   =   i B a r S h i f t ( s y m b o l ,   t i m e f r a m e ,   t i m e 2 ,   f a l s e ) ;  
 	 	 	 i f   ( x 1 < x 2 )   { x 1 = i B a r S h i f t ( s y m b o l , t i m e f r a m e , ( t i m e 1 - 8 6 4 0 0 ) , f a l s e ) ; }  
 	 	 	  
 	 	 	 i f   ( R a n g e V a l u e   = =   " m a x " )  
 	 	 	 {  
 	 	 	 	 r e t v a l   =   - E M P T Y _ V A L U E ;  
 	 	 	 	  
 	 	 	 	 f o r   ( i = x 2 ;   i < = x 1 ;   i + + )  
 	 	 	 	 {  
 	 	 	 	 	 i v a l   =   f x d C u s t o m I n d i c a t o r ( h a n d l e ,   b u f f e r ,   s h i f t   +   i ) ;  
 	 	 	 	 	 i f   ( i v a l   = =   E M P T Y _ V A L U E   | |   i v a l   = =   0 )   { c o n t i n u e ; }  
 	 	 	 	 	 i f   ( i v a l   >   r e t v a l )   { r e t v a l   =   i v a l ; }  
 	 	 	 	 }  
 	 	 	 	  
 	 	 	 	 i f   ( r e t v a l   = =   - E M P T Y _ V A L U E )   { r e t v a l   =   E M P T Y _ V A L U E ; }  
 	 	 	 }  
 	 	 	 e l s e   i f   ( R a n g e V a l u e   = =   " m i n " )  
 	 	 	 {  
 	 	 	 	 r e t v a l   =   E M P T Y _ V A L U E ;  
 	 	 	 	  
 	 	 	 	 f o r   ( i = x 2 ;   i < = x 1 ;   i + + )  
 	 	 	 	 {  
 	 	 	 	 	 i v a l   =   f x d C u s t o m I n d i c a t o r ( h a n d l e ,   b u f f e r ,   s h i f t   +   i ) ;  
 	 	 	 	 	 i f   ( i v a l   = =   E M P T Y _ V A L U E   | |   i v a l   = =   0 )   { c o n t i n u e ; }  
 	 	 	 	 	 i f   ( i v a l   <   r e t v a l )   { r e t v a l   =   i v a l ; }  
 	 	 	 	 }  
 	 	 	 }  
 	 	 }  
 	 	  
 	 	 r e t u r n   ( r e t v a l ) ;  
 	 }  
 } ;  
  
 / /   " M y   I n d i c a t o r s "   m o d e l  
 c l a s s   M D L I C _ m y i n d i c a t o r s _ m y i n d i c a t o r s _ 6  
 {  
 	 p u b l i c :   / *   I n p u t   P a r a m e t e r s   * /  
 	 s t r i n g   S y m b o l ;  
 	 E N U M _ T I M E F R A M E S   P e r i o d ;  
 	 s t r i n g   M o d e O u t p u t ;  
 	 s t r i n g   T i m e S t a m p ;  
 	 i n t   V i s i b l e I D ;  
 	 i n t   V i s i b l e S h i f t ;  
 	 i n t   V i s i b l e L i m i t ;  
 	 i n t   R a n g e C a n d l e S t a r t ;  
 	 i n t   R a n g e C a n d l e E n d ;  
 	 s t r i n g   R a n g e T i m e S o u r c e ;  
 	 s t r i n g   R a n g e T i m e S t a r t ;  
 	 s t r i n g   R a n g e T i m e E n d ;  
 	 d o u b l e   R a n g e D a y O f f s e t ;  
 	 s t r i n g   R a n g e V a l u e ;  
 	 i n t   S h i f t ;  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   r )   { r e t u r n ; }  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 M D L I C _ m y i n d i c a t o r s _ m y i n d i c a t o r s _ 6 ( )  
 	 {  
 	 	 S y m b o l   =   ( s t r i n g ) C u r r e n t S y m b o l ( ) ;  
 	 	 P e r i o d   =   ( E N U M _ T I M E F R A M E S ) C u r r e n t T i m e f r a m e ( ) ;  
 	 	 M o d e O u t p u t   =   ( s t r i n g ) " i d " ;  
 	 	 T i m e S t a m p   =   ( s t r i n g ) " 0 0 : 0 0 " ;  
 	 	 V i s i b l e I D   =   ( i n t ) 0 ;  
 	 	 V i s i b l e S h i f t   =   ( i n t ) 0 ;  
 	 	 V i s i b l e L i m i t   =   ( i n t ) 1 0 0 ;  
 	 	 R a n g e C a n d l e S t a r t   =   ( i n t ) 0 ;  
 	 	 R a n g e C a n d l e E n d   =   ( i n t ) 1 0 ;  
 	 	 R a n g e T i m e S o u r c e   =   ( s t r i n g ) " s e r v e r " ;  
 	 	 R a n g e T i m e S t a r t   =   ( s t r i n g ) " 0 1 : 0 0 " ;  
 	 	 R a n g e T i m e E n d   =   ( s t r i n g ) " 0 8 : 0 0 " ;  
 	 	 R a n g e D a y O f f s e t   =   ( d o u b l e ) 0 . 0 ;  
 	 	 R a n g e V a l u e   =   ( s t r i n g ) " m a x " ;  
 	 	 S h i f t   =   ( i n t ) 0 ;  
 	 }  
  
 	 p u b l i c :   / *   T h e   m a i n   m e t h o d   * /  
 	 d o u b l e   _ e x e c u t e _ ( )  
 	 {  
 	 	 / / = =   M Q L 5   s p e c i f i c s   B E G I N   = = / /  
 	 	 / /   T h e   p r o b l e m   i s   t h a t   i C u s t o m ( )   a l w a y s   r e t u r n s   n e w   h a n d l e   w h e n   c a l l e d ,   r e g a r d l e s s   o f   t h e   i n p u t   p a r a m e t e r s .  
 	 	 i n t   h a n d l e   =   I N V A L I D _ H A N D L E ;  
 	 	  
 	 	 / /   t u r n   t h e   i n p u t   p a r a m e t e r s   i n t o   a   k e y  
 	 	 s t r i n g   k e y   =   " " ;  
 	 	 S t r i n g C o n c a t e n a t e ( k e y ,   S y m b o l ,   P e r i o d ,   " b u l l s b e a r s p o w e r "   ,   ( i n t ) 5 0 ,   ( E N U M _ M A _ M E T H O D ) M O D E _ E M A ,   ( E N U M _ A P P L I E D _ P R I C E ) P R I C E _ C L O S E ) ;  
 	 	  
 	 	 / /   f o r   o u r   p a r a m e t e r s ,   d o   w e   a l r e a d y   h a v e   a n   i n d i c a t o r   h a n d l e ?  
 	 	 i n t   a r r a y _ k e y   =   A r r a y S e a r c h ( F X D _ I C U S T O M _ H A N D L E S _ K E Y S ,   k e y ) ;  
 	 	  
 	 	 / /   i f   w e   d o n ' t   h a v e   a   h a n d l e ,   t h e n   c r e a t e   o n e  
 	 	 i f   ( a r r a y _ k e y   = =   - 1 )  
 	 	 {  
 	 	 	 h a n d l e   =   i C u s t o m ( S y m b o l ,   P e r i o d ,   " b u l l s b e a r s p o w e r "   ,   ( i n t ) 5 0 ,   ( E N U M _ M A _ M E T H O D ) M O D E _ E M A ,   ( E N U M _ A P P L I E D _ P R I C E ) P R I C E _ C L O S E ,   P R I C E _ C L O S E ) ;  
 	 	 	  
 	 	 	 i f   ( h a n d l e   = =   I N V A L I D _ H A N D L E )   {  
 	 	 	 	 r e t u r n   E M P T Y _ V A L U E ; 	  
 	 	 	 }  
 	 	 	  
 	 	 	 i n t   s i z e   =   A r r a y S i z e ( F X D _ I C U S T O M _ H A N D L E S _ K E Y S ) ;  
 	 	  
 	 	 	 A r r a y R e s i z e ( F X D _ I C U S T O M _ H A N D L E S _ K E Y S ,   s i z e + 1 ) ;  
 	 	 	 A r r a y R e s i z e ( F X D _ I C U S T O M _ H A N D L E S _ I D S ,   s i z e + 1 ) ;  
 	 	 	  
 	 	 	 F X D _ I C U S T O M _ H A N D L E S _ K E Y S [ s i z e ]   =   k e y ;  
 	 	 	 F X D _ I C U S T O M _ H A N D L E S _ I D S [ s i z e ]   =   h a n d l e ;  
 	 	 	  
 	 	 	 a r r a y _ k e y   =   s i z e ;  
 	 	 }  
 	 	 / /   y e s ,   w e   h a v e   a   h a n d l e ,   t h e n   g e t   i t  
 	 	 e l s e   {  
 	 	 	 h a n d l e   =   F X D _ I C U S T O M _ H A N D L E S _ I D S [ a r r a y _ k e y ] ;  
 	 	 }  
 	 	  
 	 	 / / = =   M Q L 5   s p e c i f i c s   E N D   = = / /  
 	 	  
 	 	 / / ! ! !   I   m u s t   d e f i n e   a l l   i n p u t   p r o p e r t i e s   h e r e ,   b e c a u s e   t h e y   a r e   n o t   a u t o m a t i c a l l y   d e f i n e d .  
 	 	 / /   T h i s   f u n c t i o n   i s   n o t   g l o b a l   p r o t o t y p e ,   o n e   n e w   f u n c t i o n   i s   c r e a t e d   f o r   e a c h   c a s e .   T h i s   i s   b e c a u s e   %   i C u s t o m   %   m u s t   b e   u n i q u e  
 	 	  
 	 	 s t r i n g   s y m b o l   =   S y m b o l ;  
 	 	 E N U M _ T I M E F R A M E S   t i m e f r a m e   =   P e r i o d ;  
 	 	 i n t   b u f f e r         =   0 ;  
 	 	 i n t   s h i f t           =   S h i f t   +   F X D _ M O R E _ S H I F T ;  
 	 	  
 	 	 d o u b l e   r e t v a l   =   E M P T Y _ V A L U E ;  
 	 	 i n t   i ;  
 	 	 d o u b l e   i v a l ;  
 	 	  
 	 	 i f   ( M o d e O u t p u t   = =   " i d " )  
 	 	 {  
 	 	 	 r e t v a l   =   f x d C u s t o m I n d i c a t o r ( h a n d l e ,   b u f f e r ,   s h i f t ) ;  
 	 	 }  
 	 	 e l s e   i f   ( M o d e O u t p u t   = =   " t i m e " )  
 	 	 {  
 	 	 	 d a t e t i m e   t i m e ;  
 	 	 	  
 	 	 	 i f   ( 0   & &   S t r i n g F i n d ( T i m e S t a m p ,   " : " )   = =   - 1 )  
 	 	 	 { 	  
 	 	 	 	 t i m e   =   ( d a t e t i m e ) S t r i n g T o I n t e g e r ( T i m e S t a m p ) ;   / /   h a n g s   i n   M Q L 4 ! ! !  
 	 	 	 }  
 	 	 	 e l s e  
 	 	 	 {  
 	 	 	 	 t i m e   =   S t r i n g T o T i m e ( T i m e S t a m p ) ;  
 	 	 	 }  
 	 	 	  
 	 	 	 s h i f t   =   i C a n d l e I D ( s y m b o l ,   t i m e f r a m e ,   t i m e ) ;  
 	 	 	 r e t v a l   =   f x d C u s t o m I n d i c a t o r ( h a n d l e ,   b u f f e r ,   s h i f t ) ;  
 	 	 }  
 	 	 e l s e   i f   ( M o d e O u t p u t   = =   " v i s i b l e "   | |   M o d e O u t p u t   = =   " i d _ b y _ v i s i b l e " )  
 	 	 {  
 	 	 	 i f   ( V i s i b l e L i m i t   = =   0 )   { V i s i b l e L i m i t   =   B a r s ( s y m b o l ,   t i m e f r a m e ) ; }  
 	 	 	  
 	 	 	 i n t   v i d   =   0 ;  
 	 	 	  
 	 	 	 f o r   ( i   =   s h i f t ;   i   < =   V i s i b l e L i m i t ;   i + + )  
 	 	 	 {  
 	 	 	 	 i v a l   =   f x d C u s t o m I n d i c a t o r ( h a n d l e ,   b u f f e r ,   s h i f t   +   i ) ;  
 	 	 	 	  
 	 	 	 	 i f   ( i v a l   = =   E M P T Y _ V A L U E   | |   i v a l   = =   0 )   { c o n t i n u e ; }  
 	 	 	 	 i f   ( v i d   > =   V i s i b l e I D )   {  
 	 	 	 	 	 i f   ( M o d e O u t p u t   = =   " v i s i b l e " )   { r e t v a l   =   i v a l ; }  
 	 	 	 	 	 e l s e   { r e t v a l   =   i ; }  
 	 	 	 	 	 b r e a k ; 	  
 	 	 	 	 }  
 	 	 	 	 	  
 	 	 	 	 v i d + + ;  
 	 	 	 }  
 	 	 }  
 	 	 e l s e   i f   ( M o d e O u t p u t   = =   " r a n g e " )  
 	 	 {  
 	 	 	 / /   r e v e r s e   v a l u e s ,   i f   n e e d e d  
 	 	 	 i f   ( R a n g e C a n d l e S t a r t   >   R a n g e C a n d l e E n d )   {  
 	 	 	 	 i n t   c t m p   =   R a n g e C a n d l e E n d ;  
 	 	 	 	 R a n g e C a n d l e E n d   =   R a n g e C a n d l e S t a r t ;  
 	 	 	 	 R a n g e C a n d l e S t a r t   =   c t m p ;  
 	 	 	 }  
 	 	  
 	 	 	 i f   ( R a n g e V a l u e   = =   " m a x " )  
 	 	 	 {  
 	 	 	 	 r e t v a l   =   - E M P T Y _ V A L U E ;  
 	 	 	 	  
 	 	 	 	 f o r   ( i   =   R a n g e C a n d l e S t a r t ;   i   < =   R a n g e C a n d l e E n d ;   i + + )  
 	 	 	 	 {  
 	 	 	 	 	 i v a l   =   f x d C u s t o m I n d i c a t o r ( h a n d l e ,   b u f f e r ,   s h i f t   +   i ) ;  
 	 	 	 	 	 i f   ( i v a l   = =   E M P T Y _ V A L U E   | |   i v a l   = =   0 )   { c o n t i n u e ; }  
 	 	 	 	 	 i f   ( i v a l   >   r e t v a l )   { r e t v a l   =   i v a l ; }  
 	 	 	 	 }  
 	 	 	 	  
 	 	 	 	 i f   ( r e t v a l   = =   - E M P T Y _ V A L U E )   { r e t v a l   =   E M P T Y _ V A L U E ; }  
 	 	 	 }  
 	 	 	 e l s e   i f   ( R a n g e V a l u e   = =   " m i n " )  
 	 	 	 {  
 	 	 	 	 r e t v a l   =   E M P T Y _ V A L U E ;  
 	 	 	 	  
 	 	 	 	 f o r   ( i   =   R a n g e C a n d l e S t a r t ;   i   < =   R a n g e C a n d l e E n d ;   i + + )  
 	 	 	 	 {  
 	 	 	 	 	 i v a l   =   f x d C u s t o m I n d i c a t o r ( h a n d l e ,   b u f f e r ,   s h i f t   +   i ) ;  
 	 	 	 	 	 i f   ( i v a l   = =   E M P T Y _ V A L U E   | |   i v a l   = =   0 )   { c o n t i n u e ; }  
 	 	 	 	 	 i f   ( i v a l   <   r e t v a l )   { r e t v a l   =   i v a l ; }  
 	 	 	 	 }  
 	 	 	 }  
 	 	 }  
 	 	 e l s e   i f   ( M o d e O u t p u t   = =   " r a n g e _ t i m e " )  
 	 	 {  
 	 	 	 d a t e t i m e   o f f s e t   =   0 ;  
 	 	 	 i f   ( R a n g e T i m e S o u r c e   = =   " g m t " )   { o f f s e t   =   ( i n t ) ( T i m e C u r r e n t ( )   -   T i m e L o c a l ( )   +   T i m e G M T O f f s e t ( ) ) ; }  
 	 	 	 e l s e   i f   ( R a n g e T i m e S o u r c e   = =   " s e r v e r " )   { o f f s e t   =   ( i n t ) ( T i m e C u r r e n t ( )   -   T i m e L o c a l ( ) ) ; }  
 	 	 	  
 	 	 	 d a t e t i m e   t i m e 1   =   S t r i n g T o T i m e ( R a n g e T i m e S t a r t ) - ( d a t e t i m e ) ( 8 6 4 0 0 * R a n g e D a y O f f s e t )   +   o f f s e t ;  
 	 	 	 d a t e t i m e   t i m e 2   =   S t r i n g T o T i m e ( R a n g e T i m e E n d ) - ( d a t e t i m e ) ( 8 6 4 0 0 * R a n g e D a y O f f s e t )   +   o f f s e t ;  
 	 	  
 	 	 	 i n t   x 1   =   i B a r S h i f t ( s y m b o l ,   t i m e f r a m e ,   t i m e 1 ,   f a l s e ) ;  
 	 	 	 i n t   x 2   =   i B a r S h i f t ( s y m b o l ,   t i m e f r a m e ,   t i m e 2 ,   f a l s e ) ;  
 	 	 	 i f   ( x 1 < x 2 )   { x 1 = i B a r S h i f t ( s y m b o l , t i m e f r a m e , ( t i m e 1 - 8 6 4 0 0 ) , f a l s e ) ; }  
 	 	 	  
 	 	 	 i f   ( R a n g e V a l u e   = =   " m a x " )  
 	 	 	 {  
 	 	 	 	 r e t v a l   =   - E M P T Y _ V A L U E ;  
 	 	 	 	  
 	 	 	 	 f o r   ( i = x 2 ;   i < = x 1 ;   i + + )  
 	 	 	 	 {  
 	 	 	 	 	 i v a l   =   f x d C u s t o m I n d i c a t o r ( h a n d l e ,   b u f f e r ,   s h i f t   +   i ) ;  
 	 	 	 	 	 i f   ( i v a l   = =   E M P T Y _ V A L U E   | |   i v a l   = =   0 )   { c o n t i n u e ; }  
 	 	 	 	 	 i f   ( i v a l   >   r e t v a l )   { r e t v a l   =   i v a l ; }  
 	 	 	 	 }  
 	 	 	 	  
 	 	 	 	 i f   ( r e t v a l   = =   - E M P T Y _ V A L U E )   { r e t v a l   =   E M P T Y _ V A L U E ; }  
 	 	 	 }  
 	 	 	 e l s e   i f   ( R a n g e V a l u e   = =   " m i n " )  
 	 	 	 {  
 	 	 	 	 r e t v a l   =   E M P T Y _ V A L U E ;  
 	 	 	 	  
 	 	 	 	 f o r   ( i = x 2 ;   i < = x 1 ;   i + + )  
 	 	 	 	 {  
 	 	 	 	 	 i v a l   =   f x d C u s t o m I n d i c a t o r ( h a n d l e ,   b u f f e r ,   s h i f t   +   i ) ;  
 	 	 	 	 	 i f   ( i v a l   = =   E M P T Y _ V A L U E   | |   i v a l   = =   0 )   { c o n t i n u e ; }  
 	 	 	 	 	 i f   ( i v a l   <   r e t v a l )   { r e t v a l   =   i v a l ; }  
 	 	 	 	 }  
 	 	 	 }  
 	 	 }  
 	 	  
 	 	 r e t u r n   ( r e t v a l ) ;  
 	 }  
 } ;  
  
 / /   " M o v i n g   A v e r a g e "   m o d e l  
 c l a s s   M D L I C _ i n d i c a t o r s _ i M A  
 {  
 	 p u b l i c :   / *   I n p u t   P a r a m e t e r s   * /  
 	 i n t   M A p e r i o d ;  
 	 i n t   M A s h i f t ;  
 	 E N U M _ M A _ M E T H O D   M A m e t h o d ;  
 	 E N U M _ A P P L I E D _ P R I C E   A p p l i e d P r i c e ;  
 	 s t r i n g   S y m b o l ;  
 	 E N U M _ T I M E F R A M E S   P e r i o d ;  
 	 i n t   S h i f t ;  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   r )   { r e t u r n ; }  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 M D L I C _ i n d i c a t o r s _ i M A ( )  
 	 {  
 	 	 M A p e r i o d   =   ( i n t ) 1 4 ;  
 	 	 M A s h i f t   =   ( i n t ) 0 ;  
 	 	 M A m e t h o d   =   ( E N U M _ M A _ M E T H O D ) M O D E _ S M A ;  
 	 	 A p p l i e d P r i c e   =   ( E N U M _ A P P L I E D _ P R I C E ) P R I C E _ C L O S E ;  
 	 	 S y m b o l   =   ( s t r i n g ) C u r r e n t S y m b o l ( ) ;  
 	 	 P e r i o d   =   ( E N U M _ T I M E F R A M E S ) C u r r e n t T i m e f r a m e ( ) ;  
 	 	 S h i f t   =   ( i n t ) 0 ;  
 	 }  
  
 	 p u b l i c :   / *   T h e   m a i n   m e t h o d   * /  
 	 d o u b l e   _ e x e c u t e _ ( )  
 	 {  
 	 	 r e t u r n   i M A ( S y m b o l ,   P e r i o d ,   M A p e r i o d ,   M A s h i f t ,   M A m e t h o d ,   A p p l i e d P r i c e ,   S h i f t   +   F X D _ M O R E _ S H I F T ) ;  
 	 }  
 } ;  
  
 / /   " M y   I n d i c a t o r s "   m o d e l  
 c l a s s   M D L I C _ m y i n d i c a t o r s _ m y i n d i c a t o r s _ 7  
 {  
 	 p u b l i c :   / *   I n p u t   P a r a m e t e r s   * /  
 	 s t r i n g   S y m b o l ;  
 	 E N U M _ T I M E F R A M E S   P e r i o d ;  
 	 s t r i n g   M o d e O u t p u t ;  
 	 s t r i n g   T i m e S t a m p ;  
 	 i n t   V i s i b l e I D ;  
 	 i n t   V i s i b l e S h i f t ;  
 	 i n t   V i s i b l e L i m i t ;  
 	 i n t   R a n g e C a n d l e S t a r t ;  
 	 i n t   R a n g e C a n d l e E n d ;  
 	 s t r i n g   R a n g e T i m e S o u r c e ;  
 	 s t r i n g   R a n g e T i m e S t a r t ;  
 	 s t r i n g   R a n g e T i m e E n d ;  
 	 d o u b l e   R a n g e D a y O f f s e t ;  
 	 s t r i n g   R a n g e V a l u e ;  
 	 i n t   S h i f t ;  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   r )   { r e t u r n ; }  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 M D L I C _ m y i n d i c a t o r s _ m y i n d i c a t o r s _ 7 ( )  
 	 {  
 	 	 S y m b o l   =   ( s t r i n g ) C u r r e n t S y m b o l ( ) ;  
 	 	 P e r i o d   =   ( E N U M _ T I M E F R A M E S ) C u r r e n t T i m e f r a m e ( ) ;  
 	 	 M o d e O u t p u t   =   ( s t r i n g ) " i d " ;  
 	 	 T i m e S t a m p   =   ( s t r i n g ) " 0 0 : 0 0 " ;  
 	 	 V i s i b l e I D   =   ( i n t ) 0 ;  
 	 	 V i s i b l e S h i f t   =   ( i n t ) 0 ;  
 	 	 V i s i b l e L i m i t   =   ( i n t ) 1 0 0 ;  
 	 	 R a n g e C a n d l e S t a r t   =   ( i n t ) 0 ;  
 	 	 R a n g e C a n d l e E n d   =   ( i n t ) 1 0 ;  
 	 	 R a n g e T i m e S o u r c e   =   ( s t r i n g ) " s e r v e r " ;  
 	 	 R a n g e T i m e S t a r t   =   ( s t r i n g ) " 0 1 : 0 0 " ;  
 	 	 R a n g e T i m e E n d   =   ( s t r i n g ) " 0 8 : 0 0 " ;  
 	 	 R a n g e D a y O f f s e t   =   ( d o u b l e ) 0 . 0 ;  
 	 	 R a n g e V a l u e   =   ( s t r i n g ) " m a x " ;  
 	 	 S h i f t   =   ( i n t ) 0 ;  
 	 }  
  
 	 p u b l i c :   / *   T h e   m a i n   m e t h o d   * /  
 	 d o u b l e   _ e x e c u t e _ ( )  
 	 {  
 	 	 / / = =   M Q L 5   s p e c i f i c s   B E G I N   = = / /  
 	 	 / /   T h e   p r o b l e m   i s   t h a t   i C u s t o m ( )   a l w a y s   r e t u r n s   n e w   h a n d l e   w h e n   c a l l e d ,   r e g a r d l e s s   o f   t h e   i n p u t   p a r a m e t e r s .  
 	 	 i n t   h a n d l e   =   I N V A L I D _ H A N D L E ;  
 	 	  
 	 	 / /   t u r n   t h e   i n p u t   p a r a m e t e r s   i n t o   a   k e y  
 	 	 s t r i n g   k e y   =   " " ;  
 	 	 S t r i n g C o n c a t e n a t e ( k e y ,   S y m b o l ,   P e r i o d ,   " b u l l s b e a r s p o w e r "   ,   ( i n t ) 5 0 ,   ( E N U M _ M A _ M E T H O D ) M O D E _ E M A ,   ( E N U M _ A P P L I E D _ P R I C E ) P R I C E _ C L O S E ) ;  
 	 	  
 	 	 / /   f o r   o u r   p a r a m e t e r s ,   d o   w e   a l r e a d y   h a v e   a n   i n d i c a t o r   h a n d l e ?  
 	 	 i n t   a r r a y _ k e y   =   A r r a y S e a r c h ( F X D _ I C U S T O M _ H A N D L E S _ K E Y S ,   k e y ) ;  
 	 	  
 	 	 / /   i f   w e   d o n ' t   h a v e   a   h a n d l e ,   t h e n   c r e a t e   o n e  
 	 	 i f   ( a r r a y _ k e y   = =   - 1 )  
 	 	 {  
 	 	 	 h a n d l e   =   i C u s t o m ( S y m b o l ,   P e r i o d ,   " b u l l s b e a r s p o w e r "   ,   ( i n t ) 5 0 ,   ( E N U M _ M A _ M E T H O D ) M O D E _ E M A ,   ( E N U M _ A P P L I E D _ P R I C E ) P R I C E _ C L O S E ,   P R I C E _ C L O S E ) ;  
 	 	 	  
 	 	 	 i f   ( h a n d l e   = =   I N V A L I D _ H A N D L E )   {  
 	 	 	 	 r e t u r n   E M P T Y _ V A L U E ; 	  
 	 	 	 }  
 	 	 	  
 	 	 	 i n t   s i z e   =   A r r a y S i z e ( F X D _ I C U S T O M _ H A N D L E S _ K E Y S ) ;  
 	 	  
 	 	 	 A r r a y R e s i z e ( F X D _ I C U S T O M _ H A N D L E S _ K E Y S ,   s i z e + 1 ) ;  
 	 	 	 A r r a y R e s i z e ( F X D _ I C U S T O M _ H A N D L E S _ I D S ,   s i z e + 1 ) ;  
 	 	 	  
 	 	 	 F X D _ I C U S T O M _ H A N D L E S _ K E Y S [ s i z e ]   =   k e y ;  
 	 	 	 F X D _ I C U S T O M _ H A N D L E S _ I D S [ s i z e ]   =   h a n d l e ;  
 	 	 	  
 	 	 	 a r r a y _ k e y   =   s i z e ;  
 	 	 }  
 	 	 / /   y e s ,   w e   h a v e   a   h a n d l e ,   t h e n   g e t   i t  
 	 	 e l s e   {  
 	 	 	 h a n d l e   =   F X D _ I C U S T O M _ H A N D L E S _ I D S [ a r r a y _ k e y ] ;  
 	 	 }  
 	 	  
 	 	 / / = =   M Q L 5   s p e c i f i c s   E N D   = = / /  
 	 	  
 	 	 / / ! ! !   I   m u s t   d e f i n e   a l l   i n p u t   p r o p e r t i e s   h e r e ,   b e c a u s e   t h e y   a r e   n o t   a u t o m a t i c a l l y   d e f i n e d .  
 	 	 / /   T h i s   f u n c t i o n   i s   n o t   g l o b a l   p r o t o t y p e ,   o n e   n e w   f u n c t i o n   i s   c r e a t e d   f o r   e a c h   c a s e .   T h i s   i s   b e c a u s e   %   i C u s t o m   %   m u s t   b e   u n i q u e  
 	 	  
 	 	 s t r i n g   s y m b o l   =   S y m b o l ;  
 	 	 E N U M _ T I M E F R A M E S   t i m e f r a m e   =   P e r i o d ;  
 	 	 i n t   b u f f e r         =   0 ;  
 	 	 i n t   s h i f t           =   S h i f t   +   F X D _ M O R E _ S H I F T ;  
 	 	  
 	 	 d o u b l e   r e t v a l   =   E M P T Y _ V A L U E ;  
 	 	 i n t   i ;  
 	 	 d o u b l e   i v a l ;  
 	 	  
 	 	 i f   ( M o d e O u t p u t   = =   " i d " )  
 	 	 {  
 	 	 	 r e t v a l   =   f x d C u s t o m I n d i c a t o r ( h a n d l e ,   b u f f e r ,   s h i f t ) ;  
 	 	 }  
 	 	 e l s e   i f   ( M o d e O u t p u t   = =   " t i m e " )  
 	 	 {  
 	 	 	 d a t e t i m e   t i m e ;  
 	 	 	  
 	 	 	 i f   ( 0   & &   S t r i n g F i n d ( T i m e S t a m p ,   " : " )   = =   - 1 )  
 	 	 	 { 	  
 	 	 	 	 t i m e   =   ( d a t e t i m e ) S t r i n g T o I n t e g e r ( T i m e S t a m p ) ;   / /   h a n g s   i n   M Q L 4 ! ! !  
 	 	 	 }  
 	 	 	 e l s e  
 	 	 	 {  
 	 	 	 	 t i m e   =   S t r i n g T o T i m e ( T i m e S t a m p ) ;  
 	 	 	 }  
 	 	 	  
 	 	 	 s h i f t   =   i C a n d l e I D ( s y m b o l ,   t i m e f r a m e ,   t i m e ) ;  
 	 	 	 r e t v a l   =   f x d C u s t o m I n d i c a t o r ( h a n d l e ,   b u f f e r ,   s h i f t ) ;  
 	 	 }  
 	 	 e l s e   i f   ( M o d e O u t p u t   = =   " v i s i b l e "   | |   M o d e O u t p u t   = =   " i d _ b y _ v i s i b l e " )  
 	 	 {  
 	 	 	 i f   ( V i s i b l e L i m i t   = =   0 )   { V i s i b l e L i m i t   =   B a r s ( s y m b o l ,   t i m e f r a m e ) ; }  
 	 	 	  
 	 	 	 i n t   v i d   =   0 ;  
 	 	 	  
 	 	 	 f o r   ( i   =   s h i f t ;   i   < =   V i s i b l e L i m i t ;   i + + )  
 	 	 	 {  
 	 	 	 	 i v a l   =   f x d C u s t o m I n d i c a t o r ( h a n d l e ,   b u f f e r ,   s h i f t   +   i ) ;  
 	 	 	 	  
 	 	 	 	 i f   ( i v a l   = =   E M P T Y _ V A L U E   | |   i v a l   = =   0 )   { c o n t i n u e ; }  
 	 	 	 	 i f   ( v i d   > =   V i s i b l e I D )   {  
 	 	 	 	 	 i f   ( M o d e O u t p u t   = =   " v i s i b l e " )   { r e t v a l   =   i v a l ; }  
 	 	 	 	 	 e l s e   { r e t v a l   =   i ; }  
 	 	 	 	 	 b r e a k ; 	  
 	 	 	 	 }  
 	 	 	 	 	  
 	 	 	 	 v i d + + ;  
 	 	 	 }  
 	 	 }  
 	 	 e l s e   i f   ( M o d e O u t p u t   = =   " r a n g e " )  
 	 	 {  
 	 	 	 / /   r e v e r s e   v a l u e s ,   i f   n e e d e d  
 	 	 	 i f   ( R a n g e C a n d l e S t a r t   >   R a n g e C a n d l e E n d )   {  
 	 	 	 	 i n t   c t m p   =   R a n g e C a n d l e E n d ;  
 	 	 	 	 R a n g e C a n d l e E n d   =   R a n g e C a n d l e S t a r t ;  
 	 	 	 	 R a n g e C a n d l e S t a r t   =   c t m p ;  
 	 	 	 }  
 	 	  
 	 	 	 i f   ( R a n g e V a l u e   = =   " m a x " )  
 	 	 	 {  
 	 	 	 	 r e t v a l   =   - E M P T Y _ V A L U E ;  
 	 	 	 	  
 	 	 	 	 f o r   ( i   =   R a n g e C a n d l e S t a r t ;   i   < =   R a n g e C a n d l e E n d ;   i + + )  
 	 	 	 	 {  
 	 	 	 	 	 i v a l   =   f x d C u s t o m I n d i c a t o r ( h a n d l e ,   b u f f e r ,   s h i f t   +   i ) ;  
 	 	 	 	 	 i f   ( i v a l   = =   E M P T Y _ V A L U E   | |   i v a l   = =   0 )   { c o n t i n u e ; }  
 	 	 	 	 	 i f   ( i v a l   >   r e t v a l )   { r e t v a l   =   i v a l ; }  
 	 	 	 	 }  
 	 	 	 	  
 	 	 	 	 i f   ( r e t v a l   = =   - E M P T Y _ V A L U E )   { r e t v a l   =   E M P T Y _ V A L U E ; }  
 	 	 	 }  
 	 	 	 e l s e   i f   ( R a n g e V a l u e   = =   " m i n " )  
 	 	 	 {  
 	 	 	 	 r e t v a l   =   E M P T Y _ V A L U E ;  
 	 	 	 	  
 	 	 	 	 f o r   ( i   =   R a n g e C a n d l e S t a r t ;   i   < =   R a n g e C a n d l e E n d ;   i + + )  
 	 	 	 	 {  
 	 	 	 	 	 i v a l   =   f x d C u s t o m I n d i c a t o r ( h a n d l e ,   b u f f e r ,   s h i f t   +   i ) ;  
 	 	 	 	 	 i f   ( i v a l   = =   E M P T Y _ V A L U E   | |   i v a l   = =   0 )   { c o n t i n u e ; }  
 	 	 	 	 	 i f   ( i v a l   <   r e t v a l )   { r e t v a l   =   i v a l ; }  
 	 	 	 	 }  
 	 	 	 }  
 	 	 }  
 	 	 e l s e   i f   ( M o d e O u t p u t   = =   " r a n g e _ t i m e " )  
 	 	 {  
 	 	 	 d a t e t i m e   o f f s e t   =   0 ;  
 	 	 	 i f   ( R a n g e T i m e S o u r c e   = =   " g m t " )   { o f f s e t   =   ( i n t ) ( T i m e C u r r e n t ( )   -   T i m e L o c a l ( )   +   T i m e G M T O f f s e t ( ) ) ; }  
 	 	 	 e l s e   i f   ( R a n g e T i m e S o u r c e   = =   " s e r v e r " )   { o f f s e t   =   ( i n t ) ( T i m e C u r r e n t ( )   -   T i m e L o c a l ( ) ) ; }  
 	 	 	  
 	 	 	 d a t e t i m e   t i m e 1   =   S t r i n g T o T i m e ( R a n g e T i m e S t a r t ) - ( d a t e t i m e ) ( 8 6 4 0 0 * R a n g e D a y O f f s e t )   +   o f f s e t ;  
 	 	 	 d a t e t i m e   t i m e 2   =   S t r i n g T o T i m e ( R a n g e T i m e E n d ) - ( d a t e t i m e ) ( 8 6 4 0 0 * R a n g e D a y O f f s e t )   +   o f f s e t ;  
 	 	  
 	 	 	 i n t   x 1   =   i B a r S h i f t ( s y m b o l ,   t i m e f r a m e ,   t i m e 1 ,   f a l s e ) ;  
 	 	 	 i n t   x 2   =   i B a r S h i f t ( s y m b o l ,   t i m e f r a m e ,   t i m e 2 ,   f a l s e ) ;  
 	 	 	 i f   ( x 1 < x 2 )   { x 1 = i B a r S h i f t ( s y m b o l , t i m e f r a m e , ( t i m e 1 - 8 6 4 0 0 ) , f a l s e ) ; }  
 	 	 	  
 	 	 	 i f   ( R a n g e V a l u e   = =   " m a x " )  
 	 	 	 {  
 	 	 	 	 r e t v a l   =   - E M P T Y _ V A L U E ;  
 	 	 	 	  
 	 	 	 	 f o r   ( i = x 2 ;   i < = x 1 ;   i + + )  
 	 	 	 	 {  
 	 	 	 	 	 i v a l   =   f x d C u s t o m I n d i c a t o r ( h a n d l e ,   b u f f e r ,   s h i f t   +   i ) ;  
 	 	 	 	 	 i f   ( i v a l   = =   E M P T Y _ V A L U E   | |   i v a l   = =   0 )   { c o n t i n u e ; }  
 	 	 	 	 	 i f   ( i v a l   >   r e t v a l )   { r e t v a l   =   i v a l ; }  
 	 	 	 	 }  
 	 	 	 	  
 	 	 	 	 i f   ( r e t v a l   = =   - E M P T Y _ V A L U E )   { r e t v a l   =   E M P T Y _ V A L U E ; }  
 	 	 	 }  
 	 	 	 e l s e   i f   ( R a n g e V a l u e   = =   " m i n " )  
 	 	 	 {  
 	 	 	 	 r e t v a l   =   E M P T Y _ V A L U E ;  
 	 	 	 	  
 	 	 	 	 f o r   ( i = x 2 ;   i < = x 1 ;   i + + )  
 	 	 	 	 {  
 	 	 	 	 	 i v a l   =   f x d C u s t o m I n d i c a t o r ( h a n d l e ,   b u f f e r ,   s h i f t   +   i ) ;  
 	 	 	 	 	 i f   ( i v a l   = =   E M P T Y _ V A L U E   | |   i v a l   = =   0 )   { c o n t i n u e ; }  
 	 	 	 	 	 i f   ( i v a l   <   r e t v a l )   { r e t v a l   =   i v a l ; }  
 	 	 	 	 }  
 	 	 	 }  
 	 	 }  
 	 	  
 	 	 r e t u r n   ( r e t v a l ) ;  
 	 }  
 } ;  
  
 / /   " M y   I n d i c a t o r s "   m o d e l  
 c l a s s   M D L I C _ m y i n d i c a t o r s _ m y i n d i c a t o r s _ 8  
 {  
 	 p u b l i c :   / *   I n p u t   P a r a m e t e r s   * /  
 	 s t r i n g   S y m b o l ;  
 	 E N U M _ T I M E F R A M E S   P e r i o d ;  
 	 s t r i n g   M o d e O u t p u t ;  
 	 s t r i n g   T i m e S t a m p ;  
 	 i n t   V i s i b l e I D ;  
 	 i n t   V i s i b l e S h i f t ;  
 	 i n t   V i s i b l e L i m i t ;  
 	 i n t   R a n g e C a n d l e S t a r t ;  
 	 i n t   R a n g e C a n d l e E n d ;  
 	 s t r i n g   R a n g e T i m e S o u r c e ;  
 	 s t r i n g   R a n g e T i m e S t a r t ;  
 	 s t r i n g   R a n g e T i m e E n d ;  
 	 d o u b l e   R a n g e D a y O f f s e t ;  
 	 s t r i n g   R a n g e V a l u e ;  
 	 i n t   S h i f t ;  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   r )   { r e t u r n ; }  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 M D L I C _ m y i n d i c a t o r s _ m y i n d i c a t o r s _ 8 ( )  
 	 {  
 	 	 S y m b o l   =   ( s t r i n g ) C u r r e n t S y m b o l ( ) ;  
 	 	 P e r i o d   =   ( E N U M _ T I M E F R A M E S ) C u r r e n t T i m e f r a m e ( ) ;  
 	 	 M o d e O u t p u t   =   ( s t r i n g ) " i d " ;  
 	 	 T i m e S t a m p   =   ( s t r i n g ) " 0 0 : 0 0 " ;  
 	 	 V i s i b l e I D   =   ( i n t ) 0 ;  
 	 	 V i s i b l e S h i f t   =   ( i n t ) 0 ;  
 	 	 V i s i b l e L i m i t   =   ( i n t ) 1 0 0 ;  
 	 	 R a n g e C a n d l e S t a r t   =   ( i n t ) 0 ;  
 	 	 R a n g e C a n d l e E n d   =   ( i n t ) 1 0 ;  
 	 	 R a n g e T i m e S o u r c e   =   ( s t r i n g ) " s e r v e r " ;  
 	 	 R a n g e T i m e S t a r t   =   ( s t r i n g ) " 0 1 : 0 0 " ;  
 	 	 R a n g e T i m e E n d   =   ( s t r i n g ) " 0 8 : 0 0 " ;  
 	 	 R a n g e D a y O f f s e t   =   ( d o u b l e ) 0 . 0 ;  
 	 	 R a n g e V a l u e   =   ( s t r i n g ) " m a x " ;  
 	 	 S h i f t   =   ( i n t ) 0 ;  
 	 }  
  
 	 p u b l i c :   / *   T h e   m a i n   m e t h o d   * /  
 	 d o u b l e   _ e x e c u t e _ ( )  
 	 {  
 	 	 / / = =   M Q L 5   s p e c i f i c s   B E G I N   = = / /  
 	 	 / /   T h e   p r o b l e m   i s   t h a t   i C u s t o m ( )   a l w a y s   r e t u r n s   n e w   h a n d l e   w h e n   c a l l e d ,   r e g a r d l e s s   o f   t h e   i n p u t   p a r a m e t e r s .  
 	 	 i n t   h a n d l e   =   I N V A L I D _ H A N D L E ;  
 	 	  
 	 	 / /   t u r n   t h e   i n p u t   p a r a m e t e r s   i n t o   a   k e y  
 	 	 s t r i n g   k e y   =   " " ;  
 	 	 S t r i n g C o n c a t e n a t e ( k e y ,   S y m b o l ,   P e r i o d ,   " b u l l s b e a r s p o w e r "   ,   ( i n t ) 5 0 ,   ( E N U M _ M A _ M E T H O D ) M O D E _ E M A ,   ( E N U M _ A P P L I E D _ P R I C E ) P R I C E _ C L O S E ) ;  
 	 	  
 	 	 / /   f o r   o u r   p a r a m e t e r s ,   d o   w e   a l r e a d y   h a v e   a n   i n d i c a t o r   h a n d l e ?  
 	 	 i n t   a r r a y _ k e y   =   A r r a y S e a r c h ( F X D _ I C U S T O M _ H A N D L E S _ K E Y S ,   k e y ) ;  
 	 	  
 	 	 / /   i f   w e   d o n ' t   h a v e   a   h a n d l e ,   t h e n   c r e a t e   o n e  
 	 	 i f   ( a r r a y _ k e y   = =   - 1 )  
 	 	 {  
 	 	 	 h a n d l e   =   i C u s t o m ( S y m b o l ,   P e r i o d ,   " b u l l s b e a r s p o w e r "   ,   ( i n t ) 5 0 ,   ( E N U M _ M A _ M E T H O D ) M O D E _ E M A ,   ( E N U M _ A P P L I E D _ P R I C E ) P R I C E _ C L O S E ,   P R I C E _ C L O S E ) ;  
 	 	 	  
 	 	 	 i f   ( h a n d l e   = =   I N V A L I D _ H A N D L E )   {  
 	 	 	 	 r e t u r n   E M P T Y _ V A L U E ; 	  
 	 	 	 }  
 	 	 	  
 	 	 	 i n t   s i z e   =   A r r a y S i z e ( F X D _ I C U S T O M _ H A N D L E S _ K E Y S ) ;  
 	 	  
 	 	 	 A r r a y R e s i z e ( F X D _ I C U S T O M _ H A N D L E S _ K E Y S ,   s i z e + 1 ) ;  
 	 	 	 A r r a y R e s i z e ( F X D _ I C U S T O M _ H A N D L E S _ I D S ,   s i z e + 1 ) ;  
 	 	 	  
 	 	 	 F X D _ I C U S T O M _ H A N D L E S _ K E Y S [ s i z e ]   =   k e y ;  
 	 	 	 F X D _ I C U S T O M _ H A N D L E S _ I D S [ s i z e ]   =   h a n d l e ;  
 	 	 	  
 	 	 	 a r r a y _ k e y   =   s i z e ;  
 	 	 }  
 	 	 / /   y e s ,   w e   h a v e   a   h a n d l e ,   t h e n   g e t   i t  
 	 	 e l s e   {  
 	 	 	 h a n d l e   =   F X D _ I C U S T O M _ H A N D L E S _ I D S [ a r r a y _ k e y ] ;  
 	 	 }  
 	 	  
 	 	 / / = =   M Q L 5   s p e c i f i c s   E N D   = = / /  
 	 	  
 	 	 / / ! ! !   I   m u s t   d e f i n e   a l l   i n p u t   p r o p e r t i e s   h e r e ,   b e c a u s e   t h e y   a r e   n o t   a u t o m a t i c a l l y   d e f i n e d .  
 	 	 / /   T h i s   f u n c t i o n   i s   n o t   g l o b a l   p r o t o t y p e ,   o n e   n e w   f u n c t i o n   i s   c r e a t e d   f o r   e a c h   c a s e .   T h i s   i s   b e c a u s e   %   i C u s t o m   %   m u s t   b e   u n i q u e  
 	 	  
 	 	 s t r i n g   s y m b o l   =   S y m b o l ;  
 	 	 E N U M _ T I M E F R A M E S   t i m e f r a m e   =   P e r i o d ;  
 	 	 i n t   b u f f e r         =   0 ;  
 	 	 i n t   s h i f t           =   S h i f t   +   F X D _ M O R E _ S H I F T ;  
 	 	  
 	 	 d o u b l e   r e t v a l   =   E M P T Y _ V A L U E ;  
 	 	 i n t   i ;  
 	 	 d o u b l e   i v a l ;  
 	 	  
 	 	 i f   ( M o d e O u t p u t   = =   " i d " )  
 	 	 {  
 	 	 	 r e t v a l   =   f x d C u s t o m I n d i c a t o r ( h a n d l e ,   b u f f e r ,   s h i f t ) ;  
 	 	 }  
 	 	 e l s e   i f   ( M o d e O u t p u t   = =   " t i m e " )  
 	 	 {  
 	 	 	 d a t e t i m e   t i m e ;  
 	 	 	  
 	 	 	 i f   ( 0   & &   S t r i n g F i n d ( T i m e S t a m p ,   " : " )   = =   - 1 )  
 	 	 	 { 	  
 	 	 	 	 t i m e   =   ( d a t e t i m e ) S t r i n g T o I n t e g e r ( T i m e S t a m p ) ;   / /   h a n g s   i n   M Q L 4 ! ! !  
 	 	 	 }  
 	 	 	 e l s e  
 	 	 	 {  
 	 	 	 	 t i m e   =   S t r i n g T o T i m e ( T i m e S t a m p ) ;  
 	 	 	 }  
 	 	 	  
 	 	 	 s h i f t   =   i C a n d l e I D ( s y m b o l ,   t i m e f r a m e ,   t i m e ) ;  
 	 	 	 r e t v a l   =   f x d C u s t o m I n d i c a t o r ( h a n d l e ,   b u f f e r ,   s h i f t ) ;  
 	 	 }  
 	 	 e l s e   i f   ( M o d e O u t p u t   = =   " v i s i b l e "   | |   M o d e O u t p u t   = =   " i d _ b y _ v i s i b l e " )  
 	 	 {  
 	 	 	 i f   ( V i s i b l e L i m i t   = =   0 )   { V i s i b l e L i m i t   =   B a r s ( s y m b o l ,   t i m e f r a m e ) ; }  
 	 	 	  
 	 	 	 i n t   v i d   =   0 ;  
 	 	 	  
 	 	 	 f o r   ( i   =   s h i f t ;   i   < =   V i s i b l e L i m i t ;   i + + )  
 	 	 	 {  
 	 	 	 	 i v a l   =   f x d C u s t o m I n d i c a t o r ( h a n d l e ,   b u f f e r ,   s h i f t   +   i ) ;  
 	 	 	 	  
 	 	 	 	 i f   ( i v a l   = =   E M P T Y _ V A L U E   | |   i v a l   = =   0 )   { c o n t i n u e ; }  
 	 	 	 	 i f   ( v i d   > =   V i s i b l e I D )   {  
 	 	 	 	 	 i f   ( M o d e O u t p u t   = =   " v i s i b l e " )   { r e t v a l   =   i v a l ; }  
 	 	 	 	 	 e l s e   { r e t v a l   =   i ; }  
 	 	 	 	 	 b r e a k ; 	  
 	 	 	 	 }  
 	 	 	 	 	  
 	 	 	 	 v i d + + ;  
 	 	 	 }  
 	 	 }  
 	 	 e l s e   i f   ( M o d e O u t p u t   = =   " r a n g e " )  
 	 	 {  
 	 	 	 / /   r e v e r s e   v a l u e s ,   i f   n e e d e d  
 	 	 	 i f   ( R a n g e C a n d l e S t a r t   >   R a n g e C a n d l e E n d )   {  
 	 	 	 	 i n t   c t m p   =   R a n g e C a n d l e E n d ;  
 	 	 	 	 R a n g e C a n d l e E n d   =   R a n g e C a n d l e S t a r t ;  
 	 	 	 	 R a n g e C a n d l e S t a r t   =   c t m p ;  
 	 	 	 }  
 	 	  
 	 	 	 i f   ( R a n g e V a l u e   = =   " m a x " )  
 	 	 	 {  
 	 	 	 	 r e t v a l   =   - E M P T Y _ V A L U E ;  
 	 	 	 	  
 	 	 	 	 f o r   ( i   =   R a n g e C a n d l e S t a r t ;   i   < =   R a n g e C a n d l e E n d ;   i + + )  
 	 	 	 	 {  
 	 	 	 	 	 i v a l   =   f x d C u s t o m I n d i c a t o r ( h a n d l e ,   b u f f e r ,   s h i f t   +   i ) ;  
 	 	 	 	 	 i f   ( i v a l   = =   E M P T Y _ V A L U E   | |   i v a l   = =   0 )   { c o n t i n u e ; }  
 	 	 	 	 	 i f   ( i v a l   >   r e t v a l )   { r e t v a l   =   i v a l ; }  
 	 	 	 	 }  
 	 	 	 	  
 	 	 	 	 i f   ( r e t v a l   = =   - E M P T Y _ V A L U E )   { r e t v a l   =   E M P T Y _ V A L U E ; }  
 	 	 	 }  
 	 	 	 e l s e   i f   ( R a n g e V a l u e   = =   " m i n " )  
 	 	 	 {  
 	 	 	 	 r e t v a l   =   E M P T Y _ V A L U E ;  
 	 	 	 	  
 	 	 	 	 f o r   ( i   =   R a n g e C a n d l e S t a r t ;   i   < =   R a n g e C a n d l e E n d ;   i + + )  
 	 	 	 	 {  
 	 	 	 	 	 i v a l   =   f x d C u s t o m I n d i c a t o r ( h a n d l e ,   b u f f e r ,   s h i f t   +   i ) ;  
 	 	 	 	 	 i f   ( i v a l   = =   E M P T Y _ V A L U E   | |   i v a l   = =   0 )   { c o n t i n u e ; }  
 	 	 	 	 	 i f   ( i v a l   <   r e t v a l )   { r e t v a l   =   i v a l ; }  
 	 	 	 	 }  
 	 	 	 }  
 	 	 }  
 	 	 e l s e   i f   ( M o d e O u t p u t   = =   " r a n g e _ t i m e " )  
 	 	 {  
 	 	 	 d a t e t i m e   o f f s e t   =   0 ;  
 	 	 	 i f   ( R a n g e T i m e S o u r c e   = =   " g m t " )   { o f f s e t   =   ( i n t ) ( T i m e C u r r e n t ( )   -   T i m e L o c a l ( )   +   T i m e G M T O f f s e t ( ) ) ; }  
 	 	 	 e l s e   i f   ( R a n g e T i m e S o u r c e   = =   " s e r v e r " )   { o f f s e t   =   ( i n t ) ( T i m e C u r r e n t ( )   -   T i m e L o c a l ( ) ) ; }  
 	 	 	  
 	 	 	 d a t e t i m e   t i m e 1   =   S t r i n g T o T i m e ( R a n g e T i m e S t a r t ) - ( d a t e t i m e ) ( 8 6 4 0 0 * R a n g e D a y O f f s e t )   +   o f f s e t ;  
 	 	 	 d a t e t i m e   t i m e 2   =   S t r i n g T o T i m e ( R a n g e T i m e E n d ) - ( d a t e t i m e ) ( 8 6 4 0 0 * R a n g e D a y O f f s e t )   +   o f f s e t ;  
 	 	  
 	 	 	 i n t   x 1   =   i B a r S h i f t ( s y m b o l ,   t i m e f r a m e ,   t i m e 1 ,   f a l s e ) ;  
 	 	 	 i n t   x 2   =   i B a r S h i f t ( s y m b o l ,   t i m e f r a m e ,   t i m e 2 ,   f a l s e ) ;  
 	 	 	 i f   ( x 1 < x 2 )   { x 1 = i B a r S h i f t ( s y m b o l , t i m e f r a m e , ( t i m e 1 - 8 6 4 0 0 ) , f a l s e ) ; }  
 	 	 	  
 	 	 	 i f   ( R a n g e V a l u e   = =   " m a x " )  
 	 	 	 {  
 	 	 	 	 r e t v a l   =   - E M P T Y _ V A L U E ;  
 	 	 	 	  
 	 	 	 	 f o r   ( i = x 2 ;   i < = x 1 ;   i + + )  
 	 	 	 	 {  
 	 	 	 	 	 i v a l   =   f x d C u s t o m I n d i c a t o r ( h a n d l e ,   b u f f e r ,   s h i f t   +   i ) ;  
 	 	 	 	 	 i f   ( i v a l   = =   E M P T Y _ V A L U E   | |   i v a l   = =   0 )   { c o n t i n u e ; }  
 	 	 	 	 	 i f   ( i v a l   >   r e t v a l )   { r e t v a l   =   i v a l ; }  
 	 	 	 	 }  
 	 	 	 	  
 	 	 	 	 i f   ( r e t v a l   = =   - E M P T Y _ V A L U E )   { r e t v a l   =   E M P T Y _ V A L U E ; }  
 	 	 	 }  
 	 	 	 e l s e   i f   ( R a n g e V a l u e   = =   " m i n " )  
 	 	 	 {  
 	 	 	 	 r e t v a l   =   E M P T Y _ V A L U E ;  
 	 	 	 	  
 	 	 	 	 f o r   ( i = x 2 ;   i < = x 1 ;   i + + )  
 	 	 	 	 {  
 	 	 	 	 	 i v a l   =   f x d C u s t o m I n d i c a t o r ( h a n d l e ,   b u f f e r ,   s h i f t   +   i ) ;  
 	 	 	 	 	 i f   ( i v a l   = =   E M P T Y _ V A L U E   | |   i v a l   = =   0 )   { c o n t i n u e ; }  
 	 	 	 	 	 i f   ( i v a l   <   r e t v a l )   { r e t v a l   =   i v a l ; }  
 	 	 	 	 }  
 	 	 	 }  
 	 	 }  
 	 	  
 	 	 r e t u r n   ( r e t v a l ) ;  
 	 }  
 } ;  
  
 / /   " M y   I n d i c a t o r s "   m o d e l  
 c l a s s   M D L I C _ m y i n d i c a t o r s _ m y i n d i c a t o r s _ 9  
 {  
 	 p u b l i c :   / *   I n p u t   P a r a m e t e r s   * /  
 	 s t r i n g   S y m b o l ;  
 	 E N U M _ T I M E F R A M E S   P e r i o d ;  
 	 s t r i n g   M o d e O u t p u t ;  
 	 s t r i n g   T i m e S t a m p ;  
 	 i n t   V i s i b l e I D ;  
 	 i n t   V i s i b l e S h i f t ;  
 	 i n t   V i s i b l e L i m i t ;  
 	 i n t   R a n g e C a n d l e S t a r t ;  
 	 i n t   R a n g e C a n d l e E n d ;  
 	 s t r i n g   R a n g e T i m e S o u r c e ;  
 	 s t r i n g   R a n g e T i m e S t a r t ;  
 	 s t r i n g   R a n g e T i m e E n d ;  
 	 d o u b l e   R a n g e D a y O f f s e t ;  
 	 s t r i n g   R a n g e V a l u e ;  
 	 i n t   S h i f t ;  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   r )   { r e t u r n ; }  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 M D L I C _ m y i n d i c a t o r s _ m y i n d i c a t o r s _ 9 ( )  
 	 {  
 	 	 S y m b o l   =   ( s t r i n g ) C u r r e n t S y m b o l ( ) ;  
 	 	 P e r i o d   =   ( E N U M _ T I M E F R A M E S ) C u r r e n t T i m e f r a m e ( ) ;  
 	 	 M o d e O u t p u t   =   ( s t r i n g ) " i d " ;  
 	 	 T i m e S t a m p   =   ( s t r i n g ) " 0 0 : 0 0 " ;  
 	 	 V i s i b l e I D   =   ( i n t ) 0 ;  
 	 	 V i s i b l e S h i f t   =   ( i n t ) 0 ;  
 	 	 V i s i b l e L i m i t   =   ( i n t ) 1 0 0 ;  
 	 	 R a n g e C a n d l e S t a r t   =   ( i n t ) 0 ;  
 	 	 R a n g e C a n d l e E n d   =   ( i n t ) 1 0 ;  
 	 	 R a n g e T i m e S o u r c e   =   ( s t r i n g ) " s e r v e r " ;  
 	 	 R a n g e T i m e S t a r t   =   ( s t r i n g ) " 0 1 : 0 0 " ;  
 	 	 R a n g e T i m e E n d   =   ( s t r i n g ) " 0 8 : 0 0 " ;  
 	 	 R a n g e D a y O f f s e t   =   ( d o u b l e ) 0 . 0 ;  
 	 	 R a n g e V a l u e   =   ( s t r i n g ) " m a x " ;  
 	 	 S h i f t   =   ( i n t ) 0 ;  
 	 }  
  
 	 p u b l i c :   / *   T h e   m a i n   m e t h o d   * /  
 	 d o u b l e   _ e x e c u t e _ ( )  
 	 {  
 	 	 / / = =   M Q L 5   s p e c i f i c s   B E G I N   = = / /  
 	 	 / /   T h e   p r o b l e m   i s   t h a t   i C u s t o m ( )   a l w a y s   r e t u r n s   n e w   h a n d l e   w h e n   c a l l e d ,   r e g a r d l e s s   o f   t h e   i n p u t   p a r a m e t e r s .  
 	 	 i n t   h a n d l e   =   I N V A L I D _ H A N D L E ;  
 	 	  
 	 	 / /   t u r n   t h e   i n p u t   p a r a m e t e r s   i n t o   a   k e y  
 	 	 s t r i n g   k e y   =   " " ;  
 	 	 S t r i n g C o n c a t e n a t e ( k e y ,   S y m b o l ,   P e r i o d ,   " T I I "   ,   ( u i n t ) 2 0 ,   ( u i n t ) 3 0 ,   ( E N U M _ M A _ M E T H O D ) M O D E _ S M A ,   ( E N U M _ A P P L I E D _ P R I C E ) P R I C E _ C L O S E ,   ( d o u b l e ) 8 0 . 0 ,   ( d o u b l e ) 2 0 . 0 ) ;  
 	 	  
 	 	 / /   f o r   o u r   p a r a m e t e r s ,   d o   w e   a l r e a d y   h a v e   a n   i n d i c a t o r   h a n d l e ?  
 	 	 i n t   a r r a y _ k e y   =   A r r a y S e a r c h ( F X D _ I C U S T O M _ H A N D L E S _ K E Y S ,   k e y ) ;  
 	 	  
 	 	 / /   i f   w e   d o n ' t   h a v e   a   h a n d l e ,   t h e n   c r e a t e   o n e  
 	 	 i f   ( a r r a y _ k e y   = =   - 1 )  
 	 	 {  
 	 	 	 h a n d l e   =   i C u s t o m ( S y m b o l ,   P e r i o d ,   " T I I "   ,   ( u i n t ) 2 0 ,   ( u i n t ) 3 0 ,   ( E N U M _ M A _ M E T H O D ) M O D E _ S M A ,   ( E N U M _ A P P L I E D _ P R I C E ) P R I C E _ C L O S E ,   ( d o u b l e ) 8 0 . 0 ,   ( d o u b l e ) 2 0 . 0 ,   P R I C E _ C L O S E ) ;  
 	 	 	  
 	 	 	 i f   ( h a n d l e   = =   I N V A L I D _ H A N D L E )   {  
 	 	 	 	 r e t u r n   E M P T Y _ V A L U E ; 	  
 	 	 	 }  
 	 	 	  
 	 	 	 i n t   s i z e   =   A r r a y S i z e ( F X D _ I C U S T O M _ H A N D L E S _ K E Y S ) ;  
 	 	  
 	 	 	 A r r a y R e s i z e ( F X D _ I C U S T O M _ H A N D L E S _ K E Y S ,   s i z e + 1 ) ;  
 	 	 	 A r r a y R e s i z e ( F X D _ I C U S T O M _ H A N D L E S _ I D S ,   s i z e + 1 ) ;  
 	 	 	  
 	 	 	 F X D _ I C U S T O M _ H A N D L E S _ K E Y S [ s i z e ]   =   k e y ;  
 	 	 	 F X D _ I C U S T O M _ H A N D L E S _ I D S [ s i z e ]   =   h a n d l e ;  
 	 	 	  
 	 	 	 a r r a y _ k e y   =   s i z e ;  
 	 	 }  
 	 	 / /   y e s ,   w e   h a v e   a   h a n d l e ,   t h e n   g e t   i t  
 	 	 e l s e   {  
 	 	 	 h a n d l e   =   F X D _ I C U S T O M _ H A N D L E S _ I D S [ a r r a y _ k e y ] ;  
 	 	 }  
 	 	  
 	 	 / / = =   M Q L 5   s p e c i f i c s   E N D   = = / /  
 	 	  
 	 	 / / ! ! !   I   m u s t   d e f i n e   a l l   i n p u t   p r o p e r t i e s   h e r e ,   b e c a u s e   t h e y   a r e   n o t   a u t o m a t i c a l l y   d e f i n e d .  
 	 	 / /   T h i s   f u n c t i o n   i s   n o t   g l o b a l   p r o t o t y p e ,   o n e   n e w   f u n c t i o n   i s   c r e a t e d   f o r   e a c h   c a s e .   T h i s   i s   b e c a u s e   %   i C u s t o m   %   m u s t   b e   u n i q u e  
 	 	  
 	 	 s t r i n g   s y m b o l   =   S y m b o l ;  
 	 	 E N U M _ T I M E F R A M E S   t i m e f r a m e   =   P e r i o d ;  
 	 	 i n t   b u f f e r         =   0 ;  
 	 	 i n t   s h i f t           =   S h i f t   +   F X D _ M O R E _ S H I F T ;  
 	 	  
 	 	 d o u b l e   r e t v a l   =   E M P T Y _ V A L U E ;  
 	 	 i n t   i ;  
 	 	 d o u b l e   i v a l ;  
 	 	  
 	 	 i f   ( M o d e O u t p u t   = =   " i d " )  
 	 	 {  
 	 	 	 r e t v a l   =   f x d C u s t o m I n d i c a t o r ( h a n d l e ,   b u f f e r ,   s h i f t ) ;  
 	 	 }  
 	 	 e l s e   i f   ( M o d e O u t p u t   = =   " t i m e " )  
 	 	 {  
 	 	 	 d a t e t i m e   t i m e ;  
 	 	 	  
 	 	 	 i f   ( 0   & &   S t r i n g F i n d ( T i m e S t a m p ,   " : " )   = =   - 1 )  
 	 	 	 { 	  
 	 	 	 	 t i m e   =   ( d a t e t i m e ) S t r i n g T o I n t e g e r ( T i m e S t a m p ) ;   / /   h a n g s   i n   M Q L 4 ! ! !  
 	 	 	 }  
 	 	 	 e l s e  
 	 	 	 {  
 	 	 	 	 t i m e   =   S t r i n g T o T i m e ( T i m e S t a m p ) ;  
 	 	 	 }  
 	 	 	  
 	 	 	 s h i f t   =   i C a n d l e I D ( s y m b o l ,   t i m e f r a m e ,   t i m e ) ;  
 	 	 	 r e t v a l   =   f x d C u s t o m I n d i c a t o r ( h a n d l e ,   b u f f e r ,   s h i f t ) ;  
 	 	 }  
 	 	 e l s e   i f   ( M o d e O u t p u t   = =   " v i s i b l e "   | |   M o d e O u t p u t   = =   " i d _ b y _ v i s i b l e " )  
 	 	 {  
 	 	 	 i f   ( V i s i b l e L i m i t   = =   0 )   { V i s i b l e L i m i t   =   B a r s ( s y m b o l ,   t i m e f r a m e ) ; }  
 	 	 	  
 	 	 	 i n t   v i d   =   0 ;  
 	 	 	  
 	 	 	 f o r   ( i   =   s h i f t ;   i   < =   V i s i b l e L i m i t ;   i + + )  
 	 	 	 {  
 	 	 	 	 i v a l   =   f x d C u s t o m I n d i c a t o r ( h a n d l e ,   b u f f e r ,   s h i f t   +   i ) ;  
 	 	 	 	  
 	 	 	 	 i f   ( i v a l   = =   E M P T Y _ V A L U E   | |   i v a l   = =   0 )   { c o n t i n u e ; }  
 	 	 	 	 i f   ( v i d   > =   V i s i b l e I D )   {  
 	 	 	 	 	 i f   ( M o d e O u t p u t   = =   " v i s i b l e " )   { r e t v a l   =   i v a l ; }  
 	 	 	 	 	 e l s e   { r e t v a l   =   i ; }  
 	 	 	 	 	 b r e a k ; 	  
 	 	 	 	 }  
 	 	 	 	 	  
 	 	 	 	 v i d + + ;  
 	 	 	 }  
 	 	 }  
 	 	 e l s e   i f   ( M o d e O u t p u t   = =   " r a n g e " )  
 	 	 {  
 	 	 	 / /   r e v e r s e   v a l u e s ,   i f   n e e d e d  
 	 	 	 i f   ( R a n g e C a n d l e S t a r t   >   R a n g e C a n d l e E n d )   {  
 	 	 	 	 i n t   c t m p   =   R a n g e C a n d l e E n d ;  
 	 	 	 	 R a n g e C a n d l e E n d   =   R a n g e C a n d l e S t a r t ;  
 	 	 	 	 R a n g e C a n d l e S t a r t   =   c t m p ;  
 	 	 	 }  
 	 	  
 	 	 	 i f   ( R a n g e V a l u e   = =   " m a x " )  
 	 	 	 {  
 	 	 	 	 r e t v a l   =   - E M P T Y _ V A L U E ;  
 	 	 	 	  
 	 	 	 	 f o r   ( i   =   R a n g e C a n d l e S t a r t ;   i   < =   R a n g e C a n d l e E n d ;   i + + )  
 	 	 	 	 {  
 	 	 	 	 	 i v a l   =   f x d C u s t o m I n d i c a t o r ( h a n d l e ,   b u f f e r ,   s h i f t   +   i ) ;  
 	 	 	 	 	 i f   ( i v a l   = =   E M P T Y _ V A L U E   | |   i v a l   = =   0 )   { c o n t i n u e ; }  
 	 	 	 	 	 i f   ( i v a l   >   r e t v a l )   { r e t v a l   =   i v a l ; }  
 	 	 	 	 }  
 	 	 	 	  
 	 	 	 	 i f   ( r e t v a l   = =   - E M P T Y _ V A L U E )   { r e t v a l   =   E M P T Y _ V A L U E ; }  
 	 	 	 }  
 	 	 	 e l s e   i f   ( R a n g e V a l u e   = =   " m i n " )  
 	 	 	 {  
 	 	 	 	 r e t v a l   =   E M P T Y _ V A L U E ;  
 	 	 	 	  
 	 	 	 	 f o r   ( i   =   R a n g e C a n d l e S t a r t ;   i   < =   R a n g e C a n d l e E n d ;   i + + )  
 	 	 	 	 {  
 	 	 	 	 	 i v a l   =   f x d C u s t o m I n d i c a t o r ( h a n d l e ,   b u f f e r ,   s h i f t   +   i ) ;  
 	 	 	 	 	 i f   ( i v a l   = =   E M P T Y _ V A L U E   | |   i v a l   = =   0 )   { c o n t i n u e ; }  
 	 	 	 	 	 i f   ( i v a l   <   r e t v a l )   { r e t v a l   =   i v a l ; }  
 	 	 	 	 }  
 	 	 	 }  
 	 	 }  
 	 	 e l s e   i f   ( M o d e O u t p u t   = =   " r a n g e _ t i m e " )  
 	 	 {  
 	 	 	 d a t e t i m e   o f f s e t   =   0 ;  
 	 	 	 i f   ( R a n g e T i m e S o u r c e   = =   " g m t " )   { o f f s e t   =   ( i n t ) ( T i m e C u r r e n t ( )   -   T i m e L o c a l ( )   +   T i m e G M T O f f s e t ( ) ) ; }  
 	 	 	 e l s e   i f   ( R a n g e T i m e S o u r c e   = =   " s e r v e r " )   { o f f s e t   =   ( i n t ) ( T i m e C u r r e n t ( )   -   T i m e L o c a l ( ) ) ; }  
 	 	 	  
 	 	 	 d a t e t i m e   t i m e 1   =   S t r i n g T o T i m e ( R a n g e T i m e S t a r t ) - ( d a t e t i m e ) ( 8 6 4 0 0 * R a n g e D a y O f f s e t )   +   o f f s e t ;  
 	 	 	 d a t e t i m e   t i m e 2   =   S t r i n g T o T i m e ( R a n g e T i m e E n d ) - ( d a t e t i m e ) ( 8 6 4 0 0 * R a n g e D a y O f f s e t )   +   o f f s e t ;  
 	 	  
 	 	 	 i n t   x 1   =   i B a r S h i f t ( s y m b o l ,   t i m e f r a m e ,   t i m e 1 ,   f a l s e ) ;  
 	 	 	 i n t   x 2   =   i B a r S h i f t ( s y m b o l ,   t i m e f r a m e ,   t i m e 2 ,   f a l s e ) ;  
 	 	 	 i f   ( x 1 < x 2 )   { x 1 = i B a r S h i f t ( s y m b o l , t i m e f r a m e , ( t i m e 1 - 8 6 4 0 0 ) , f a l s e ) ; }  
 	 	 	  
 	 	 	 i f   ( R a n g e V a l u e   = =   " m a x " )  
 	 	 	 {  
 	 	 	 	 r e t v a l   =   - E M P T Y _ V A L U E ;  
 	 	 	 	  
 	 	 	 	 f o r   ( i = x 2 ;   i < = x 1 ;   i + + )  
 	 	 	 	 {  
 	 	 	 	 	 i v a l   =   f x d C u s t o m I n d i c a t o r ( h a n d l e ,   b u f f e r ,   s h i f t   +   i ) ;  
 	 	 	 	 	 i f   ( i v a l   = =   E M P T Y _ V A L U E   | |   i v a l   = =   0 )   { c o n t i n u e ; }  
 	 	 	 	 	 i f   ( i v a l   >   r e t v a l )   { r e t v a l   =   i v a l ; }  
 	 	 	 	 }  
 	 	 	 	  
 	 	 	 	 i f   ( r e t v a l   = =   - E M P T Y _ V A L U E )   { r e t v a l   =   E M P T Y _ V A L U E ; }  
 	 	 	 }  
 	 	 	 e l s e   i f   ( R a n g e V a l u e   = =   " m i n " )  
 	 	 	 {  
 	 	 	 	 r e t v a l   =   E M P T Y _ V A L U E ;  
 	 	 	 	  
 	 	 	 	 f o r   ( i = x 2 ;   i < = x 1 ;   i + + )  
 	 	 	 	 {  
 	 	 	 	 	 i v a l   =   f x d C u s t o m I n d i c a t o r ( h a n d l e ,   b u f f e r ,   s h i f t   +   i ) ;  
 	 	 	 	 	 i f   ( i v a l   = =   E M P T Y _ V A L U E   | |   i v a l   = =   0 )   { c o n t i n u e ; }  
 	 	 	 	 	 i f   ( i v a l   <   r e t v a l )   { r e t v a l   =   i v a l ; }  
 	 	 	 	 }  
 	 	 	 }  
 	 	 }  
 	 	  
 	 	 r e t u r n   ( r e t v a l ) ;  
 	 }  
 } ;  
  
 / /   " M y   I n d i c a t o r s "   m o d e l  
 c l a s s   M D L I C _ m y i n d i c a t o r s _ m y i n d i c a t o r s _ 1 0  
 {  
 	 p u b l i c :   / *   I n p u t   P a r a m e t e r s   * /  
 	 s t r i n g   S y m b o l ;  
 	 E N U M _ T I M E F R A M E S   P e r i o d ;  
 	 s t r i n g   M o d e O u t p u t ;  
 	 s t r i n g   T i m e S t a m p ;  
 	 i n t   V i s i b l e I D ;  
 	 i n t   V i s i b l e S h i f t ;  
 	 i n t   V i s i b l e L i m i t ;  
 	 i n t   R a n g e C a n d l e S t a r t ;  
 	 i n t   R a n g e C a n d l e E n d ;  
 	 s t r i n g   R a n g e T i m e S o u r c e ;  
 	 s t r i n g   R a n g e T i m e S t a r t ;  
 	 s t r i n g   R a n g e T i m e E n d ;  
 	 d o u b l e   R a n g e D a y O f f s e t ;  
 	 s t r i n g   R a n g e V a l u e ;  
 	 i n t   S h i f t ;  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   r )   { r e t u r n ; }  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 M D L I C _ m y i n d i c a t o r s _ m y i n d i c a t o r s _ 1 0 ( )  
 	 {  
 	 	 S y m b o l   =   ( s t r i n g ) C u r r e n t S y m b o l ( ) ;  
 	 	 P e r i o d   =   ( E N U M _ T I M E F R A M E S ) C u r r e n t T i m e f r a m e ( ) ;  
 	 	 M o d e O u t p u t   =   ( s t r i n g ) " i d " ;  
 	 	 T i m e S t a m p   =   ( s t r i n g ) " 0 0 : 0 0 " ;  
 	 	 V i s i b l e I D   =   ( i n t ) 0 ;  
 	 	 V i s i b l e S h i f t   =   ( i n t ) 0 ;  
 	 	 V i s i b l e L i m i t   =   ( i n t ) 1 0 0 ;  
 	 	 R a n g e C a n d l e S t a r t   =   ( i n t ) 0 ;  
 	 	 R a n g e C a n d l e E n d   =   ( i n t ) 1 0 ;  
 	 	 R a n g e T i m e S o u r c e   =   ( s t r i n g ) " s e r v e r " ;  
 	 	 R a n g e T i m e S t a r t   =   ( s t r i n g ) " 0 1 : 0 0 " ;  
 	 	 R a n g e T i m e E n d   =   ( s t r i n g ) " 0 8 : 0 0 " ;  
 	 	 R a n g e D a y O f f s e t   =   ( d o u b l e ) 0 . 0 ;  
 	 	 R a n g e V a l u e   =   ( s t r i n g ) " m a x " ;  
 	 	 S h i f t   =   ( i n t ) 0 ;  
 	 }  
  
 	 p u b l i c :   / *   T h e   m a i n   m e t h o d   * /  
 	 d o u b l e   _ e x e c u t e _ ( )  
 	 {  
 	 	 / / = =   M Q L 5   s p e c i f i c s   B E G I N   = = / /  
 	 	 / /   T h e   p r o b l e m   i s   t h a t   i C u s t o m ( )   a l w a y s   r e t u r n s   n e w   h a n d l e   w h e n   c a l l e d ,   r e g a r d l e s s   o f   t h e   i n p u t   p a r a m e t e r s .  
 	 	 i n t   h a n d l e   =   I N V A L I D _ H A N D L E ;  
 	 	  
 	 	 / /   t u r n   t h e   i n p u t   p a r a m e t e r s   i n t o   a   k e y  
 	 	 s t r i n g   k e y   =   " " ;  
 	 	 S t r i n g C o n c a t e n a t e ( k e y ,   S y m b o l ,   P e r i o d ,   " T I I "   ,   ( u i n t ) 2 0 ,   ( u i n t ) 3 0 ,   ( E N U M _ M A _ M E T H O D ) M O D E _ S M A ,   ( E N U M _ A P P L I E D _ P R I C E ) P R I C E _ C L O S E ,   ( d o u b l e ) 8 0 . 0 ,   ( d o u b l e ) 2 0 . 0 ) ;  
 	 	  
 	 	 / /   f o r   o u r   p a r a m e t e r s ,   d o   w e   a l r e a d y   h a v e   a n   i n d i c a t o r   h a n d l e ?  
 	 	 i n t   a r r a y _ k e y   =   A r r a y S e a r c h ( F X D _ I C U S T O M _ H A N D L E S _ K E Y S ,   k e y ) ;  
 	 	  
 	 	 / /   i f   w e   d o n ' t   h a v e   a   h a n d l e ,   t h e n   c r e a t e   o n e  
 	 	 i f   ( a r r a y _ k e y   = =   - 1 )  
 	 	 {  
 	 	 	 h a n d l e   =   i C u s t o m ( S y m b o l ,   P e r i o d ,   " T I I "   ,   ( u i n t ) 2 0 ,   ( u i n t ) 3 0 ,   ( E N U M _ M A _ M E T H O D ) M O D E _ S M A ,   ( E N U M _ A P P L I E D _ P R I C E ) P R I C E _ C L O S E ,   ( d o u b l e ) 8 0 . 0 ,   ( d o u b l e ) 2 0 . 0 ,   P R I C E _ C L O S E ) ;  
 	 	 	  
 	 	 	 i f   ( h a n d l e   = =   I N V A L I D _ H A N D L E )   {  
 	 	 	 	 r e t u r n   E M P T Y _ V A L U E ; 	  
 	 	 	 }  
 	 	 	  
 	 	 	 i n t   s i z e   =   A r r a y S i z e ( F X D _ I C U S T O M _ H A N D L E S _ K E Y S ) ;  
 	 	  
 	 	 	 A r r a y R e s i z e ( F X D _ I C U S T O M _ H A N D L E S _ K E Y S ,   s i z e + 1 ) ;  
 	 	 	 A r r a y R e s i z e ( F X D _ I C U S T O M _ H A N D L E S _ I D S ,   s i z e + 1 ) ;  
 	 	 	  
 	 	 	 F X D _ I C U S T O M _ H A N D L E S _ K E Y S [ s i z e ]   =   k e y ;  
 	 	 	 F X D _ I C U S T O M _ H A N D L E S _ I D S [ s i z e ]   =   h a n d l e ;  
 	 	 	  
 	 	 	 a r r a y _ k e y   =   s i z e ;  
 	 	 }  
 	 	 / /   y e s ,   w e   h a v e   a   h a n d l e ,   t h e n   g e t   i t  
 	 	 e l s e   {  
 	 	 	 h a n d l e   =   F X D _ I C U S T O M _ H A N D L E S _ I D S [ a r r a y _ k e y ] ;  
 	 	 }  
 	 	  
 	 	 / / = =   M Q L 5   s p e c i f i c s   E N D   = = / /  
 	 	  
 	 	 / / ! ! !   I   m u s t   d e f i n e   a l l   i n p u t   p r o p e r t i e s   h e r e ,   b e c a u s e   t h e y   a r e   n o t   a u t o m a t i c a l l y   d e f i n e d .  
 	 	 / /   T h i s   f u n c t i o n   i s   n o t   g l o b a l   p r o t o t y p e ,   o n e   n e w   f u n c t i o n   i s   c r e a t e d   f o r   e a c h   c a s e .   T h i s   i s   b e c a u s e   %   i C u s t o m   %   m u s t   b e   u n i q u e  
 	 	  
 	 	 s t r i n g   s y m b o l   =   S y m b o l ;  
 	 	 E N U M _ T I M E F R A M E S   t i m e f r a m e   =   P e r i o d ;  
 	 	 i n t   b u f f e r         =   0 ;  
 	 	 i n t   s h i f t           =   S h i f t   +   F X D _ M O R E _ S H I F T ;  
 	 	  
 	 	 d o u b l e   r e t v a l   =   E M P T Y _ V A L U E ;  
 	 	 i n t   i ;  
 	 	 d o u b l e   i v a l ;  
 	 	  
 	 	 i f   ( M o d e O u t p u t   = =   " i d " )  
 	 	 {  
 	 	 	 r e t v a l   =   f x d C u s t o m I n d i c a t o r ( h a n d l e ,   b u f f e r ,   s h i f t ) ;  
 	 	 }  
 	 	 e l s e   i f   ( M o d e O u t p u t   = =   " t i m e " )  
 	 	 {  
 	 	 	 d a t e t i m e   t i m e ;  
 	 	 	  
 	 	 	 i f   ( 0   & &   S t r i n g F i n d ( T i m e S t a m p ,   " : " )   = =   - 1 )  
 	 	 	 { 	  
 	 	 	 	 t i m e   =   ( d a t e t i m e ) S t r i n g T o I n t e g e r ( T i m e S t a m p ) ;   / /   h a n g s   i n   M Q L 4 ! ! !  
 	 	 	 }  
 	 	 	 e l s e  
 	 	 	 {  
 	 	 	 	 t i m e   =   S t r i n g T o T i m e ( T i m e S t a m p ) ;  
 	 	 	 }  
 	 	 	  
 	 	 	 s h i f t   =   i C a n d l e I D ( s y m b o l ,   t i m e f r a m e ,   t i m e ) ;  
 	 	 	 r e t v a l   =   f x d C u s t o m I n d i c a t o r ( h a n d l e ,   b u f f e r ,   s h i f t ) ;  
 	 	 }  
 	 	 e l s e   i f   ( M o d e O u t p u t   = =   " v i s i b l e "   | |   M o d e O u t p u t   = =   " i d _ b y _ v i s i b l e " )  
 	 	 {  
 	 	 	 i f   ( V i s i b l e L i m i t   = =   0 )   { V i s i b l e L i m i t   =   B a r s ( s y m b o l ,   t i m e f r a m e ) ; }  
 	 	 	  
 	 	 	 i n t   v i d   =   0 ;  
 	 	 	  
 	 	 	 f o r   ( i   =   s h i f t ;   i   < =   V i s i b l e L i m i t ;   i + + )  
 	 	 	 {  
 	 	 	 	 i v a l   =   f x d C u s t o m I n d i c a t o r ( h a n d l e ,   b u f f e r ,   s h i f t   +   i ) ;  
 	 	 	 	  
 	 	 	 	 i f   ( i v a l   = =   E M P T Y _ V A L U E   | |   i v a l   = =   0 )   { c o n t i n u e ; }  
 	 	 	 	 i f   ( v i d   > =   V i s i b l e I D )   {  
 	 	 	 	 	 i f   ( M o d e O u t p u t   = =   " v i s i b l e " )   { r e t v a l   =   i v a l ; }  
 	 	 	 	 	 e l s e   { r e t v a l   =   i ; }  
 	 	 	 	 	 b r e a k ; 	  
 	 	 	 	 }  
 	 	 	 	 	  
 	 	 	 	 v i d + + ;  
 	 	 	 }  
 	 	 }  
 	 	 e l s e   i f   ( M o d e O u t p u t   = =   " r a n g e " )  
 	 	 {  
 	 	 	 / /   r e v e r s e   v a l u e s ,   i f   n e e d e d  
 	 	 	 i f   ( R a n g e C a n d l e S t a r t   >   R a n g e C a n d l e E n d )   {  
 	 	 	 	 i n t   c t m p   =   R a n g e C a n d l e E n d ;  
 	 	 	 	 R a n g e C a n d l e E n d   =   R a n g e C a n d l e S t a r t ;  
 	 	 	 	 R a n g e C a n d l e S t a r t   =   c t m p ;  
 	 	 	 }  
 	 	  
 	 	 	 i f   ( R a n g e V a l u e   = =   " m a x " )  
 	 	 	 {  
 	 	 	 	 r e t v a l   =   - E M P T Y _ V A L U E ;  
 	 	 	 	  
 	 	 	 	 f o r   ( i   =   R a n g e C a n d l e S t a r t ;   i   < =   R a n g e C a n d l e E n d ;   i + + )  
 	 	 	 	 {  
 	 	 	 	 	 i v a l   =   f x d C u s t o m I n d i c a t o r ( h a n d l e ,   b u f f e r ,   s h i f t   +   i ) ;  
 	 	 	 	 	 i f   ( i v a l   = =   E M P T Y _ V A L U E   | |   i v a l   = =   0 )   { c o n t i n u e ; }  
 	 	 	 	 	 i f   ( i v a l   >   r e t v a l )   { r e t v a l   =   i v a l ; }  
 	 	 	 	 }  
 	 	 	 	  
 	 	 	 	 i f   ( r e t v a l   = =   - E M P T Y _ V A L U E )   { r e t v a l   =   E M P T Y _ V A L U E ; }  
 	 	 	 }  
 	 	 	 e l s e   i f   ( R a n g e V a l u e   = =   " m i n " )  
 	 	 	 {  
 	 	 	 	 r e t v a l   =   E M P T Y _ V A L U E ;  
 	 	 	 	  
 	 	 	 	 f o r   ( i   =   R a n g e C a n d l e S t a r t ;   i   < =   R a n g e C a n d l e E n d ;   i + + )  
 	 	 	 	 {  
 	 	 	 	 	 i v a l   =   f x d C u s t o m I n d i c a t o r ( h a n d l e ,   b u f f e r ,   s h i f t   +   i ) ;  
 	 	 	 	 	 i f   ( i v a l   = =   E M P T Y _ V A L U E   | |   i v a l   = =   0 )   { c o n t i n u e ; }  
 	 	 	 	 	 i f   ( i v a l   <   r e t v a l )   { r e t v a l   =   i v a l ; }  
 	 	 	 	 }  
 	 	 	 }  
 	 	 }  
 	 	 e l s e   i f   ( M o d e O u t p u t   = =   " r a n g e _ t i m e " )  
 	 	 {  
 	 	 	 d a t e t i m e   o f f s e t   =   0 ;  
 	 	 	 i f   ( R a n g e T i m e S o u r c e   = =   " g m t " )   { o f f s e t   =   ( i n t ) ( T i m e C u r r e n t ( )   -   T i m e L o c a l ( )   +   T i m e G M T O f f s e t ( ) ) ; }  
 	 	 	 e l s e   i f   ( R a n g e T i m e S o u r c e   = =   " s e r v e r " )   { o f f s e t   =   ( i n t ) ( T i m e C u r r e n t ( )   -   T i m e L o c a l ( ) ) ; }  
 	 	 	  
 	 	 	 d a t e t i m e   t i m e 1   =   S t r i n g T o T i m e ( R a n g e T i m e S t a r t ) - ( d a t e t i m e ) ( 8 6 4 0 0 * R a n g e D a y O f f s e t )   +   o f f s e t ;  
 	 	 	 d a t e t i m e   t i m e 2   =   S t r i n g T o T i m e ( R a n g e T i m e E n d ) - ( d a t e t i m e ) ( 8 6 4 0 0 * R a n g e D a y O f f s e t )   +   o f f s e t ;  
 	 	  
 	 	 	 i n t   x 1   =   i B a r S h i f t ( s y m b o l ,   t i m e f r a m e ,   t i m e 1 ,   f a l s e ) ;  
 	 	 	 i n t   x 2   =   i B a r S h i f t ( s y m b o l ,   t i m e f r a m e ,   t i m e 2 ,   f a l s e ) ;  
 	 	 	 i f   ( x 1 < x 2 )   { x 1 = i B a r S h i f t ( s y m b o l , t i m e f r a m e , ( t i m e 1 - 8 6 4 0 0 ) , f a l s e ) ; }  
 	 	 	  
 	 	 	 i f   ( R a n g e V a l u e   = =   " m a x " )  
 	 	 	 {  
 	 	 	 	 r e t v a l   =   - E M P T Y _ V A L U E ;  
 	 	 	 	  
 	 	 	 	 f o r   ( i = x 2 ;   i < = x 1 ;   i + + )  
 	 	 	 	 {  
 	 	 	 	 	 i v a l   =   f x d C u s t o m I n d i c a t o r ( h a n d l e ,   b u f f e r ,   s h i f t   +   i ) ;  
 	 	 	 	 	 i f   ( i v a l   = =   E M P T Y _ V A L U E   | |   i v a l   = =   0 )   { c o n t i n u e ; }  
 	 	 	 	 	 i f   ( i v a l   >   r e t v a l )   { r e t v a l   =   i v a l ; }  
 	 	 	 	 }  
 	 	 	 	  
 	 	 	 	 i f   ( r e t v a l   = =   - E M P T Y _ V A L U E )   { r e t v a l   =   E M P T Y _ V A L U E ; }  
 	 	 	 }  
 	 	 	 e l s e   i f   ( R a n g e V a l u e   = =   " m i n " )  
 	 	 	 {  
 	 	 	 	 r e t v a l   =   E M P T Y _ V A L U E ;  
 	 	 	 	  
 	 	 	 	 f o r   ( i = x 2 ;   i < = x 1 ;   i + + )  
 	 	 	 	 {  
 	 	 	 	 	 i v a l   =   f x d C u s t o m I n d i c a t o r ( h a n d l e ,   b u f f e r ,   s h i f t   +   i ) ;  
 	 	 	 	 	 i f   ( i v a l   = =   E M P T Y _ V A L U E   | |   i v a l   = =   0 )   { c o n t i n u e ; }  
 	 	 	 	 	 i f   ( i v a l   <   r e t v a l )   { r e t v a l   =   i v a l ; }  
 	 	 	 	 }  
 	 	 	 }  
 	 	 }  
 	 	  
 	 	 r e t u r n   ( r e t v a l ) ;  
 	 }  
 } ;  
  
  
 / / - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
  
 / /   B l o c k   1   ( N o   p o s i t i o n )  
 c l a s s   B l o c k 0 :   p u b l i c   M D L _ N o O p e n e d O r d e r s < s t r i n g , s t r i n g , s t r i n g , s t r i n g , s t r i n g >  
 {  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 B l o c k 0 ( )   {  
 	 	 _ _ b l o c k _ n u m b e r   =   0 ;  
 	 	 _ _ b l o c k _ u s e r _ n u m b e r   =   " 1 " ;  
 	 	 _ b e f o r e E x e c u t e E n a b l e d   =   t r u e ;  
  
 	 	 / /   F i l l   t h e   l i s t   o f   o u t b o u n d   b l o c k s  
 	 	 i n t   _ _ _ o u t b o u n d _ b l o c k s [ 1 ]   =   { 5 4 } ;  
 	 	 A r r a y C o p y ( _ _ o u t b o u n d _ b l o c k s ,   _ _ _ o u t b o u n d _ b l o c k s ) ;  
 	 }  
  
 	 p u b l i c :   / *   C a l l b a c k   &   R u n   * /  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   v a l u e )   {  
 	 	 i f   ( v a l u e   = =   1 )   {  
 	 	 	 _ b l o c k s _ [ 5 4 ] . r u n ( 0 ) ;  
 	 	 }  
 	 }  
  
 	 v i r t u a l   v o i d   _ b e f o r e E x e c u t e _ ( )  
 	 {  
 	 	 S y m b o l   =   ( s t r i n g ) C u r r e n t S y m b o l ( ) ;  
 	 }  
 } ;  
  
 / /   B l o c k   6   ( B u y   n o w )  
 c l a s s   B l o c k 1 :   p u b l i c   M D L _ B u y N o w < s t r i n g , s t r i n g , s t r i n g , d o u b l e , d o u b l e , d o u b l e , d o u b l e , d o u b l e , M D L I C _ v a l u e _ v a l u e , d o u b l e , d o u b l e , d o u b l e , d o u b l e , d o u b l e , d o u b l e , d o u b l e , d o u b l e , i n t , i n t , d o u b l e , b o o l , d o u b l e , d o u b l e , b o o l , d o u b l e , s t r i n g , b o o l , d o u b l e , s t r i n g , s t r i n g , b o o l , d o u b l e , s t r i n g , d o u b l e , d o u b l e , d o u b l e , M D L I C _ v a l u e _ v a l u e , d o u b l e , M D L I C _ v a l u e _ v a l u e , d o u b l e , M D L I C _ v a l u e _ v a l u e , d o u b l e , s t r i n g , d o u b l e , d o u b l e , d o u b l e , M D L I C _ v a l u e _ v a l u e , d o u b l e , M D L I C _ m y i n d i c a t o r s _ m y i n d i c a t o r s _ 1 , d o u b l e , M D L I C _ i n d i c a t o r s _ i A T R , d o u b l e , s t r i n g , i n t , i n t , i n t , M D L I C _ v a l u e _ t i m e , d a t e t i m e , u l o n g , s t r i n g , c o l o r >  
 {  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 B l o c k 1 ( )   {  
 	 	 _ _ b l o c k _ n u m b e r   =   1 ;  
 	 	 _ _ b l o c k _ u s e r _ n u m b e r   =   " 6 " ;  
 	 	 _ b e f o r e E x e c u t e E n a b l e d   =   t r u e ;  
  
 	 	 / /   I C   i n p u t   p a r a m e t e r s  
 	 	 d V o l u m e S i z e . V a l u e   =   0 . 1 ;  
 	 	 d p S t o p L o s s . V a l u e   =   1 0 0 . 0 ;  
 	 	 d d S t o p L o s s . V a l u e   =   0 . 0 1 ;  
 	 	 d E x p . M o d e T i m e S h i f t   =   2 ;  
 	 	 d E x p . T i m e S h i f t D a y s   =   1 . 0 ;  
 	 	 d E x p . T i m e S k i p W e e k d a y s   =   t r u e ;  
 	 	 / /   B l o c k   i n p u t   p a r a m e t e r s  
 	 	 G r o u p   =   " 1 " ;  
 	 	 V o l u m e P e r c e n t   =   0 . 2 ;  
 	 	 S t o p L o s s M o d e   =   " p e r c e n t T P " ;  
 	 	 S t o p L o s s P e r c e n t T P   =   1 5 0 . 0 ;  
 	 	 T a k e P r o f i t M o d e   =   " d y n a m i c D i g i t s " ;  
 	 	 T a k e P r o f i t P i p s   =   1 0 0 . 0 ;  
 	 }  
  
 	 p u b l i c :   / *   C u s t o m   m e t h o d s   * /  
 	 v i r t u a l   d o u b l e   _ d V o l u m e S i z e _ ( )   { r e t u r n   d V o l u m e S i z e . _ e x e c u t e _ ( ) ; }  
 	 v i r t u a l   d o u b l e   _ d l S t o p L o s s _ ( )   { r e t u r n   d l S t o p L o s s . _ e x e c u t e _ ( ) ; }  
 	 v i r t u a l   d o u b l e   _ d p S t o p L o s s _ ( )   { r e t u r n   d p S t o p L o s s . _ e x e c u t e _ ( ) ; }  
 	 v i r t u a l   d o u b l e   _ d d S t o p L o s s _ ( )   { r e t u r n   d d S t o p L o s s . _ e x e c u t e _ ( ) ; }  
 	 v i r t u a l   d o u b l e   _ d l T a k e P r o f i t _ ( )   { r e t u r n   d l T a k e P r o f i t . _ e x e c u t e _ ( ) ; }  
 	 v i r t u a l   d o u b l e   _ d p T a k e P r o f i t _ ( )   {  
 	 	 d p T a k e P r o f i t . S y m b o l   =   C u r r e n t S y m b o l ( ) ;  
 	 	 d p T a k e P r o f i t . P e r i o d   =   C u r r e n t T i m e f r a m e ( ) ;  
  
 	 	 r e t u r n   d p T a k e P r o f i t . _ e x e c u t e _ ( ) ;  
 	 }  
 	 v i r t u a l   d o u b l e   _ d d T a k e P r o f i t _ ( )   {  
 	 	 d d T a k e P r o f i t . S y m b o l   =   C u r r e n t S y m b o l ( ) ;  
 	 	 d d T a k e P r o f i t . P e r i o d   =   C u r r e n t T i m e f r a m e ( ) ;  
  
 	 	 r e t u r n   d d T a k e P r o f i t . _ e x e c u t e _ ( ) ;  
 	 }  
 	 v i r t u a l   d a t e t i m e   _ d E x p _ ( )   { r e t u r n   d E x p . _ e x e c u t e _ ( ) ; }  
  
 	 p u b l i c :   / *   C a l l b a c k   &   R u n   * /  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   v a l u e )   {  
 	 }  
  
 	 v i r t u a l   v o i d   _ b e f o r e E x e c u t e _ ( )  
 	 {  
 	 	 / *   I n p u t s ,   m o d i f i e d   i n t o   t h e   c o d e   m u s t   b e   s e t   h e r e   e v e r y   t i m e   * /  
 	 	 d p T a k e P r o f i t . R a n g e C a n d l e S t a r t   =   0 ;  
 	 	 d p T a k e P r o f i t . R a n g e C a n d l e E n d   =   1 0 ;  
 	 	 S y m b o l   =   ( s t r i n g ) C u r r e n t S y m b o l ( ) ;  
 	 	 A r r o w C o l o r B u y   =   ( c o l o r ) c l r B l u e ;  
 	 }  
 } ;  
  
 / /   B l o c k   9   ( T I I   r i s e )  
 c l a s s   B l o c k 2 :   p u b l i c   M D L _ I n d i c a t o r R i s e < M D L I C _ m y i n d i c a t o r s _ m y i n d i c a t o r s _ 2 , d o u b l e , s t r i n g , i n t , i n t , d o u b l e , d o u b l e , s t r i n g >  
 {  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 B l o c k 2 ( )   {  
 	 	 _ _ b l o c k _ n u m b e r   =   2 ;  
 	 	 _ _ b l o c k _ u s e r _ n u m b e r   =   " 9 " ;  
 	 	 _ b e f o r e E x e c u t e E n a b l e d   =   t r u e ;  
  
 	 	 / /   F i l l   t h e   l i s t   o f   o u t b o u n d   b l o c k s  
 	 	 i n t   _ _ _ o u t b o u n d _ b l o c k s [ 1 ]   =   { 2 5 } ;  
 	 	 A r r a y C o p y ( _ _ o u t b o u n d _ b l o c k s ,   _ _ _ o u t b o u n d _ b l o c k s ) ;  
 	 	 / /   B l o c k   i n p u t   p a r a m e t e r s  
 	 	 R i s e M o d e   =   " v a l u e " ;  
 	 	 E x c e p t i o n C a n d l e s   =   1 ;  
 	 	 R i s e V a l u e   =   1 . 0 ;  
 	 }  
  
 	 p u b l i c :   / *   C u s t o m   m e t h o d s   * /  
 	 v i r t u a l   d o u b l e   _ I n d i c a t o r _ ( )   {  
 	 	 I n d i c a t o r . S y m b o l   =   C u r r e n t S y m b o l ( ) ;  
 	 	 I n d i c a t o r . P e r i o d   =   C u r r e n t T i m e f r a m e ( ) ;  
  
 	 	 r e t u r n   I n d i c a t o r . _ e x e c u t e _ ( ) ;  
 	 }  
  
 	 p u b l i c :   / *   C a l l b a c k   &   R u n   * /  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   v a l u e )   {  
 	 	 i f   ( v a l u e   = =   1 )   {  
 	 	 	 _ b l o c k s _ [ 2 5 ] . r u n ( 2 ) ;  
 	 	 }  
 	 }  
  
 	 v i r t u a l   v o i d   _ b e f o r e E x e c u t e _ ( )  
 	 {  
 	 	 / *   I n p u t s ,   m o d i f i e d   i n t o   t h e   c o d e   m u s t   b e   s e t   h e r e   e v e r y   t i m e   * /  
 	 	 I n d i c a t o r . R a n g e C a n d l e S t a r t   =   0 ;  
 	 	 I n d i c a t o r . R a n g e C a n d l e E n d   =   1 0 ;  
 	 }  
 } ;  
  
 / /   B l o c k   1 0   ( T I I   f a l l )  
 c l a s s   B l o c k 3 :   p u b l i c   M D L _ I n d i c a t o r F a l l < M D L I C _ m y i n d i c a t o r s _ m y i n d i c a t o r s _ 3 , d o u b l e , s t r i n g , i n t , i n t , d o u b l e , d o u b l e , s t r i n g >  
 {  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 B l o c k 3 ( )   {  
 	 	 _ _ b l o c k _ n u m b e r   =   3 ;  
 	 	 _ _ b l o c k _ u s e r _ n u m b e r   =   " 1 0 " ;  
 	 	 _ b e f o r e E x e c u t e E n a b l e d   =   t r u e ;  
  
 	 	 / /   F i l l   t h e   l i s t   o f   o u t b o u n d   b l o c k s  
 	 	 i n t   _ _ _ o u t b o u n d _ b l o c k s [ 1 ]   =   { 2 6 } ;  
 	 	 A r r a y C o p y ( _ _ o u t b o u n d _ b l o c k s ,   _ _ _ o u t b o u n d _ b l o c k s ) ;  
 	 	 / /   B l o c k   i n p u t   p a r a m e t e r s  
 	 	 F a l l M o d e   =   " v a l u e " ;  
 	 	 E x c e p t i o n C a n d l e s   =   1 ;  
 	 	 F a l l V a l u e   =   1 . 0 ;  
 	 }  
  
 	 p u b l i c :   / *   C u s t o m   m e t h o d s   * /  
 	 v i r t u a l   d o u b l e   _ I n d i c a t o r _ ( )   {  
 	 	 I n d i c a t o r . S y m b o l   =   C u r r e n t S y m b o l ( ) ;  
 	 	 I n d i c a t o r . P e r i o d   =   C u r r e n t T i m e f r a m e ( ) ;  
  
 	 	 r e t u r n   I n d i c a t o r . _ e x e c u t e _ ( ) ;  
 	 }  
  
 	 p u b l i c :   / *   C a l l b a c k   &   R u n   * /  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   v a l u e )   {  
 	 	 i f   ( v a l u e   = =   1 )   {  
 	 	 	 _ b l o c k s _ [ 2 6 ] . r u n ( 3 ) ;  
 	 	 }  
 	 }  
  
 	 v i r t u a l   v o i d   _ b e f o r e E x e c u t e _ ( )  
 	 {  
 	 	 / *   I n p u t s ,   m o d i f i e d   i n t o   t h e   c o d e   m u s t   b e   s e t   h e r e   e v e r y   t i m e   * /  
 	 	 I n d i c a t o r . R a n g e C a n d l e S t a r t   =   0 ;  
 	 	 I n d i c a t o r . R a n g e C a n d l e E n d   =   1 0 ;  
 	 }  
 } ;  
  
 / /   B l o c k   1 1   ( f a s t & l t ; x   s l o w )  
 c l a s s   B l o c k 4 :   p u b l i c   M D L _ C o n d i t i o n < M D L I C _ i n d i c a t o r s _ i A M A , d o u b l e , s t r i n g , M D L I C _ i n d i c a t o r s _ i A M A , d o u b l e , i n t >  
 {  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 B l o c k 4 ( )   {  
 	 	 _ _ b l o c k _ n u m b e r   =   4 ;  
 	 	 _ _ b l o c k _ u s e r _ n u m b e r   =   " 1 1 " ;  
  
  
 	 	 / /   F i l l   t h e   l i s t   o f   o u t b o u n d   b l o c k s  
 	 	 i n t   _ _ _ o u t b o u n d _ b l o c k s [ 1 ]   =   { 3 0 } ;  
 	 	 A r r a y C o p y ( _ _ o u t b o u n d _ b l o c k s ,   _ _ _ o u t b o u n d _ b l o c k s ) ;  
  
 	 	 / /   I C   i n p u t   p a r a m e t e r s  
 	 	 R o . F a s t M A p e r i o d   =   5 ;  
 	 	 / /   B l o c k   i n p u t   p a r a m e t e r s  
 	 	 c o m p a r e   =   " x < " ;  
 	 }  
  
 	 p u b l i c :   / *   C u s t o m   m e t h o d s   * /  
 	 v i r t u a l   d o u b l e   _ L o _ ( )   {  
 	 	 L o . A p p l i e d P r i c e   =   P R I C E _ C L O S E ;  
 	 	 L o . S y m b o l   =   C u r r e n t S y m b o l ( ) ;  
 	 	 L o . P e r i o d   =   C u r r e n t T i m e f r a m e ( ) ;  
  
 	 	 r e t u r n   L o . _ e x e c u t e _ ( ) ;  
 	 }  
 	 v i r t u a l   d o u b l e   _ R o _ ( )   {  
 	 	 R o . A p p l i e d P r i c e   =   P R I C E _ C L O S E ;  
 	 	 R o . S y m b o l   =   C u r r e n t S y m b o l ( ) ;  
 	 	 R o . P e r i o d   =   C u r r e n t T i m e f r a m e ( ) ;  
  
 	 	 r e t u r n   R o . _ e x e c u t e _ ( ) ;  
 	 }  
  
 	 p u b l i c :   / *   C a l l b a c k   &   R u n   * /  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   v a l u e )   {  
 	 	 i f   ( v a l u e   = =   1 )   {  
 	 	 	 _ b l o c k s _ [ 3 0 ] . r u n ( 4 ) ;  
 	 	 }  
 	 }  
 } ;  
  
 / /   B l o c k   1 2   ( f a s t & g t ; x s l o w )  
 c l a s s   B l o c k 5 :   p u b l i c   M D L _ C o n d i t i o n < M D L I C _ i n d i c a t o r s _ i A M A , d o u b l e , s t r i n g , M D L I C _ i n d i c a t o r s _ i A M A , d o u b l e , i n t >  
 {  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 B l o c k 5 ( )   {  
 	 	 _ _ b l o c k _ n u m b e r   =   5 ;  
 	 	 _ _ b l o c k _ u s e r _ n u m b e r   =   " 1 2 " ;  
  
  
 	 	 / /   F i l l   t h e   l i s t   o f   o u t b o u n d   b l o c k s  
 	 	 i n t   _ _ _ o u t b o u n d _ b l o c k s [ 1 ]   =   { 3 3 } ;  
 	 	 A r r a y C o p y ( _ _ o u t b o u n d _ b l o c k s ,   _ _ _ o u t b o u n d _ b l o c k s ) ;  
  
 	 	 / /   I C   i n p u t   p a r a m e t e r s  
 	 	 R o . F a s t M A p e r i o d   =   5 ;  
 	 	 / /   B l o c k   i n p u t   p a r a m e t e r s  
 	 	 c o m p a r e   =   " x > " ;  
 	 }  
  
 	 p u b l i c :   / *   C u s t o m   m e t h o d s   * /  
 	 v i r t u a l   d o u b l e   _ L o _ ( )   {  
 	 	 L o . A p p l i e d P r i c e   =   P R I C E _ C L O S E ;  
 	 	 L o . S y m b o l   =   C u r r e n t S y m b o l ( ) ;  
 	 	 L o . P e r i o d   =   C u r r e n t T i m e f r a m e ( ) ;  
  
 	 	 r e t u r n   L o . _ e x e c u t e _ ( ) ;  
 	 }  
 	 v i r t u a l   d o u b l e   _ R o _ ( )   {  
 	 	 R o . A p p l i e d P r i c e   =   P R I C E _ C L O S E ;  
 	 	 R o . S y m b o l   =   C u r r e n t S y m b o l ( ) ;  
 	 	 R o . P e r i o d   =   C u r r e n t T i m e f r a m e ( ) ;  
  
 	 	 r e t u r n   R o . _ e x e c u t e _ ( ) ;  
 	 }  
  
 	 p u b l i c :   / *   C a l l b a c k   &   R u n   * /  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   v a l u e )   {  
 	 	 i f   ( v a l u e   = =   1 )   {  
 	 	 	 _ b l o c k s _ [ 3 3 ] . r u n ( 5 ) ;  
 	 	 }  
 	 }  
 } ;  
  
 / /   B l o c k   1 3   ( H o u r s   f i l t e r )  
 c l a s s   B l o c k 6 :   p u b l i c   M D L _ H o u r s F i l t e r < s t r i n g , s t r i n g , s t r i n g , b o o l , s t r i n g , s t r i n g , b o o l , s t r i n g , s t r i n g , b o o l , s t r i n g , s t r i n g >  
 {  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 B l o c k 6 ( )   {  
 	 	 _ _ b l o c k _ n u m b e r   =   6 ;  
 	 	 _ _ b l o c k _ u s e r _ n u m b e r   =   " 1 3 " ;  
  
  
 	 	 / /   F i l l   t h e   l i s t   o f   o u t b o u n d   b l o c k s  
 	 	 i n t   _ _ _ o u t b o u n d _ b l o c k s [ 1 ]   =   { 9 } ;  
 	 	 A r r a y C o p y ( _ _ o u t b o u n d _ b l o c k s ,   _ _ _ o u t b o u n d _ b l o c k s ) ;  
 	 	 / /   B l o c k   i n p u t   p a r a m e t e r s  
 	 	 S t a r t H o u r   =   " 1 8 : 0 0 " ;  
 	 	 E n d H o u r   =   " 2 2 : 0 0 " ;  
 	 }  
  
 	 p u b l i c :   / *   C a l l b a c k   &   R u n   * /  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   v a l u e )   {  
 	 	 i f   ( v a l u e   = =   1 )   {  
 	 	 	 _ b l o c k s _ [ 9 ] . r u n ( 6 ) ;  
 	 	 }  
 	 }  
 } ;  
  
 / /   B l o c k   1 6   ( B e a r   c a n d l e )  
 c l a s s   B l o c k 7 :   p u b l i c   M D L _ S i g n a l B e a r C a n d l e < s t r i n g , i n t , d o u b l e , d o u b l e , s t r i n g , E N U M _ T I M E F R A M E S >  
 {  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 B l o c k 7 ( )   {  
 	 	 _ _ b l o c k _ n u m b e r   =   7 ;  
 	 	 _ _ b l o c k _ u s e r _ n u m b e r   =   " 1 6 " ;  
 	 	 _ b e f o r e E x e c u t e E n a b l e d   =   t r u e ;  
  
 	 	 / /   F i l l   t h e   l i s t   o f   o u t b o u n d   b l o c k s  
 	 	 i n t   _ _ _ o u t b o u n d _ b l o c k s [ 4 ]   =   { 1 0 , 1 1 , 2 0 , 4 7 } ;  
 	 	 A r r a y C o p y ( _ _ o u t b o u n d _ b l o c k s ,   _ _ _ o u t b o u n d _ b l o c k s ) ;  
 	 	 / /   B l o c k   i n p u t   p a r a m e t e r s  
 	 	 S i g n a l T y p e   =   " o n c e " ;  
 	 	 C a n d l e I D   =   0 ;  
 	 }  
  
 	 p u b l i c :   / *   C a l l b a c k   &   R u n   * /  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   v a l u e )   {  
 	 	 i f   ( v a l u e   = =   1 )   {  
 	 	 	 _ b l o c k s _ [ 1 0 ] . r u n ( 7 ) ;  
 	 	 	 _ b l o c k s _ [ 1 1 ] . r u n ( 7 ) ;  
 	 	 	 _ b l o c k s _ [ 2 0 ] . r u n ( 7 ) ;  
 	 	 	 _ b l o c k s _ [ 4 7 ] . r u n ( 7 ) ;  
 	 	 }  
 	 }  
  
 	 v i r t u a l   v o i d   _ b e f o r e E x e c u t e _ ( )  
 	 {  
 	 	 S y m b o l   =   ( s t r i n g ) C u r r e n t S y m b o l ( ) ;  
 	 	 P e r i o d   =   ( E N U M _ T I M E F R A M E S ) C u r r e n t T i m e f r a m e ( ) ;  
 	 }  
 } ;  
  
 / /   B l o c k   1 7   ( B u l l   c a n d l e )  
 c l a s s   B l o c k 8 :   p u b l i c   M D L _ S i g n a l B u l l C a n d l e < s t r i n g , i n t , d o u b l e , d o u b l e , s t r i n g , E N U M _ T I M E F R A M E S >  
 {  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 B l o c k 8 ( )   {  
 	 	 _ _ b l o c k _ n u m b e r   =   8 ;  
 	 	 _ _ b l o c k _ u s e r _ n u m b e r   =   " 1 7 " ;  
 	 	 _ b e f o r e E x e c u t e E n a b l e d   =   t r u e ;  
  
 	 	 / /   F i l l   t h e   l i s t   o f   o u t b o u n d   b l o c k s  
 	 	 i n t   _ _ _ o u t b o u n d _ b l o c k s [ 4 ]   =   { 1 , 1 2 , 2 1 , 4 8 } ;  
 	 	 A r r a y C o p y ( _ _ o u t b o u n d _ b l o c k s ,   _ _ _ o u t b o u n d _ b l o c k s ) ;  
 	 	 / /   B l o c k   i n p u t   p a r a m e t e r s  
 	 	 S i g n a l T y p e   =   " o n c e " ;  
 	 	 C a n d l e I D   =   0 ;  
 	 }  
  
 	 p u b l i c :   / *   C a l l b a c k   &   R u n   * /  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   v a l u e )   {  
 	 	 i f   ( v a l u e   = =   1 )   {  
 	 	 	 _ b l o c k s _ [ 1 ] . r u n ( 8 ) ;  
 	 	 	 _ b l o c k s _ [ 1 2 ] . r u n ( 8 ) ;  
 	 	 	 _ b l o c k s _ [ 2 1 ] . r u n ( 8 ) ;  
 	 	 	 _ b l o c k s _ [ 4 8 ] . r u n ( 8 ) ;  
 	 	 }  
 	 }  
  
 	 v i r t u a l   v o i d   _ b e f o r e E x e c u t e _ ( )  
 	 {  
 	 	 S y m b o l   =   ( s t r i n g ) C u r r e n t S y m b o l ( ) ;  
 	 	 P e r i o d   =   ( E N U M _ T I M E F R A M E S ) C u r r e n t T i m e f r a m e ( ) ;  
 	 }  
 } ;  
  
 / /   B l o c k   2 4   ( O n c e   p e r   1 0 m i n )  
 c l a s s   B l o c k 9 :   p u b l i c   M D L _ O n c e P e r M i n u t e s < i n t >  
 {  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 B l o c k 9 ( )   {  
 	 	 _ _ b l o c k _ n u m b e r   =   9 ;  
 	 	 _ _ b l o c k _ u s e r _ n u m b e r   =   " 2 4 " ;  
  
  
 	 	 / /   F i l l   t h e   l i s t   o f   o u t b o u n d   b l o c k s  
 	 	 i n t   _ _ _ o u t b o u n d _ b l o c k s [ 4 ]   =   { 2 9 , 3 2 , 4 , 5 } ;  
 	 	 A r r a y C o p y ( _ _ o u t b o u n d _ b l o c k s ,   _ _ _ o u t b o u n d _ b l o c k s ) ;  
 	 	 / /   B l o c k   i n p u t   p a r a m e t e r s  
 	 	 M i n u t e s P e r i o d   =   1 0 ;  
 	 }  
  
 	 p u b l i c :   / *   C a l l b a c k   &   R u n   * /  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   v a l u e )   {  
 	 	 i f   ( v a l u e   = =   1 )   {  
 	 	 	 _ b l o c k s _ [ 4 ] . r u n ( 9 ) ;  
 	 	 	 _ b l o c k s _ [ 5 ] . r u n ( 9 ) ;  
 	 	 	 _ b l o c k s _ [ 2 9 ] . r u n ( 9 ) ;  
 	 	 	 _ b l o c k s _ [ 3 2 ] . r u n ( 9 ) ;  
 	 	 }  
 	 }  
 } ;  
  
 / /   B l o c k   2 5   ( S e l l   n o w )  
 c l a s s   B l o c k 1 0 :   p u b l i c   M D L _ S e l l N o w < s t r i n g , s t r i n g , s t r i n g , d o u b l e , d o u b l e , d o u b l e , d o u b l e , d o u b l e , M D L I C _ v a l u e _ v a l u e , d o u b l e , d o u b l e , d o u b l e , d o u b l e , d o u b l e , d o u b l e , d o u b l e , d o u b l e , i n t , i n t , d o u b l e , b o o l , d o u b l e , d o u b l e , b o o l , d o u b l e , s t r i n g , b o o l , d o u b l e , s t r i n g , s t r i n g , b o o l , d o u b l e , s t r i n g , d o u b l e , d o u b l e , d o u b l e , M D L I C _ v a l u e _ v a l u e , d o u b l e , M D L I C _ v a l u e _ v a l u e , d o u b l e , M D L I C _ v a l u e _ v a l u e , d o u b l e , s t r i n g , d o u b l e , d o u b l e , d o u b l e , M D L I C _ v a l u e _ v a l u e , d o u b l e , M D L I C _ v a l u e _ v a l u e , d o u b l e , M D L I C _ i n d i c a t o r s _ i A T R , d o u b l e , s t r i n g , i n t , i n t , i n t , M D L I C _ v a l u e _ t i m e , d a t e t i m e , u l o n g , s t r i n g , c o l o r >  
 {  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 B l o c k 1 0 ( )   {  
 	 	 _ _ b l o c k _ n u m b e r   =   1 0 ;  
 	 	 _ _ b l o c k _ u s e r _ n u m b e r   =   " 2 5 " ;  
 	 	 _ b e f o r e E x e c u t e E n a b l e d   =   t r u e ;  
  
 	 	 / /   I C   i n p u t   p a r a m e t e r s  
 	 	 d V o l u m e S i z e . V a l u e   =   0 . 1 ;  
 	 	 d p S t o p L o s s . V a l u e   =   1 0 0 . 0 ;  
 	 	 d d S t o p L o s s . V a l u e   =   0 . 0 1 ;  
 	 	 d p T a k e P r o f i t . V a l u e   =   1 0 0 . 0 ;  
 	 	 d E x p . M o d e T i m e S h i f t   =   2 ;  
 	 	 d E x p . T i m e S h i f t D a y s   =   1 . 0 ;  
 	 	 d E x p . T i m e S k i p W e e k d a y s   =   t r u e ;  
 	 	 / /   B l o c k   i n p u t   p a r a m e t e r s  
 	 	 G r o u p   =   " 1 " ;  
 	 	 S t o p L o s s M o d e   =   " p e r c e n t T P " ;  
 	 	 S t o p L o s s P e r c e n t T P   =   1 5 0 . 0 ;  
 	 	 T a k e P r o f i t M o d e   =   " d y n a m i c D i g i t s " ;  
 	 }  
  
 	 p u b l i c :   / *   C u s t o m   m e t h o d s   * /  
 	 v i r t u a l   d o u b l e   _ d V o l u m e S i z e _ ( )   { r e t u r n   d V o l u m e S i z e . _ e x e c u t e _ ( ) ; }  
 	 v i r t u a l   d o u b l e   _ d l S t o p L o s s _ ( )   { r e t u r n   d l S t o p L o s s . _ e x e c u t e _ ( ) ; }  
 	 v i r t u a l   d o u b l e   _ d p S t o p L o s s _ ( )   { r e t u r n   d p S t o p L o s s . _ e x e c u t e _ ( ) ; }  
 	 v i r t u a l   d o u b l e   _ d d S t o p L o s s _ ( )   { r e t u r n   d d S t o p L o s s . _ e x e c u t e _ ( ) ; }  
 	 v i r t u a l   d o u b l e   _ d l T a k e P r o f i t _ ( )   { r e t u r n   d l T a k e P r o f i t . _ e x e c u t e _ ( ) ; }  
 	 v i r t u a l   d o u b l e   _ d p T a k e P r o f i t _ ( )   { r e t u r n   d p T a k e P r o f i t . _ e x e c u t e _ ( ) ; }  
 	 v i r t u a l   d o u b l e   _ d d T a k e P r o f i t _ ( )   {  
 	 	 d d T a k e P r o f i t . S y m b o l   =   C u r r e n t S y m b o l ( ) ;  
 	 	 d d T a k e P r o f i t . P e r i o d   =   C u r r e n t T i m e f r a m e ( ) ;  
  
 	 	 r e t u r n   d d T a k e P r o f i t . _ e x e c u t e _ ( ) ;  
 	 }  
 	 v i r t u a l   d a t e t i m e   _ d E x p _ ( )   { r e t u r n   d E x p . _ e x e c u t e _ ( ) ; }  
  
 	 p u b l i c :   / *   C a l l b a c k   &   R u n   * /  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   v a l u e )   {  
 	 }  
  
 	 v i r t u a l   v o i d   _ b e f o r e E x e c u t e _ ( )  
 	 {  
 	 	 S y m b o l   =   ( s t r i n g ) C u r r e n t S y m b o l ( ) ;  
 	 	 A r r o w C o l o r S e l l   =   ( c o l o r ) c l r R e d ;  
 	 }  
 } ;  
  
 / /   B l o c k   3 4   ( S e l l   n o w )  
 c l a s s   B l o c k 1 1 :   p u b l i c   M D L _ S e l l N o w < s t r i n g , s t r i n g , s t r i n g , d o u b l e , d o u b l e , d o u b l e , d o u b l e , d o u b l e , M D L I C _ v a l u e _ v a l u e , d o u b l e , d o u b l e , d o u b l e , d o u b l e , d o u b l e , d o u b l e , d o u b l e , d o u b l e , i n t , i n t , d o u b l e , b o o l , d o u b l e , d o u b l e , b o o l , d o u b l e , s t r i n g , b o o l , d o u b l e , s t r i n g , s t r i n g , b o o l , d o u b l e , s t r i n g , d o u b l e , d o u b l e , d o u b l e , M D L I C _ v a l u e _ v a l u e , d o u b l e , M D L I C _ v a l u e _ v a l u e , d o u b l e , M D L I C _ i n d i c a t o r s _ i A T R , d o u b l e , s t r i n g , d o u b l e , d o u b l e , d o u b l e , M D L I C _ v a l u e _ v a l u e , d o u b l e , M D L I C _ v a l u e _ v a l u e , d o u b l e , M D L I C _ i n d i c a t o r s _ i A T R , d o u b l e , s t r i n g , i n t , i n t , i n t , M D L I C _ v a l u e _ t i m e , d a t e t i m e , u l o n g , s t r i n g , c o l o r >  
 {  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 B l o c k 1 1 ( )   {  
 	 	 _ _ b l o c k _ n u m b e r   =   1 1 ;  
 	 	 _ _ b l o c k _ u s e r _ n u m b e r   =   " 3 4 " ;  
 	 	 _ b e f o r e E x e c u t e E n a b l e d   =   t r u e ;  
  
 	 	 / /   I C   i n p u t   p a r a m e t e r s  
 	 	 d V o l u m e S i z e . V a l u e   =   0 . 1 ;  
 	 	 d p S t o p L o s s . V a l u e   =   1 0 0 . 0 ;  
 	 	 d p T a k e P r o f i t . V a l u e   =   1 0 0 . 0 ;  
 	 	 d E x p . M o d e T i m e S h i f t   =   2 ;  
 	 	 d E x p . T i m e S h i f t D a y s   =   1 . 0 ;  
 	 	 d E x p . T i m e S k i p W e e k d a y s   =   t r u e ;  
 	 	 / /   B l o c k   i n p u t   p a r a m e t e r s  
 	 	 G r o u p   =   " 2 " ;  
 	 	 S t o p L o s s M o d e   =   " d y n a m i c D i g i t s " ;  
 	 	 S t o p L o s s P e r c e n t T P   =   1 5 0 . 0 ;  
 	 	 T a k e P r o f i t M o d e   =   " n o n e " ;  
 	 	 T a k e P r o f i t P i p s   =   2 0 0 . 0 ;  
 	 }  
  
 	 p u b l i c :   / *   C u s t o m   m e t h o d s   * /  
 	 v i r t u a l   d o u b l e   _ d V o l u m e S i z e _ ( )   { r e t u r n   d V o l u m e S i z e . _ e x e c u t e _ ( ) ; }  
 	 v i r t u a l   d o u b l e   _ d l S t o p L o s s _ ( )   { r e t u r n   d l S t o p L o s s . _ e x e c u t e _ ( ) ; }  
 	 v i r t u a l   d o u b l e   _ d p S t o p L o s s _ ( )   { r e t u r n   d p S t o p L o s s . _ e x e c u t e _ ( ) ; }  
 	 v i r t u a l   d o u b l e   _ d d S t o p L o s s _ ( )   {  
 	 	 d d S t o p L o s s . S y m b o l   =   C u r r e n t S y m b o l ( ) ;  
 	 	 d d S t o p L o s s . P e r i o d   =   C u r r e n t T i m e f r a m e ( ) ;  
  
 	 	 d o u b l e   v a l u e   =   ( d o u b l e ) d d S t o p L o s s . _ e x e c u t e _ ( ) ;  
 	 	 v a l u e   =   v a l u e * 1 . 5 ;   / /   A d j u s t   t h e   v a l u e  
 	 	 r e t u r n   v a l u e ;  
 	 }  
 	 v i r t u a l   d o u b l e   _ d l T a k e P r o f i t _ ( )   { r e t u r n   d l T a k e P r o f i t . _ e x e c u t e _ ( ) ; }  
 	 v i r t u a l   d o u b l e   _ d p T a k e P r o f i t _ ( )   { r e t u r n   d p T a k e P r o f i t . _ e x e c u t e _ ( ) ; }  
 	 v i r t u a l   d o u b l e   _ d d T a k e P r o f i t _ ( )   {  
 	 	 d d T a k e P r o f i t . S y m b o l   =   C u r r e n t S y m b o l ( ) ;  
 	 	 d d T a k e P r o f i t . P e r i o d   =   C u r r e n t T i m e f r a m e ( ) ;  
  
 	 	 r e t u r n   d d T a k e P r o f i t . _ e x e c u t e _ ( ) ;  
 	 }  
 	 v i r t u a l   d a t e t i m e   _ d E x p _ ( )   { r e t u r n   d E x p . _ e x e c u t e _ ( ) ; }  
  
 	 p u b l i c :   / *   C a l l b a c k   &   R u n   * /  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   v a l u e )   {  
 	 }  
  
 	 v i r t u a l   v o i d   _ b e f o r e E x e c u t e _ ( )  
 	 {  
 	 	 S y m b o l   =   ( s t r i n g ) C u r r e n t S y m b o l ( ) ;  
 	 	 A r r o w C o l o r S e l l   =   ( c o l o r ) c l r R e d ;  
 	 }  
 } ;  
  
 / /   B l o c k   3 5   ( B u y   n o w )  
 c l a s s   B l o c k 1 2 :   p u b l i c   M D L _ B u y N o w < s t r i n g , s t r i n g , s t r i n g , d o u b l e , d o u b l e , d o u b l e , d o u b l e , d o u b l e , M D L I C _ v a l u e _ v a l u e , d o u b l e , d o u b l e , d o u b l e , d o u b l e , d o u b l e , d o u b l e , d o u b l e , d o u b l e , i n t , i n t , d o u b l e , b o o l , d o u b l e , d o u b l e , b o o l , d o u b l e , s t r i n g , b o o l , d o u b l e , s t r i n g , s t r i n g , b o o l , d o u b l e , s t r i n g , d o u b l e , d o u b l e , d o u b l e , M D L I C _ v a l u e _ v a l u e , d o u b l e , M D L I C _ v a l u e _ v a l u e , d o u b l e , M D L I C _ i n d i c a t o r s _ i A T R , d o u b l e , s t r i n g , d o u b l e , d o u b l e , d o u b l e , M D L I C _ v a l u e _ v a l u e , d o u b l e , M D L I C _ m y i n d i c a t o r s _ m y i n d i c a t o r s _ 4 , d o u b l e , M D L I C _ i n d i c a t o r s _ i A T R , d o u b l e , s t r i n g , i n t , i n t , i n t , M D L I C _ v a l u e _ t i m e , d a t e t i m e , u l o n g , s t r i n g , c o l o r >  
 {  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 B l o c k 1 2 ( )   {  
 	 	 _ _ b l o c k _ n u m b e r   =   1 2 ;  
 	 	 _ _ b l o c k _ u s e r _ n u m b e r   =   " 3 5 " ;  
 	 	 _ b e f o r e E x e c u t e E n a b l e d   =   t r u e ;  
  
 	 	 / /   I C   i n p u t   p a r a m e t e r s  
 	 	 d V o l u m e S i z e . V a l u e   =   0 . 1 ;  
 	 	 d p S t o p L o s s . V a l u e   =   1 0 0 . 0 ;  
 	 	 d E x p . M o d e T i m e S h i f t   =   2 ;  
 	 	 d E x p . T i m e S h i f t D a y s   =   1 . 0 ;  
 	 	 d E x p . T i m e S k i p W e e k d a y s   =   t r u e ;  
 	 	 / /   B l o c k   i n p u t   p a r a m e t e r s  
 	 	 G r o u p   =   " 2 " ;  
 	 	 V o l u m e P e r c e n t   =   0 . 2 ;  
 	 	 S t o p L o s s M o d e   =   " d y n a m i c D i g i t s " ;  
 	 	 S t o p L o s s P e r c e n t T P   =   1 5 0 . 0 ;  
 	 	 T a k e P r o f i t M o d e   =   " n o n e " ;  
 	 	 T a k e P r o f i t P i p s   =   2 0 0 . 0 ;  
 	 }  
  
 	 p u b l i c :   / *   C u s t o m   m e t h o d s   * /  
 	 v i r t u a l   d o u b l e   _ d V o l u m e S i z e _ ( )   { r e t u r n   d V o l u m e S i z e . _ e x e c u t e _ ( ) ; }  
 	 v i r t u a l   d o u b l e   _ d l S t o p L o s s _ ( )   { r e t u r n   d l S t o p L o s s . _ e x e c u t e _ ( ) ; }  
 	 v i r t u a l   d o u b l e   _ d p S t o p L o s s _ ( )   { r e t u r n   d p S t o p L o s s . _ e x e c u t e _ ( ) ; }  
 	 v i r t u a l   d o u b l e   _ d d S t o p L o s s _ ( )   {  
 	 	 d d S t o p L o s s . S y m b o l   =   C u r r e n t S y m b o l ( ) ;  
 	 	 d d S t o p L o s s . P e r i o d   =   C u r r e n t T i m e f r a m e ( ) ;  
  
 	 	 d o u b l e   v a l u e   =   ( d o u b l e ) d d S t o p L o s s . _ e x e c u t e _ ( ) ;  
 	 	 v a l u e   =   v a l u e * 1 . 5 ;   / /   A d j u s t   t h e   v a l u e  
 	 	 r e t u r n   v a l u e ;  
 	 }  
 	 v i r t u a l   d o u b l e   _ d l T a k e P r o f i t _ ( )   { r e t u r n   d l T a k e P r o f i t . _ e x e c u t e _ ( ) ; }  
 	 v i r t u a l   d o u b l e   _ d p T a k e P r o f i t _ ( )   {  
 	 	 d p T a k e P r o f i t . S y m b o l   =   C u r r e n t S y m b o l ( ) ;  
 	 	 d p T a k e P r o f i t . P e r i o d   =   C u r r e n t T i m e f r a m e ( ) ;  
  
 	 	 r e t u r n   d p T a k e P r o f i t . _ e x e c u t e _ ( ) ;  
 	 }  
 	 v i r t u a l   d o u b l e   _ d d T a k e P r o f i t _ ( )   {  
 	 	 d d T a k e P r o f i t . S y m b o l   =   C u r r e n t S y m b o l ( ) ;  
 	 	 d d T a k e P r o f i t . P e r i o d   =   C u r r e n t T i m e f r a m e ( ) ;  
  
 	 	 r e t u r n   d d T a k e P r o f i t . _ e x e c u t e _ ( ) ;  
 	 }  
 	 v i r t u a l   d a t e t i m e   _ d E x p _ ( )   { r e t u r n   d E x p . _ e x e c u t e _ ( ) ; }  
  
 	 p u b l i c :   / *   C a l l b a c k   &   R u n   * /  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   v a l u e )   {  
 	 }  
  
 	 v i r t u a l   v o i d   _ b e f o r e E x e c u t e _ ( )  
 	 {  
 	 	 / *   I n p u t s ,   m o d i f i e d   i n t o   t h e   c o d e   m u s t   b e   s e t   h e r e   e v e r y   t i m e   * /  
 	 	 d p T a k e P r o f i t . R a n g e C a n d l e S t a r t   =   0 ;  
 	 	 d p T a k e P r o f i t . R a n g e C a n d l e E n d   =   1 0 ;  
 	 	 S y m b o l   =   ( s t r i n g ) C u r r e n t S y m b o l ( ) ;  
 	 	 A r r o w C o l o r B u y   =   ( c o l o r ) c l r B l u e ;  
 	 }  
 } ;  
  
 / /   B l o c k   4 6   ( o p e n & l t ;   l a s t   m i n )  
 c l a s s   B l o c k 1 3 :   p u b l i c   M D L _ C o n d i t i o n < M D L I C _ p r i c e s _ p r i c e s , d o u b l e , s t r i n g , M D L I C _ p r i c e s _ L o w e s t F r o m T o C a n d l e s , d o u b l e , i n t >  
 {  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 B l o c k 1 3 ( )   {  
 	 	 _ _ b l o c k _ n u m b e r   =   1 3 ;  
 	 	 _ _ b l o c k _ u s e r _ n u m b e r   =   " 4 6 " ;  
  
  
 	 	 / /   F i l l   t h e   l i s t   o f   o u t b o u n d   b l o c k s  
 	 	 i n t   _ _ _ o u t b o u n d _ b l o c k s [ 1 ]   =   { 7 } ;  
 	 	 A r r a y C o p y ( _ _ o u t b o u n d _ b l o c k s ,   _ _ _ o u t b o u n d _ b l o c k s ) ;  
  
 	 	 / /   I C   i n p u t   p a r a m e t e r s  
 	 	 L o . P r i c e   =   " B I D " ;  
 	 	 R o . S t a r t B a r   =   1 ;  
 	 	 / /   B l o c k   i n p u t   p a r a m e t e r s  
 	 	 c o m p a r e   =   " < " ;  
 	 }  
  
 	 p u b l i c :   / *   C u s t o m   m e t h o d s   * /  
 	 v i r t u a l   d o u b l e   _ L o _ ( )   {  
 	 	 L o . S y m b o l   =   C u r r e n t S y m b o l ( ) ;  
  
 	 	 r e t u r n   L o . _ e x e c u t e _ ( ) ;  
 	 }  
 	 v i r t u a l   d o u b l e   _ R o _ ( )   {  
 	 	 R o . S y m b o l   =   C u r r e n t S y m b o l ( ) ;  
 	 	 R o . P e r i o d   =   C u r r e n t T i m e f r a m e ( ) ;  
  
 	 	 r e t u r n   R o . _ e x e c u t e _ ( ) ;  
 	 }  
  
 	 p u b l i c :   / *   C a l l b a c k   &   R u n   * /  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   v a l u e )   {  
 	 	 i f   ( v a l u e   = =   1 )   {  
 	 	 	 _ b l o c k s _ [ 7 ] . r u n ( 1 3 ) ;  
 	 	 }  
 	 }  
 } ;  
  
 / /   B l o c k   4 7   ( o p e n & g t ;   l a s t   m a x )  
 c l a s s   B l o c k 1 4 :   p u b l i c   M D L _ C o n d i t i o n < M D L I C _ p r i c e s _ p r i c e s , d o u b l e , s t r i n g , M D L I C _ p r i c e s _ H i g h e s t F r o m T o C a n d l e s , d o u b l e , i n t >  
 {  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 B l o c k 1 4 ( )   {  
 	 	 _ _ b l o c k _ n u m b e r   =   1 4 ;  
 	 	 _ _ b l o c k _ u s e r _ n u m b e r   =   " 4 7 " ;  
  
  
 	 	 / /   F i l l   t h e   l i s t   o f   o u t b o u n d   b l o c k s  
 	 	 i n t   _ _ _ o u t b o u n d _ b l o c k s [ 1 ]   =   { 8 } ;  
 	 	 A r r a y C o p y ( _ _ o u t b o u n d _ b l o c k s ,   _ _ _ o u t b o u n d _ b l o c k s ) ;  
  
 	 	 / /   I C   i n p u t   p a r a m e t e r s  
 	 	 R o . S t a r t B a r   =   1 ;  
 	 }  
  
 	 p u b l i c :   / *   C u s t o m   m e t h o d s   * /  
 	 v i r t u a l   d o u b l e   _ L o _ ( )   {  
 	 	 L o . S y m b o l   =   C u r r e n t S y m b o l ( ) ;  
  
 	 	 r e t u r n   L o . _ e x e c u t e _ ( ) ;  
 	 }  
 	 v i r t u a l   d o u b l e   _ R o _ ( )   {  
 	 	 R o . S y m b o l   =   C u r r e n t S y m b o l ( ) ;  
 	 	 R o . P e r i o d   =   C u r r e n t T i m e f r a m e ( ) ;  
  
 	 	 r e t u r n   R o . _ e x e c u t e _ ( ) ;  
 	 }  
  
 	 p u b l i c :   / *   C a l l b a c k   &   R u n   * /  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   v a l u e )   {  
 	 	 i f   ( v a l u e   = =   1 )   {  
 	 	 	 _ b l o c k s _ [ 8 ] . r u n ( 1 4 ) ;  
 	 	 }  
 	 }  
 } ;  
  
 / /   B l o c k   5 0   ( o n c e   p e r   p o s i t i o n / o r d e r )  
 c l a s s   B l o c k 1 5 :   p u b l i c   M D L _ L o o p O n c e P e r < b o o l >  
 {  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 B l o c k 1 5 ( )   {  
 	 	 _ _ b l o c k _ n u m b e r   =   1 5 ;  
 	 	 _ _ b l o c k _ u s e r _ n u m b e r   =   " 5 0 " ;  
  
  
 	 	 / /   F i l l   t h e   l i s t   o f   o u t b o u n d   b l o c k s  
 	 	 i n t   _ _ _ o u t b o u n d _ b l o c k s [ 2 ]   =   { 2 3 , 2 4 } ;  
 	 	 A r r a y C o p y ( _ _ o u t b o u n d _ b l o c k s ,   _ _ _ o u t b o u n d _ b l o c k s ) ;  
 	 	 / /   B l o c k   i n p u t   p a r a m e t e r s  
 	 	 A l l o w O l d O r d e r s   =   t r u e ;  
 	 }  
  
 	 p u b l i c :   / *   C a l l b a c k   &   R u n   * /  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   v a l u e )   {  
 	 	 i f   ( v a l u e   = =   1 )   {  
 	 	 	 _ b l o c k s _ [ 2 3 ] . r u n ( 1 5 ) ;  
 	 	 	 _ b l o c k s _ [ 2 4 ] . r u n ( 1 5 ) ;  
 	 	 }  
 	 }  
 } ;  
  
 / /   B l o c k   6 5   ( O n c e   p e r   1 0 m i n )  
 c l a s s   B l o c k 1 6 :   p u b l i c   M D L _ O n c e P e r M i n u t e s < i n t >  
 {  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 B l o c k 1 6 ( )   {  
 	 	 _ _ b l o c k _ n u m b e r   =   1 6 ;  
 	 	 _ _ b l o c k _ u s e r _ n u m b e r   =   " 6 5 " ;  
  
  
 	 	 / /   F i l l   t h e   l i s t   o f   o u t b o u n d   b l o c k s  
 	 	 i n t   _ _ _ o u t b o u n d _ b l o c k s [ 2 ]   =   { 1 9 , 2 2 } ;  
 	 	 A r r a y C o p y ( _ _ o u t b o u n d _ b l o c k s ,   _ _ _ o u t b o u n d _ b l o c k s ) ;  
 	 	 / /   B l o c k   i n p u t   p a r a m e t e r s  
 	 	 M i n u t e s P e r i o d   =   1 0 ;  
 	 }  
  
 	 p u b l i c :   / *   C a l l b a c k   &   R u n   * /  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   v a l u e )   {  
 	 	 i f   ( v a l u e   = =   1 )   {  
 	 	 	 _ b l o c k s _ [ 1 9 ] . r u n ( 1 6 ) ;  
 	 	 	 _ b l o c k s _ [ 2 2 ] . r u n ( 1 6 ) ;  
 	 	 }  
 	 }  
 } ;  
  
 / /   B l o c k   8 1   ( T r a i l i n g   S L )  
 c l a s s   B l o c k 1 7 :   p u b l i c   M D L _ T r a i l i n g S t o p 2 < s t r i n g , s t r i n g , s t r i n g , s t r i n g , s t r i n g , i n t , i n t , s t r i n g , d o u b l e , d o u b l e , s t r i n g , d o u b l e , d o u b l e , M D L I C _ i n d i c a t o r s _ i S A R , d o u b l e , M D L I C _ i n d i c a t o r s _ i A T R , d o u b l e , s t r i n g , d o u b l e , d o u b l e , s t r i n g , d o u b l e , d o u b l e , d o u b l e , d o u b l e , M D L I C _ v a l u e _ v a l u e , d o u b l e , M D L I C _ v a l u e _ v a l u e , d o u b l e , s t r i n g , d o u b l e , d o u b l e , M D L I C _ v a l u e _ v a l u e , d o u b l e , c o l o r >  
 {  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 B l o c k 1 7 ( )   {  
 	 	 _ _ b l o c k _ n u m b e r   =   1 7 ;  
 	 	 _ _ b l o c k _ u s e r _ n u m b e r   =   " 8 1 " ;  
 	 	 _ b e f o r e E x e c u t e E n a b l e d   =   t r u e ;  
  
 	 	 / /   I C   i n p u t   p a r a m e t e r s  
 	 	 f t S t a r t . V a l u e   =   0 . 0 ;  
 	 	 f t S t a r t F r a c t i o n . V a l u e   =   0 . 0 0 1 ;  
 	 	 f t T P . V a l u e   =   0 . 0 ;  
 	 	 / /   B l o c k   i n p u t   p a r a m e t e r s  
 	 	 G r o u p   =   " 2 " ;  
 	 	 T r a i l i n g S t o p M o d e   =   " d y n a m i c D i g i t s " ;  
 	 	 t S t e p P i p s   =   5 0 . 0 ;  
 	 }  
  
 	 p u b l i c :   / *   C u s t o m   m e t h o d s   * /  
 	 v i r t u a l   d o u b l e   _ f t S t o p _ ( )   {  
 	 	 f t S t o p . S y m b o l   =   C u r r e n t S y m b o l ( ) ;  
 	 	 f t S t o p . P e r i o d   =   C u r r e n t T i m e f r a m e ( ) ;  
  
 	 	 r e t u r n   f t S t o p . _ e x e c u t e _ ( ) ;  
 	 }  
 	 v i r t u a l   d o u b l e   _ f t D i g i t s _ ( )   {  
 	 	 f t D i g i t s . S y m b o l   =   C u r r e n t S y m b o l ( ) ;  
 	 	 f t D i g i t s . P e r i o d   =   C u r r e n t T i m e f r a m e ( ) ;  
  
 	 	 d o u b l e   v a l u e   =   ( d o u b l e ) f t D i g i t s . _ e x e c u t e _ ( ) ;  
 	 	 v a l u e   =   v a l u e * 1 . 5 ;   / /   A d j u s t   t h e   v a l u e  
 	 	 r e t u r n   v a l u e ;  
 	 }  
 	 v i r t u a l   d o u b l e   _ f t S t a r t _ ( )   { r e t u r n   f t S t a r t . _ e x e c u t e _ ( ) ; }  
 	 v i r t u a l   d o u b l e   _ f t S t a r t F r a c t i o n _ ( )   { r e t u r n   f t S t a r t F r a c t i o n . _ e x e c u t e _ ( ) ; }  
 	 v i r t u a l   d o u b l e   _ f t T P _ ( )   { r e t u r n   f t T P . _ e x e c u t e _ ( ) ; }  
  
 	 p u b l i c :   / *   C a l l b a c k   &   R u n   * /  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   v a l u e )   {  
 	 }  
  
 	 v i r t u a l   v o i d   _ b e f o r e E x e c u t e _ ( )  
 	 {  
 	 	 S y m b o l   =   ( s t r i n g ) C u r r e n t S y m b o l ( ) ;  
 	 	 L e v e l C o l o r   =   ( c o l o r ) c l r D e e p P i n k ;  
 	 }  
 } ;  
  
 / /   B l o c k   8 2   ( T r a i l i n g   T P )  
 c l a s s   B l o c k 1 8 :   p u b l i c   M D L _ T r a i l i n g S t o p 2 < s t r i n g , s t r i n g , s t r i n g , s t r i n g , s t r i n g , i n t , i n t , s t r i n g , d o u b l e , d o u b l e , s t r i n g , d o u b l e , d o u b l e , M D L I C _ i n d i c a t o r s _ i S A R , d o u b l e , M D L I C _ i n d i c a t o r s _ i A T R , d o u b l e , s t r i n g , d o u b l e , d o u b l e , s t r i n g , d o u b l e , d o u b l e , d o u b l e , d o u b l e , M D L I C _ v a l u e _ v a l u e , d o u b l e , M D L I C _ v a l u e _ v a l u e , d o u b l e , s t r i n g , d o u b l e , d o u b l e , M D L I C _ v a l u e _ v a l u e , d o u b l e , c o l o r >  
 {  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 B l o c k 1 8 ( )   {  
 	 	 _ _ b l o c k _ n u m b e r   =   1 8 ;  
 	 	 _ _ b l o c k _ u s e r _ n u m b e r   =   " 8 2 " ;  
 	 	 _ b e f o r e E x e c u t e E n a b l e d   =   t r u e ;  
  
 	 	 / /   I C   i n p u t   p a r a m e t e r s  
 	 	 f t S t a r t . V a l u e   =   0 . 0 ;  
 	 	 f t S t a r t F r a c t i o n . V a l u e   =   0 . 0 0 1 ;  
 	 	 f t T P . V a l u e   =   0 . 0 ;  
 	 	 / /   B l o c k   i n p u t   p a r a m e t e r s  
 	 	 G r o u p   =   " 2 " ;  
 	 	 T r a i l W h a t   =   - 1 ;  
 	 	 T r a i l i n g S t o p M o d e   =   " d y n a m i c D i g i t s " ;  
 	 	 t S t e p P i p s   =   5 0 . 0 ;  
 	 }  
  
 	 p u b l i c :   / *   C u s t o m   m e t h o d s   * /  
 	 v i r t u a l   d o u b l e   _ f t S t o p _ ( )   {  
 	 	 f t S t o p . S y m b o l   =   C u r r e n t S y m b o l ( ) ;  
 	 	 f t S t o p . P e r i o d   =   C u r r e n t T i m e f r a m e ( ) ;  
  
 	 	 r e t u r n   f t S t o p . _ e x e c u t e _ ( ) ;  
 	 }  
 	 v i r t u a l   d o u b l e   _ f t D i g i t s _ ( )   {  
 	 	 f t D i g i t s . S y m b o l   =   C u r r e n t S y m b o l ( ) ;  
 	 	 f t D i g i t s . P e r i o d   =   C u r r e n t T i m e f r a m e ( ) ;  
  
 	 	 d o u b l e   v a l u e   =   ( d o u b l e ) f t D i g i t s . _ e x e c u t e _ ( ) ;  
 	 	 v a l u e   =   v a l u e * 1 . 5 ;   / /   A d j u s t   t h e   v a l u e  
 	 	 r e t u r n   v a l u e ;  
 	 }  
 	 v i r t u a l   d o u b l e   _ f t S t a r t _ ( )   { r e t u r n   f t S t a r t . _ e x e c u t e _ ( ) ; }  
 	 v i r t u a l   d o u b l e   _ f t S t a r t F r a c t i o n _ ( )   { r e t u r n   f t S t a r t F r a c t i o n . _ e x e c u t e _ ( ) ; }  
 	 v i r t u a l   d o u b l e   _ f t T P _ ( )   { r e t u r n   f t T P . _ e x e c u t e _ ( ) ; }  
  
 	 p u b l i c :   / *   C a l l b a c k   &   R u n   * /  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   v a l u e )   {  
 	 }  
  
 	 v i r t u a l   v o i d   _ b e f o r e E x e c u t e _ ( )  
 	 {  
 	 	 S y m b o l   =   ( s t r i n g ) C u r r e n t S y m b o l ( ) ;  
 	 	 L e v e l C o l o r   =   ( c o l o r ) c l r D e e p P i n k ;  
 	 }  
 } ;  
  
 / /   B l o c k   8 3   ( p i p s   a w a y   f r o m   t a k e - p r o f i t )  
 c l a s s   B l o c k 1 9 :   p u b l i c   M D L _ L o o p P i p s A w a y T P < s t r i n g , i n t , d o u b l e , d o u b l e , M D L I C _ v a l u e _ v a l u e , d o u b l e >  
 {  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 B l o c k 1 9 ( )   {  
 	 	 _ _ b l o c k _ n u m b e r   =   1 9 ;  
 	 	 _ _ b l o c k _ u s e r _ n u m b e r   =   " 8 3 " ;  
  
  
 	 	 / /   F i l l   t h e   l i s t   o f   o u t b o u n d   b l o c k s  
 	 	 i n t   _ _ _ o u t b o u n d _ b l o c k s [ 1 ]   =   { 1 5 } ;  
 	 	 A r r a y C o p y ( _ _ o u t b o u n d _ b l o c k s ,   _ _ _ o u t b o u n d _ b l o c k s ) ;  
 	 	 / /   B l o c k   i n p u t   p a r a m e t e r s  
 	 	 P i p s A w a y M o d e   =   " p e r c e n t S L " ;  
 	 	 P i p s A w a y   =   5 . 0 ;  
 	 	 P i p s A w a y P e r c e n t   =   1 6 6 . 0 ;  
 	 }  
  
 	 p u b l i c :   / *   C u s t o m   m e t h o d s   * /  
 	 v i r t u a l   d o u b l e   _ f P i p s A w a y _ ( )   { r e t u r n   f P i p s A w a y . _ e x e c u t e _ ( ) ; }  
  
 	 p u b l i c :   / *   C a l l b a c k   &   R u n   * /  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   v a l u e )   {  
 	 	 i f   ( v a l u e   = =   1 )   {  
 	 	 	 _ b l o c k s _ [ 1 5 ] . r u n ( 1 9 ) ;  
 	 	 }  
 	 }  
 } ;  
  
 / /   B l o c k   8 9   ( S e t   M y F l a g   - & g t ; t r u e )  
 c l a s s   B l o c k 2 0 :   p u b l i c   M D L _ F l a g S e t B < s t r i n g , b o o l >  
 {  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 B l o c k 2 0 ( )   {  
 	 	 _ _ b l o c k _ n u m b e r   =   2 0 ;  
 	 	 _ _ b l o c k _ u s e r _ n u m b e r   =   " 8 9 " ;  
  
 	 }  
  
 	 p u b l i c :   / *   C a l l b a c k   &   R u n   * /  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   v a l u e )   {  
 	 }  
 } ;  
  
 / /   B l o c k   9 0   ( S e t   M y F l a g - & g t ; t r u e )  
 c l a s s   B l o c k 2 1 :   p u b l i c   M D L _ F l a g S e t B < s t r i n g , b o o l >  
 {  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 B l o c k 2 1 ( )   {  
 	 	 _ _ b l o c k _ n u m b e r   =   2 1 ;  
 	 	 _ _ b l o c k _ u s e r _ n u m b e r   =   " 9 0 " ;  
  
 	 }  
  
 	 p u b l i c :   / *   C a l l b a c k   &   R u n   * /  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   v a l u e )   {  
 	 }  
 } ;  
  
 / /   B l o c k   9 1   ( C h e c k   M y F l a g   - & g t ; f a l s e )  
 c l a s s   B l o c k 2 2 :   p u b l i c   M D L _ F l a g C h e c k B < s t r i n g , b o o l >  
 {  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 B l o c k 2 2 ( )   {  
 	 	 _ _ b l o c k _ n u m b e r   =   2 2 ;  
 	 	 _ _ b l o c k _ u s e r _ n u m b e r   =   " 9 1 " ;  
  
  
 	 	 / /   F i l l   t h e   l i s t   o f   o u t b o u n d   b l o c k s  
 	 	 i n t   _ _ _ o u t b o u n d _ b l o c k s [ 2 ]   =   { 1 7 , 1 8 } ;  
 	 	 A r r a y C o p y ( _ _ o u t b o u n d _ b l o c k s ,   _ _ _ o u t b o u n d _ b l o c k s ) ;  
 	 }  
  
 	 p u b l i c :   / *   C a l l b a c k   &   R u n   * /  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   v a l u e )   {  
 	 	 i f   ( v a l u e   = =   1 )   {  
 	 	 	 _ b l o c k s _ [ 1 7 ] . r u n ( 2 2 ) ;  
 	 	 	 _ b l o c k s _ [ 1 8 ] . r u n ( 2 2 ) ;  
 	 	 }  
 	 }  
 } ;  
  
 / /   B l o c k   9 2   ( S e t   M y F l a g - & g t ; f a l s e )  
 c l a s s   B l o c k 2 3 :   p u b l i c   M D L _ F l a g S e t B < s t r i n g , b o o l >  
 {  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 B l o c k 2 3 ( )   {  
 	 	 _ _ b l o c k _ n u m b e r   =   2 3 ;  
 	 	 _ _ b l o c k _ u s e r _ n u m b e r   =   " 9 2 " ;  
  
 	 	 / /   B l o c k   i n p u t   p a r a m e t e r s  
 	 	 F l a g V a l u e   =   f a l s e ;  
 	 }  
  
 	 p u b l i c :   / *   C a l l b a c k   &   R u n   * /  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   v a l u e )   {  
 	 }  
 } ;  
  
 / /   B l o c k   9 3   ( M o d i f y   s t o p s   o f   p o s i t i o n s )  
 c l a s s   B l o c k 2 4 :   p u b l i c   M D L _ M o d i f y O p e n e d < s t r i n g , s t r i n g , s t r i n g , s t r i n g , s t r i n g , i n t , s t r i n g , M D L I C _ c a n d l e s _ c a n d l e s , d o u b l e , s t r i n g , d o u b l e , d o u b l e , M D L I C _ i n d i c a t o r s _ i A C , d o u b l e , d o u b l e , d o u b l e , M D L I C _ v a l u e _ v a l u e , d o u b l e , c o l o r >  
 {  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 B l o c k 2 4 ( )   {  
 	 	 _ _ b l o c k _ n u m b e r   =   2 4 ;  
 	 	 _ _ b l o c k _ u s e r _ n u m b e r   =   " 9 3 " ;  
 	 	 _ b e f o r e E x e c u t e E n a b l e d   =   t r u e ;  
  
 	 	 / /   I C   i n p u t   p a r a m e t e r s  
 	 	 f N e w T a k e P r o f i t . V a l u e   =   5 0 . 0 ;  
 	 	 / /   B l o c k   i n p u t   p a r a m e t e r s  
 	 	 G r o u p   =   " 2 " ;  
 	 	 N e w S L T P m o d e   =   " p e r c e n t " ;  
 	 	 N e w S t o p L o s s   =   0 . 0 ;  
 	 	 N e w S t o p L o s s P e r c e n t   =   1 0 5 . 0 ;  
 	 	 N e w T a k e P r o f i t P e r c e n t   =   2 5 0 . 0 ;  
 	 }  
  
 	 p u b l i c :   / *   C u s t o m   m e t h o d s   * /  
 	 v i r t u a l   d o u b l e   _ f R e l a t i v e P r i c e _ ( )   {  
 	 	 f R e l a t i v e P r i c e . S y m b o l   =   C u r r e n t S y m b o l ( ) ;  
 	 	 f R e l a t i v e P r i c e . P e r i o d   =   C u r r e n t T i m e f r a m e ( ) ;  
  
 	 	 r e t u r n   f R e l a t i v e P r i c e . _ e x e c u t e _ ( ) ;  
 	 }  
 	 v i r t u a l   d o u b l e   _ f N e w S t o p L o s s _ ( )   {  
 	 	 f N e w S t o p L o s s . S y m b o l   =   C u r r e n t S y m b o l ( ) ;  
 	 	 f N e w S t o p L o s s . P e r i o d   =   C u r r e n t T i m e f r a m e ( ) ;  
  
 	 	 r e t u r n   f N e w S t o p L o s s . _ e x e c u t e _ ( ) ;  
 	 }  
 	 v i r t u a l   d o u b l e   _ f N e w T a k e P r o f i t _ ( )   { r e t u r n   f N e w T a k e P r o f i t . _ e x e c u t e _ ( ) ; }  
  
 	 p u b l i c :   / *   C a l l b a c k   &   R u n   * /  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   v a l u e )   {  
 	 }  
  
 	 v i r t u a l   v o i d   _ b e f o r e E x e c u t e _ ( )  
 	 {  
 	 	 S y m b o l   =   ( s t r i n g ) C u r r e n t S y m b o l ( ) ;  
 	 	 L e v e l C o l o r   =   ( c o l o r ) c l r D e e p P i n k ;  
 	 }  
 } ;  
  
 / /   B l o c k   9 4   ( B B P   r i s e )  
 c l a s s   B l o c k 2 5 :   p u b l i c   M D L _ I n d i c a t o r R i s e < M D L I C _ m y i n d i c a t o r s _ m y i n d i c a t o r s _ 5 , d o u b l e , s t r i n g , i n t , i n t , d o u b l e , d o u b l e , s t r i n g >  
 {  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 B l o c k 2 5 ( )   {  
 	 	 _ _ b l o c k _ n u m b e r   =   2 5 ;  
 	 	 _ _ b l o c k _ u s e r _ n u m b e r   =   " 9 4 " ;  
 	 	 _ b e f o r e E x e c u t e E n a b l e d   =   t r u e ;  
  
 	 	 / /   F i l l   t h e   l i s t   o f   o u t b o u n d   b l o c k s  
 	 	 i n t   _ _ _ o u t b o u n d _ b l o c k s [ 1 ]   =   { 1 4 } ;  
 	 	 A r r a y C o p y ( _ _ o u t b o u n d _ b l o c k s ,   _ _ _ o u t b o u n d _ b l o c k s ) ;  
 	 	 / /   B l o c k   i n p u t   p a r a m e t e r s  
 	 	 E x c e p t i o n C a n d l e s   =   1 ;  
 	 	 R i s e V a l u e   =   1 . 0 ;  
 	 }  
  
 	 p u b l i c :   / *   C u s t o m   m e t h o d s   * /  
 	 v i r t u a l   d o u b l e   _ I n d i c a t o r _ ( )   {  
 	 	 I n d i c a t o r . S y m b o l   =   C u r r e n t S y m b o l ( ) ;  
 	 	 I n d i c a t o r . P e r i o d   =   C u r r e n t T i m e f r a m e ( ) ;  
  
 	 	 r e t u r n   I n d i c a t o r . _ e x e c u t e _ ( ) ;  
 	 }  
  
 	 p u b l i c :   / *   C a l l b a c k   &   R u n   * /  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   v a l u e )   {  
 	 	 i f   ( v a l u e   = =   1 )   {  
 	 	 	 _ b l o c k s _ [ 1 4 ] . r u n ( 2 5 ) ;  
 	 	 }  
 	 }  
  
 	 v i r t u a l   v o i d   _ b e f o r e E x e c u t e _ ( )  
 	 {  
 	 	 / *   I n p u t s ,   m o d i f i e d   i n t o   t h e   c o d e   m u s t   b e   s e t   h e r e   e v e r y   t i m e   * /  
 	 	 I n d i c a t o r . R a n g e C a n d l e S t a r t   =   0 ;  
 	 	 I n d i c a t o r . R a n g e C a n d l e E n d   =   1 0 ;  
 	 }  
 } ;  
  
 / /   B l o c k   9 5   ( B B P   f a l l )  
 c l a s s   B l o c k 2 6 :   p u b l i c   M D L _ I n d i c a t o r F a l l < M D L I C _ m y i n d i c a t o r s _ m y i n d i c a t o r s _ 6 , d o u b l e , s t r i n g , i n t , i n t , d o u b l e , d o u b l e , s t r i n g >  
 {  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 B l o c k 2 6 ( )   {  
 	 	 _ _ b l o c k _ n u m b e r   =   2 6 ;  
 	 	 _ _ b l o c k _ u s e r _ n u m b e r   =   " 9 5 " ;  
 	 	 _ b e f o r e E x e c u t e E n a b l e d   =   t r u e ;  
  
 	 	 / /   F i l l   t h e   l i s t   o f   o u t b o u n d   b l o c k s  
 	 	 i n t   _ _ _ o u t b o u n d _ b l o c k s [ 1 ]   =   { 1 3 } ;  
 	 	 A r r a y C o p y ( _ _ o u t b o u n d _ b l o c k s ,   _ _ _ o u t b o u n d _ b l o c k s ) ;  
 	 	 / /   B l o c k   i n p u t   p a r a m e t e r s  
 	 	 E x c e p t i o n C a n d l e s   =   1 ;  
 	 	 F a l l V a l u e   =   1 . 0 ;  
 	 }  
  
 	 p u b l i c :   / *   C u s t o m   m e t h o d s   * /  
 	 v i r t u a l   d o u b l e   _ I n d i c a t o r _ ( )   {  
 	 	 I n d i c a t o r . S y m b o l   =   C u r r e n t S y m b o l ( ) ;  
 	 	 I n d i c a t o r . P e r i o d   =   C u r r e n t T i m e f r a m e ( ) ;  
  
 	 	 r e t u r n   I n d i c a t o r . _ e x e c u t e _ ( ) ;  
 	 }  
  
 	 p u b l i c :   / *   C a l l b a c k   &   R u n   * /  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   v a l u e )   {  
 	 	 i f   ( v a l u e   = =   1 )   {  
 	 	 	 _ b l o c k s _ [ 1 3 ] . r u n ( 2 6 ) ;  
 	 	 }  
 	 }  
  
 	 v i r t u a l   v o i d   _ b e f o r e E x e c u t e _ ( )  
 	 {  
 	 	 / *   I n p u t s ,   m o d i f i e d   i n t o   t h e   c o d e   m u s t   b e   s e t   h e r e   e v e r y   t i m e   * /  
 	 	 I n d i c a t o r . R a n g e C a n d l e S t a r t   =   0 ;  
 	 	 I n d i c a t o r . R a n g e C a n d l e E n d   =   1 0 ;  
 	 }  
 } ;  
  
 / /   B l o c k   2 1 2   ( I f   p o s i t i o n )  
 c l a s s   B l o c k 2 7 :   p u b l i c   M D L _ I f O p e n e d O r d e r s < s t r i n g , s t r i n g , s t r i n g , s t r i n g , s t r i n g >  
 {  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 B l o c k 2 7 ( )   {  
 	 	 _ _ b l o c k _ n u m b e r   =   2 7 ;  
 	 	 _ _ b l o c k _ u s e r _ n u m b e r   =   " 2 1 2 " ;  
 	 	 _ b e f o r e E x e c u t e E n a b l e d   =   t r u e ;  
  
 	 	 / /   F i l l   t h e   l i s t   o f   o u t b o u n d   b l o c k s  
 	 	 i n t   _ _ _ o u t b o u n d _ b l o c k s [ 1 ]   =   { 1 6 } ;  
 	 	 A r r a y C o p y ( _ _ o u t b o u n d _ b l o c k s ,   _ _ _ o u t b o u n d _ b l o c k s ) ;  
 	 	 / /   B l o c k   i n p u t   p a r a m e t e r s  
 	 	 G r o u p   =   " 2 " ;  
 	 }  
  
 	 p u b l i c :   / *   C a l l b a c k   &   R u n   * /  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   v a l u e )   {  
 	 	 i f   ( v a l u e   = =   1 )   {  
 	 	 	 _ b l o c k s _ [ 1 6 ] . r u n ( 2 7 ) ;  
 	 	 }  
 	 }  
  
 	 v i r t u a l   v o i d   _ b e f o r e E x e c u t e _ ( )  
 	 {  
 	 	 S y m b o l   =   ( s t r i n g ) C u r r e n t S y m b o l ( ) ;  
 	 }  
 } ;  
  
 / /   B l o c k   2 1 5   ( 1 0 E M A & l t ;   f a s t )  
 c l a s s   B l o c k 2 8 :   p u b l i c   M D L _ C o n d i t i o n < M D L I C _ i n d i c a t o r s _ i M A , d o u b l e , s t r i n g , M D L I C _ i n d i c a t o r s _ i A M A , d o u b l e , i n t >  
 {  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 B l o c k 2 8 ( )   {  
 	 	 _ _ b l o c k _ n u m b e r   =   2 8 ;  
 	 	 _ _ b l o c k _ u s e r _ n u m b e r   =   " 2 1 5 " ;  
  
  
 	 	 / /   F i l l   t h e   l i s t   o f   o u t b o u n d   b l o c k s  
 	 	 i n t   _ _ _ o u t b o u n d _ b l o c k s [ 1 ]   =   { 3 0 } ;  
 	 	 A r r a y C o p y ( _ _ o u t b o u n d _ b l o c k s ,   _ _ _ o u t b o u n d _ b l o c k s ) ;  
  
 	 	 / /   I C   i n p u t   p a r a m e t e r s  
 	 	 L o . M A p e r i o d   =   1 0 ;  
 	 	 / /   B l o c k   i n p u t   p a r a m e t e r s  
 	 	 c o m p a r e   =   " < " ;  
 	 }  
  
 	 p u b l i c :   / *   C u s t o m   m e t h o d s   * /  
 	 v i r t u a l   d o u b l e   _ L o _ ( )   {  
 	 	 L o . M A m e t h o d   =   M O D E _ E M A ;  
 	 	 L o . A p p l i e d P r i c e   =   P R I C E _ C L O S E ;  
 	 	 L o . S y m b o l   =   C u r r e n t S y m b o l ( ) ;  
 	 	 L o . P e r i o d   =   C u r r e n t T i m e f r a m e ( ) ;  
  
 	 	 r e t u r n   L o . _ e x e c u t e _ ( ) ;  
 	 }  
 	 v i r t u a l   d o u b l e   _ R o _ ( )   {  
 	 	 R o . A p p l i e d P r i c e   =   P R I C E _ C L O S E ;  
 	 	 R o . S y m b o l   =   C u r r e n t S y m b o l ( ) ;  
 	 	 R o . P e r i o d   =   C u r r e n t T i m e f r a m e ( ) ;  
  
 	 	 r e t u r n   R o . _ e x e c u t e _ ( ) ;  
 	 }  
  
 	 p u b l i c :   / *   C a l l b a c k   &   R u n   * /  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   v a l u e )   {  
 	 	 i f   ( v a l u e   = =   1 )   {  
 	 	 	 _ b l o c k s _ [ 3 0 ] . r u n ( 2 8 ) ;  
 	 	 }  
 	 }  
 } ;  
  
 / /   B l o c k   2 4 2   ( f a s t & l t ; x   s l o w )  
 c l a s s   B l o c k 2 9 :   p u b l i c   M D L _ C o n d i t i o n < M D L I C _ i n d i c a t o r s _ i A M A , d o u b l e , s t r i n g , M D L I C _ i n d i c a t o r s _ i A M A , d o u b l e , i n t >  
 {  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 B l o c k 2 9 ( )   {  
 	 	 _ _ b l o c k _ n u m b e r   =   2 9 ;  
 	 	 _ _ b l o c k _ u s e r _ n u m b e r   =   " 2 4 2 " ;  
  
  
 	 	 / /   F i l l   t h e   l i s t   o f   o u t b o u n d   b l o c k s  
 	 	 i n t   _ _ _ o u t b o u n d _ b l o c k s [ 1 ]   =   { 2 8 } ;  
 	 	 A r r a y C o p y ( _ _ o u t b o u n d _ b l o c k s ,   _ _ _ o u t b o u n d _ b l o c k s ) ;  
  
 	 	 / /   I C   i n p u t   p a r a m e t e r s  
 	 	 R o . F a s t M A p e r i o d   =   5 ;  
 	 	 / /   B l o c k   i n p u t   p a r a m e t e r s  
 	 	 c o m p a r e   =   " < " ;  
 	 }  
  
 	 p u b l i c :   / *   C u s t o m   m e t h o d s   * /  
 	 v i r t u a l   d o u b l e   _ L o _ ( )   {  
 	 	 L o . A p p l i e d P r i c e   =   P R I C E _ C L O S E ;  
 	 	 L o . S y m b o l   =   C u r r e n t S y m b o l ( ) ;  
 	 	 L o . P e r i o d   =   C u r r e n t T i m e f r a m e ( ) ;  
  
 	 	 r e t u r n   L o . _ e x e c u t e _ ( ) ;  
 	 }  
 	 v i r t u a l   d o u b l e   _ R o _ ( )   {  
 	 	 R o . A p p l i e d P r i c e   =   P R I C E _ C L O S E ;  
 	 	 R o . S y m b o l   =   C u r r e n t S y m b o l ( ) ;  
 	 	 R o . P e r i o d   =   C u r r e n t T i m e f r a m e ( ) ;  
  
 	 	 r e t u r n   R o . _ e x e c u t e _ ( ) ;  
 	 }  
  
 	 p u b l i c :   / *   C a l l b a c k   &   R u n   * /  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   v a l u e )   {  
 	 	 i f   ( v a l u e   = =   1 )   {  
 	 	 	 _ b l o c k s _ [ 2 8 ] . r u n ( 2 9 ) ;  
 	 	 }  
 	 }  
 } ;  
  
 / /   B l o c k   2 4 3   ( O R )  
 c l a s s   B l o c k 3 0 :   p u b l i c   M D L _ L o g i c a l O R  
 {  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 B l o c k 3 0 ( )   {  
 	 	 _ _ b l o c k _ n u m b e r   =   3 0 ;  
 	 	 _ _ b l o c k _ u s e r _ n u m b e r   =   " 2 4 3 " ;  
  
  
 	 	 / /   F i l l   t h e   l i s t   o f   o u t b o u n d   b l o c k s  
 	 	 i n t   _ _ _ o u t b o u n d _ b l o c k s [ 1 ]   =   { 3 } ;  
 	 	 A r r a y C o p y ( _ _ o u t b o u n d _ b l o c k s ,   _ _ _ o u t b o u n d _ b l o c k s ) ;  
 	 }  
  
 	 p u b l i c :   / *   C a l l b a c k   &   R u n   * /  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   v a l u e )   {  
 	 	 i f   ( v a l u e   = =   1 )   {  
 	 	 	 _ b l o c k s _ [ 3 ] . r u n ( 3 0 ) ;  
 	 	 }  
 	 }  
 } ;  
  
 / /   B l o c k   2 4 4   ( 1 0 E M A & g t ;   f a s t )  
 c l a s s   B l o c k 3 1 :   p u b l i c   M D L _ C o n d i t i o n < M D L I C _ i n d i c a t o r s _ i M A , d o u b l e , s t r i n g , M D L I C _ i n d i c a t o r s _ i A M A , d o u b l e , i n t >  
 {  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 B l o c k 3 1 ( )   {  
 	 	 _ _ b l o c k _ n u m b e r   =   3 1 ;  
 	 	 _ _ b l o c k _ u s e r _ n u m b e r   =   " 2 4 4 " ;  
  
  
 	 	 / /   F i l l   t h e   l i s t   o f   o u t b o u n d   b l o c k s  
 	 	 i n t   _ _ _ o u t b o u n d _ b l o c k s [ 1 ]   =   { 3 3 } ;  
 	 	 A r r a y C o p y ( _ _ o u t b o u n d _ b l o c k s ,   _ _ _ o u t b o u n d _ b l o c k s ) ;  
  
 	 	 / /   I C   i n p u t   p a r a m e t e r s  
 	 	 L o . M A p e r i o d   =   1 0 ;  
 	 }  
  
 	 p u b l i c :   / *   C u s t o m   m e t h o d s   * /  
 	 v i r t u a l   d o u b l e   _ L o _ ( )   {  
 	 	 L o . M A m e t h o d   =   M O D E _ E M A ;  
 	 	 L o . A p p l i e d P r i c e   =   P R I C E _ C L O S E ;  
 	 	 L o . S y m b o l   =   C u r r e n t S y m b o l ( ) ;  
 	 	 L o . P e r i o d   =   C u r r e n t T i m e f r a m e ( ) ;  
  
 	 	 r e t u r n   L o . _ e x e c u t e _ ( ) ;  
 	 }  
 	 v i r t u a l   d o u b l e   _ R o _ ( )   {  
 	 	 R o . A p p l i e d P r i c e   =   P R I C E _ C L O S E ;  
 	 	 R o . S y m b o l   =   C u r r e n t S y m b o l ( ) ;  
 	 	 R o . P e r i o d   =   C u r r e n t T i m e f r a m e ( ) ;  
  
 	 	 r e t u r n   R o . _ e x e c u t e _ ( ) ;  
 	 }  
  
 	 p u b l i c :   / *   C a l l b a c k   &   R u n   * /  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   v a l u e )   {  
 	 	 i f   ( v a l u e   = =   1 )   {  
 	 	 	 _ b l o c k s _ [ 3 3 ] . r u n ( 3 1 ) ;  
 	 	 }  
 	 }  
 } ;  
  
 / /   B l o c k   2 7 1   ( f a s t & g t ; x s l o w )  
 c l a s s   B l o c k 3 2 :   p u b l i c   M D L _ C o n d i t i o n < M D L I C _ i n d i c a t o r s _ i A M A , d o u b l e , s t r i n g , M D L I C _ i n d i c a t o r s _ i A M A , d o u b l e , i n t >  
 {  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 B l o c k 3 2 ( )   {  
 	 	 _ _ b l o c k _ n u m b e r   =   3 2 ;  
 	 	 _ _ b l o c k _ u s e r _ n u m b e r   =   " 2 7 1 " ;  
  
  
 	 	 / /   F i l l   t h e   l i s t   o f   o u t b o u n d   b l o c k s  
 	 	 i n t   _ _ _ o u t b o u n d _ b l o c k s [ 1 ]   =   { 3 1 } ;  
 	 	 A r r a y C o p y ( _ _ o u t b o u n d _ b l o c k s ,   _ _ _ o u t b o u n d _ b l o c k s ) ;  
  
 	 	 / /   I C   i n p u t   p a r a m e t e r s  
 	 	 R o . F a s t M A p e r i o d   =   5 ;  
 	 }  
  
 	 p u b l i c :   / *   C u s t o m   m e t h o d s   * /  
 	 v i r t u a l   d o u b l e   _ L o _ ( )   {  
 	 	 L o . A p p l i e d P r i c e   =   P R I C E _ C L O S E ;  
 	 	 L o . S y m b o l   =   C u r r e n t S y m b o l ( ) ;  
 	 	 L o . P e r i o d   =   C u r r e n t T i m e f r a m e ( ) ;  
  
 	 	 r e t u r n   L o . _ e x e c u t e _ ( ) ;  
 	 }  
 	 v i r t u a l   d o u b l e   _ R o _ ( )   {  
 	 	 R o . A p p l i e d P r i c e   =   P R I C E _ C L O S E ;  
 	 	 R o . S y m b o l   =   C u r r e n t S y m b o l ( ) ;  
 	 	 R o . P e r i o d   =   C u r r e n t T i m e f r a m e ( ) ;  
  
 	 	 r e t u r n   R o . _ e x e c u t e _ ( ) ;  
 	 }  
  
 	 p u b l i c :   / *   C a l l b a c k   &   R u n   * /  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   v a l u e )   {  
 	 	 i f   ( v a l u e   = =   1 )   {  
 	 	 	 _ b l o c k s _ [ 3 1 ] . r u n ( 3 2 ) ;  
 	 	 }  
 	 }  
 } ;  
  
 / /   B l o c k   2 7 2   ( O R )  
 c l a s s   B l o c k 3 3 :   p u b l i c   M D L _ L o g i c a l O R  
 {  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 B l o c k 3 3 ( )   {  
 	 	 _ _ b l o c k _ n u m b e r   =   3 3 ;  
 	 	 _ _ b l o c k _ u s e r _ n u m b e r   =   " 2 7 2 " ;  
  
  
 	 	 / /   F i l l   t h e   l i s t   o f   o u t b o u n d   b l o c k s  
 	 	 i n t   _ _ _ o u t b o u n d _ b l o c k s [ 1 ]   =   { 2 } ;  
 	 	 A r r a y C o p y ( _ _ o u t b o u n d _ b l o c k s ,   _ _ _ o u t b o u n d _ b l o c k s ) ;  
 	 }  
  
 	 p u b l i c :   / *   C a l l b a c k   &   R u n   * /  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   v a l u e )   {  
 	 	 i f   ( v a l u e   = =   1 )   {  
 	 	 	 _ b l o c k s _ [ 2 ] . r u n ( 3 3 ) ;  
 	 	 }  
 	 }  
 } ;  
  
 / /   B l o c k   2 7 4   ( C l o s e   S e l l )  
 c l a s s   B l o c k 3 4 :   p u b l i c   M D L _ C l o s e O p e n e d < s t r i n g , s t r i n g , s t r i n g , s t r i n g , s t r i n g , i n t , u l o n g , c o l o r >  
 {  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 B l o c k 3 4 ( )   {  
 	 	 _ _ b l o c k _ n u m b e r   =   3 4 ;  
 	 	 _ _ b l o c k _ u s e r _ n u m b e r   =   " 2 7 4 " ;  
 	 	 _ b e f o r e E x e c u t e E n a b l e d   =   t r u e ;  
 	 	 / /   B l o c k   i n p u t   p a r a m e t e r s  
 	 	 B u y s O r S e l l s   =   " s e l l s " ;  
 	 }  
  
 	 p u b l i c :   / *   C a l l b a c k   &   R u n   * /  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   v a l u e )   {  
 	 }  
  
 	 v i r t u a l   v o i d   _ b e f o r e E x e c u t e _ ( )  
 	 {  
 	 	 S y m b o l   =   ( s t r i n g ) C u r r e n t S y m b o l ( ) ;  
 	 	 A r r o w C o l o r   =   ( c o l o r ) c l r D e e p P i n k ;  
 	 }  
 } ;  
  
 / /   B l o c k   2 7 5   ( O n c e   p e r   1 0 m i n )  
 c l a s s   B l o c k 3 5 :   p u b l i c   M D L _ O n c e P e r M i n u t e s < i n t >  
 {  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 B l o c k 3 5 ( )   {  
 	 	 _ _ b l o c k _ n u m b e r   =   3 5 ;  
 	 	 _ _ b l o c k _ u s e r _ n u m b e r   =   " 2 7 5 " ;  
  
  
 	 	 / /   F i l l   t h e   l i s t   o f   o u t b o u n d   b l o c k s  
 	 	 i n t   _ _ _ o u t b o u n d _ b l o c k s [ 2 ]   =   { 3 7 , 3 9 } ;  
 	 	 A r r a y C o p y ( _ _ o u t b o u n d _ b l o c k s ,   _ _ _ o u t b o u n d _ b l o c k s ) ;  
 	 	 / /   B l o c k   i n p u t   p a r a m e t e r s  
 	 	 M i n u t e s P e r i o d   =   1 0 ;  
 	 }  
  
 	 p u b l i c :   / *   C a l l b a c k   &   R u n   * /  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   v a l u e )   {  
 	 	 i f   ( v a l u e   = =   1 )   {  
 	 	 	 _ b l o c k s _ [ 3 7 ] . r u n ( 3 5 ) ;  
 	 	 	 _ b l o c k s _ [ 3 9 ] . r u n ( 3 5 ) ;  
 	 	 }  
 	 }  
 } ;  
  
 / /   B l o c k   2 8 0   ( I f   S e l l )  
 c l a s s   B l o c k 3 6 :   p u b l i c   M D L _ I f O p e n e d O r d e r s < s t r i n g , s t r i n g , s t r i n g , s t r i n g , s t r i n g >  
 {  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 B l o c k 3 6 ( )   {  
 	 	 _ _ b l o c k _ n u m b e r   =   3 6 ;  
 	 	 _ _ b l o c k _ u s e r _ n u m b e r   =   " 2 8 0 " ;  
 	 	 _ b e f o r e E x e c u t e E n a b l e d   =   t r u e ;  
  
 	 	 / /   F i l l   t h e   l i s t   o f   o u t b o u n d   b l o c k s  
 	 	 i n t   _ _ _ o u t b o u n d _ b l o c k s [ 1 ]   =   { 3 5 } ;  
 	 	 A r r a y C o p y ( _ _ o u t b o u n d _ b l o c k s ,   _ _ _ o u t b o u n d _ b l o c k s ) ;  
 	 	 / /   B l o c k   i n p u t   p a r a m e t e r s  
 	 	 B u y s O r S e l l s   =   " s e l l s " ;  
 	 }  
  
 	 p u b l i c :   / *   C a l l b a c k   &   R u n   * /  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   v a l u e )   {  
 	 	 i f   ( v a l u e   = =   1 )   {  
 	 	 	 _ b l o c k s _ [ 3 5 ] . r u n ( 3 6 ) ;  
 	 	 }  
 	 }  
  
 	 v i r t u a l   v o i d   _ b e f o r e E x e c u t e _ ( )  
 	 {  
 	 	 S y m b o l   =   ( s t r i n g ) C u r r e n t S y m b o l ( ) ;  
 	 }  
 } ;  
  
 / /   B l o c k   2 8 1   ( B B P & g t ; - 0 . 0 1 )  
 c l a s s   B l o c k 3 7 :   p u b l i c   M D L _ C o n d i t i o n < M D L I C _ m y i n d i c a t o r s _ m y i n d i c a t o r s _ 7 , d o u b l e , s t r i n g , M D L I C _ v a l u e _ v a l u e , d o u b l e , i n t >  
 {  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 B l o c k 3 7 ( )   {  
 	 	 _ _ b l o c k _ n u m b e r   =   3 7 ;  
 	 	 _ _ b l o c k _ u s e r _ n u m b e r   =   " 2 8 1 " ;  
 	 	 _ b e f o r e E x e c u t e E n a b l e d   =   t r u e ;  
  
 	 	 / /   F i l l   t h e   l i s t   o f   o u t b o u n d   b l o c k s  
 	 	 i n t   _ _ _ o u t b o u n d _ b l o c k s [ 1 ]   =   { 4 1 } ;  
 	 	 A r r a y C o p y ( _ _ o u t b o u n d _ b l o c k s ,   _ _ _ o u t b o u n d _ b l o c k s ) ;  
  
 	 	 / /   I C   i n p u t   p a r a m e t e r s  
 	 	 R o . V a l u e   =   - 0 . 0 1 ;  
 	 }  
  
 	 p u b l i c :   / *   C u s t o m   m e t h o d s   * /  
 	 v i r t u a l   d o u b l e   _ L o _ ( )   {  
 	 	 L o . S y m b o l   =   C u r r e n t S y m b o l ( ) ;  
 	 	 L o . P e r i o d   =   C u r r e n t T i m e f r a m e ( ) ;  
  
 	 	 r e t u r n   L o . _ e x e c u t e _ ( ) ;  
 	 }  
 	 v i r t u a l   d o u b l e   _ R o _ ( )   { r e t u r n   R o . _ e x e c u t e _ ( ) ; }  
  
 	 p u b l i c :   / *   C a l l b a c k   &   R u n   * /  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   v a l u e )   {  
 	 	 i f   ( v a l u e   = =   1 )   {  
 	 	 	 _ b l o c k s _ [ 4 1 ] . r u n ( 3 7 ) ;  
 	 	 }  
 	 }  
  
 	 v i r t u a l   v o i d   _ b e f o r e E x e c u t e _ ( )  
 	 {  
 	 	 / *   I n p u t s ,   m o d i f i e d   i n t o   t h e   c o d e   m u s t   b e   s e t   h e r e   e v e r y   t i m e   * /  
 	 	 L o . R a n g e C a n d l e S t a r t   =   0 ;  
 	 	 L o . R a n g e C a n d l e E n d   =   1 0 ;  
 	 }  
 } ;  
  
 / /   B l o c k   2 8 2   ( B B P & l t ; 0 . 0 1 )  
 c l a s s   B l o c k 3 8 :   p u b l i c   M D L _ C o n d i t i o n < M D L I C _ m y i n d i c a t o r s _ m y i n d i c a t o r s _ 8 , d o u b l e , s t r i n g , M D L I C _ v a l u e _ v a l u e , d o u b l e , i n t >  
 {  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 B l o c k 3 8 ( )   {  
 	 	 _ _ b l o c k _ n u m b e r   =   3 8 ;  
 	 	 _ _ b l o c k _ u s e r _ n u m b e r   =   " 2 8 2 " ;  
 	 	 _ b e f o r e E x e c u t e E n a b l e d   =   t r u e ;  
  
 	 	 / /   F i l l   t h e   l i s t   o f   o u t b o u n d   b l o c k s  
 	 	 i n t   _ _ _ o u t b o u n d _ b l o c k s [ 1 ]   =   { 4 3 } ;  
 	 	 A r r a y C o p y ( _ _ o u t b o u n d _ b l o c k s ,   _ _ _ o u t b o u n d _ b l o c k s ) ;  
  
 	 	 / /   I C   i n p u t   p a r a m e t e r s  
 	 	 R o . V a l u e   =   0 . 0 1 ;  
 	 	 / /   B l o c k   i n p u t   p a r a m e t e r s  
 	 	 c o m p a r e   =   " < " ;  
 	 }  
  
 	 p u b l i c :   / *   C u s t o m   m e t h o d s   * /  
 	 v i r t u a l   d o u b l e   _ L o _ ( )   {  
 	 	 L o . S y m b o l   =   C u r r e n t S y m b o l ( ) ;  
 	 	 L o . P e r i o d   =   C u r r e n t T i m e f r a m e ( ) ;  
  
 	 	 r e t u r n   L o . _ e x e c u t e _ ( ) ;  
 	 }  
 	 v i r t u a l   d o u b l e   _ R o _ ( )   { r e t u r n   R o . _ e x e c u t e _ ( ) ; }  
  
 	 p u b l i c :   / *   C a l l b a c k   &   R u n   * /  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   v a l u e )   {  
 	 	 i f   ( v a l u e   = =   1 )   {  
 	 	 	 _ b l o c k s _ [ 4 3 ] . r u n ( 3 8 ) ;  
 	 	 }  
 	 }  
  
 	 v i r t u a l   v o i d   _ b e f o r e E x e c u t e _ ( )  
 	 {  
 	 	 / *   I n p u t s ,   m o d i f i e d   i n t o   t h e   c o d e   m u s t   b e   s e t   h e r e   e v e r y   t i m e   * /  
 	 	 L o . R a n g e C a n d l e S t a r t   =   0 ;  
 	 	 L o . R a n g e C a n d l e E n d   =   1 0 ;  
 	 }  
 } ;  
  
 / /   B l o c k   2 8 5   ( T I I   r i s e )  
 c l a s s   B l o c k 3 9 :   p u b l i c   M D L _ I n d i c a t o r R i s e < M D L I C _ m y i n d i c a t o r s _ m y i n d i c a t o r s _ 9 , d o u b l e , s t r i n g , i n t , i n t , d o u b l e , d o u b l e , s t r i n g >  
 {  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 B l o c k 3 9 ( )   {  
 	 	 _ _ b l o c k _ n u m b e r   =   3 9 ;  
 	 	 _ _ b l o c k _ u s e r _ n u m b e r   =   " 2 8 5 " ;  
 	 	 _ b e f o r e E x e c u t e E n a b l e d   =   t r u e ;  
  
 	 	 / /   F i l l   t h e   l i s t   o f   o u t b o u n d   b l o c k s  
 	 	 i n t   _ _ _ o u t b o u n d _ b l o c k s [ 1 ]   =   { 4 1 } ;  
 	 	 A r r a y C o p y ( _ _ o u t b o u n d _ b l o c k s ,   _ _ _ o u t b o u n d _ b l o c k s ) ;  
 	 	 / /   B l o c k   i n p u t   p a r a m e t e r s  
 	 	 R i s e M o d e   =   " v a l u e " ;  
 	 	 R i s e C a n d l e s   =   2 ;  
 	 	 E x c e p t i o n C a n d l e s   =   1 ;  
 	 	 R i s e V a l u e   =   3 . 0 ;  
 	 }  
  
 	 p u b l i c :   / *   C u s t o m   m e t h o d s   * /  
 	 v i r t u a l   d o u b l e   _ I n d i c a t o r _ ( )   {  
 	 	 I n d i c a t o r . S y m b o l   =   C u r r e n t S y m b o l ( ) ;  
 	 	 I n d i c a t o r . P e r i o d   =   C u r r e n t T i m e f r a m e ( ) ;  
  
 	 	 r e t u r n   I n d i c a t o r . _ e x e c u t e _ ( ) ;  
 	 }  
  
 	 p u b l i c :   / *   C a l l b a c k   &   R u n   * /  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   v a l u e )   {  
 	 	 i f   ( v a l u e   = =   1 )   {  
 	 	 	 _ b l o c k s _ [ 4 1 ] . r u n ( 3 9 ) ;  
 	 	 }  
 	 }  
  
 	 v i r t u a l   v o i d   _ b e f o r e E x e c u t e _ ( )  
 	 {  
 	 	 / *   I n p u t s ,   m o d i f i e d   i n t o   t h e   c o d e   m u s t   b e   s e t   h e r e   e v e r y   t i m e   * /  
 	 	 I n d i c a t o r . R a n g e C a n d l e S t a r t   =   0 ;  
 	 	 I n d i c a t o r . R a n g e C a n d l e E n d   =   1 0 ;  
 	 }  
 } ;  
  
 / /   B l o c k   2 8 6   ( T I I   f a l l )  
 c l a s s   B l o c k 4 0 :   p u b l i c   M D L _ I n d i c a t o r F a l l < M D L I C _ m y i n d i c a t o r s _ m y i n d i c a t o r s _ 1 0 , d o u b l e , s t r i n g , i n t , i n t , d o u b l e , d o u b l e , s t r i n g >  
 {  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 B l o c k 4 0 ( )   {  
 	 	 _ _ b l o c k _ n u m b e r   =   4 0 ;  
 	 	 _ _ b l o c k _ u s e r _ n u m b e r   =   " 2 8 6 " ;  
 	 	 _ b e f o r e E x e c u t e E n a b l e d   =   t r u e ;  
  
 	 	 / /   F i l l   t h e   l i s t   o f   o u t b o u n d   b l o c k s  
 	 	 i n t   _ _ _ o u t b o u n d _ b l o c k s [ 1 ]   =   { 4 3 } ;  
 	 	 A r r a y C o p y ( _ _ o u t b o u n d _ b l o c k s ,   _ _ _ o u t b o u n d _ b l o c k s ) ;  
 	 	 / /   B l o c k   i n p u t   p a r a m e t e r s  
 	 	 F a l l M o d e   =   " v a l u e " ;  
 	 	 F a l l C a n d l e s   =   2 ;  
 	 	 E x c e p t i o n C a n d l e s   =   1 ;  
 	 	 F a l l V a l u e   =   3 . 0 ;  
 	 }  
  
 	 p u b l i c :   / *   C u s t o m   m e t h o d s   * /  
 	 v i r t u a l   d o u b l e   _ I n d i c a t o r _ ( )   {  
 	 	 I n d i c a t o r . S y m b o l   =   C u r r e n t S y m b o l ( ) ;  
 	 	 I n d i c a t o r . P e r i o d   =   C u r r e n t T i m e f r a m e ( ) ;  
  
 	 	 r e t u r n   I n d i c a t o r . _ e x e c u t e _ ( ) ;  
 	 }  
  
 	 p u b l i c :   / *   C a l l b a c k   &   R u n   * /  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   v a l u e )   {  
 	 	 i f   ( v a l u e   = =   1 )   {  
 	 	 	 _ b l o c k s _ [ 4 3 ] . r u n ( 4 0 ) ;  
 	 	 }  
 	 }  
  
 	 v i r t u a l   v o i d   _ b e f o r e E x e c u t e _ ( )  
 	 {  
 	 	 / *   I n p u t s ,   m o d i f i e d   i n t o   t h e   c o d e   m u s t   b e   s e t   h e r e   e v e r y   t i m e   * /  
 	 	 I n d i c a t o r . R a n g e C a n d l e S t a r t   =   0 ;  
 	 	 I n d i c a t o r . R a n g e C a n d l e E n d   =   1 0 ;  
 	 }  
 } ;  
  
 / /   B l o c k   2 8 7   ( A N D )  
 c l a s s   B l o c k 4 1 :   p u b l i c   M D L _ L o g i c a l A N D  
 {  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 B l o c k 4 1 ( )   {  
 	 	 _ _ b l o c k _ n u m b e r   =   4 1 ;  
 	 	 _ _ b l o c k _ u s e r _ n u m b e r   =   " 2 8 7 " ;  
  
  
 	 	 / /   F i l l   t h e   l i s t   o f   o u t b o u n d   b l o c k s  
 	 	 i n t   _ _ _ o u t b o u n d _ b l o c k s [ 1 ]   =   { 3 4 } ;  
 	 	 A r r a y C o p y ( _ _ o u t b o u n d _ b l o c k s ,   _ _ _ o u t b o u n d _ b l o c k s ) ;  
 	 }  
  
 	 p u b l i c :   / *   C a l l b a c k   &   R u n   * /  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   v a l u e )   {  
 	 	 i f   ( v a l u e   = =   1 )   {  
 	 	 	 _ b l o c k s _ [ 3 4 ] . r u n ( 4 1 ) ;  
 	 	 }  
 	 }  
 } ;  
  
 / /   B l o c k   2 8 8   ( C l o s e   B u y )  
 c l a s s   B l o c k 4 2 :   p u b l i c   M D L _ C l o s e O p e n e d < s t r i n g , s t r i n g , s t r i n g , s t r i n g , s t r i n g , i n t , u l o n g , c o l o r >  
 {  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 B l o c k 4 2 ( )   {  
 	 	 _ _ b l o c k _ n u m b e r   =   4 2 ;  
 	 	 _ _ b l o c k _ u s e r _ n u m b e r   =   " 2 8 8 " ;  
 	 	 _ b e f o r e E x e c u t e E n a b l e d   =   t r u e ;  
 	 	 / /   B l o c k   i n p u t   p a r a m e t e r s  
 	 	 B u y s O r S e l l s   =   " b u y s " ;  
 	 }  
  
 	 p u b l i c :   / *   C a l l b a c k   &   R u n   * /  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   v a l u e )   {  
 	 }  
  
 	 v i r t u a l   v o i d   _ b e f o r e E x e c u t e _ ( )  
 	 {  
 	 	 S y m b o l   =   ( s t r i n g ) C u r r e n t S y m b o l ( ) ;  
 	 	 A r r o w C o l o r   =   ( c o l o r ) c l r D e e p P i n k ;  
 	 }  
 } ;  
  
 / /   B l o c k   2 8 9   ( A N D )  
 c l a s s   B l o c k 4 3 :   p u b l i c   M D L _ L o g i c a l A N D  
 {  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 B l o c k 4 3 ( )   {  
 	 	 _ _ b l o c k _ n u m b e r   =   4 3 ;  
 	 	 _ _ b l o c k _ u s e r _ n u m b e r   =   " 2 8 9 " ;  
  
  
 	 	 / /   F i l l   t h e   l i s t   o f   o u t b o u n d   b l o c k s  
 	 	 i n t   _ _ _ o u t b o u n d _ b l o c k s [ 1 ]   =   { 4 2 } ;  
 	 	 A r r a y C o p y ( _ _ o u t b o u n d _ b l o c k s ,   _ _ _ o u t b o u n d _ b l o c k s ) ;  
 	 }  
  
 	 p u b l i c :   / *   C a l l b a c k   &   R u n   * /  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   v a l u e )   {  
 	 	 i f   ( v a l u e   = =   1 )   {  
 	 	 	 _ b l o c k s _ [ 4 2 ] . r u n ( 4 3 ) ;  
 	 	 }  
 	 }  
 } ;  
  
 / /   B l o c k   2 9 0   ( O n c e   p e r   1 0 m i n )  
 c l a s s   B l o c k 4 4 :   p u b l i c   M D L _ O n c e P e r M i n u t e s < i n t >  
 {  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 B l o c k 4 4 ( )   {  
 	 	 _ _ b l o c k _ n u m b e r   =   4 4 ;  
 	 	 _ _ b l o c k _ u s e r _ n u m b e r   =   " 2 9 0 " ;  
  
  
 	 	 / /   F i l l   t h e   l i s t   o f   o u t b o u n d   b l o c k s  
 	 	 i n t   _ _ _ o u t b o u n d _ b l o c k s [ 2 ]   =   { 3 8 , 4 0 } ;  
 	 	 A r r a y C o p y ( _ _ o u t b o u n d _ b l o c k s ,   _ _ _ o u t b o u n d _ b l o c k s ) ;  
 	 	 / /   B l o c k   i n p u t   p a r a m e t e r s  
 	 	 M i n u t e s P e r i o d   =   1 0 ;  
 	 }  
  
 	 p u b l i c :   / *   C a l l b a c k   &   R u n   * /  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   v a l u e )   {  
 	 	 i f   ( v a l u e   = =   1 )   {  
 	 	 	 _ b l o c k s _ [ 3 8 ] . r u n ( 4 4 ) ;  
 	 	 	 _ b l o c k s _ [ 4 0 ] . r u n ( 4 4 ) ;  
 	 	 }  
 	 }  
 } ;  
  
 / /   B l o c k   2 9 5   ( I f   B u y )  
 c l a s s   B l o c k 4 5 :   p u b l i c   M D L _ I f O p e n e d O r d e r s < s t r i n g , s t r i n g , s t r i n g , s t r i n g , s t r i n g >  
 {  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 B l o c k 4 5 ( )   {  
 	 	 _ _ b l o c k _ n u m b e r   =   4 5 ;  
 	 	 _ _ b l o c k _ u s e r _ n u m b e r   =   " 2 9 5 " ;  
 	 	 _ b e f o r e E x e c u t e E n a b l e d   =   t r u e ;  
  
 	 	 / /   F i l l   t h e   l i s t   o f   o u t b o u n d   b l o c k s  
 	 	 i n t   _ _ _ o u t b o u n d _ b l o c k s [ 1 ]   =   { 4 4 } ;  
 	 	 A r r a y C o p y ( _ _ o u t b o u n d _ b l o c k s ,   _ _ _ o u t b o u n d _ b l o c k s ) ;  
 	 	 / /   B l o c k   i n p u t   p a r a m e t e r s  
 	 	 B u y s O r S e l l s   =   " b u y s " ;  
 	 }  
  
 	 p u b l i c :   / *   C a l l b a c k   &   R u n   * /  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   v a l u e )   {  
 	 	 i f   ( v a l u e   = =   1 )   {  
 	 	 	 _ b l o c k s _ [ 4 4 ] . r u n ( 4 5 ) ;  
 	 	 }  
 	 }  
  
 	 v i r t u a l   v o i d   _ b e f o r e E x e c u t e _ ( )  
 	 {  
 	 	 S y m b o l   =   ( s t r i n g ) C u r r e n t S y m b o l ( ) ;  
 	 }  
 } ;  
  
 / /   B l o c k   2 9 8   ( S e t   T r a d e F l a g - - & g t ; f a l s e )  
 c l a s s   B l o c k 4 6 :   p u b l i c   M D L _ F l a g S e t B < s t r i n g , b o o l >  
 {  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 B l o c k 4 6 ( )   {  
 	 	 _ _ b l o c k _ n u m b e r   =   4 6 ;  
 	 	 _ _ b l o c k _ u s e r _ n u m b e r   =   " 2 9 8 " ;  
  
 	 	 / /   B l o c k   i n p u t   p a r a m e t e r s  
 	 	 F l a g N a m e   =   " T r a d e F l a g " ;  
 	 	 F l a g V a l u e   =   f a l s e ;  
 	 }  
  
 	 p u b l i c :   / *   C a l l b a c k   &   R u n   * /  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   v a l u e )   {  
 	 }  
 } ;  
  
 / /   B l o c k   2 9 9   ( S e t   T r a d e F l a g - - & g t ; t r u e )  
 c l a s s   B l o c k 4 7 :   p u b l i c   M D L _ F l a g S e t B < s t r i n g , b o o l >  
 {  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 B l o c k 4 7 ( )   {  
 	 	 _ _ b l o c k _ n u m b e r   =   4 7 ;  
 	 	 _ _ b l o c k _ u s e r _ n u m b e r   =   " 2 9 9 " ;  
  
 	 	 / /   B l o c k   i n p u t   p a r a m e t e r s  
 	 	 F l a g N a m e   =   " T r a d e F l a g " ;  
 	 }  
  
 	 p u b l i c :   / *   C a l l b a c k   &   R u n   * /  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   v a l u e )   {  
 	 }  
 } ;  
  
 / /   B l o c k   3 0 0   ( S e r   T r a d e F l a g - - & g t ; t r u e )  
 c l a s s   B l o c k 4 8 :   p u b l i c   M D L _ F l a g S e t B < s t r i n g , b o o l >  
 {  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 B l o c k 4 8 ( )   {  
 	 	 _ _ b l o c k _ n u m b e r   =   4 8 ;  
 	 	 _ _ b l o c k _ u s e r _ n u m b e r   =   " 3 0 0 " ;  
  
 	 	 / /   B l o c k   i n p u t   p a r a m e t e r s  
 	 	 F l a g N a m e   =   " T r a d e F l a g " ;  
 	 }  
  
 	 p u b l i c :   / *   C a l l b a c k   &   R u n   * /  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   v a l u e )   {  
 	 }  
 } ;  
  
 / /   B l o c k   3 0 1   ( T r a d e F l a g   ( t r u e - f a l s e ) )  
 c l a s s   B l o c k 4 9 :   p u b l i c   M D L _ F l a g S e t B < s t r i n g , b o o l >  
 {  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 B l o c k 4 9 ( )   {  
 	 	 _ _ b l o c k _ n u m b e r   =   4 9 ;  
 	 	 _ _ b l o c k _ u s e r _ n u m b e r   =   " 3 0 1 " ;  
  
 	 	 / /   B l o c k   i n p u t   p a r a m e t e r s  
 	 	 F l a g N a m e   =   " T r a d e F l a g " ;  
 	 	 F l a g V a l u e   =   f a l s e ;  
 	 }  
  
 	 p u b l i c :   / *   C a l l b a c k   &   R u n   * /  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   v a l u e )   {  
 	 }  
 } ;  
  
 / /   B l o c k   3 0 2   ( P a s s )  
 c l a s s   B l o c k 5 0 :   p u b l i c   M D L _ P a s s  
 {  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 B l o c k 5 0 ( )   {  
 	 	 _ _ b l o c k _ n u m b e r   =   5 0 ;  
 	 	 _ _ b l o c k _ u s e r _ n u m b e r   =   " 3 0 2 " ;  
  
  
 	 	 / /   F i l l   t h e   l i s t   o f   o u t b o u n d   b l o c k s  
 	 	 i n t   _ _ _ o u t b o u n d _ b l o c k s [ 1 ]   =   { 4 9 } ;  
 	 	 A r r a y C o p y ( _ _ o u t b o u n d _ b l o c k s ,   _ _ _ o u t b o u n d _ b l o c k s ) ;  
 	 }  
  
 	 p u b l i c :   / *   C a l l b a c k   &   R u n   * /  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   v a l u e )   {  
 	 	 i f   ( v a l u e   = =   1 )   {  
 	 	 	 _ b l o c k s _ [ 4 9 ] . r u n ( 5 0 ) ;  
 	 	 }  
 	 }  
 } ;  
  
 / /   B l o c k   3 0 3   ( C h e c k   B u y   ( l a s t   c l o s e d ) )  
 c l a s s   B l o c k 5 1 :   p u b l i c   M D L _ C h e c k L a s t O r d e r T y p e < s t r i n g , s t r i n g , s t r i n g , s t r i n g , i n t , b o o l >  
 {  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 B l o c k 5 1 ( )   {  
 	 	 _ _ b l o c k _ n u m b e r   =   5 1 ;  
 	 	 _ _ b l o c k _ u s e r _ n u m b e r   =   " 3 0 3 " ;  
 	 	 _ b e f o r e E x e c u t e E n a b l e d   =   t r u e ;  
  
 	 	 / /   F i l l   t h e   l i s t   o f   o u t b o u n d   b l o c k s  
 	 	 i n t   _ _ _ o u t b o u n d _ b l o c k s [ 1 ]   =   { 5 3 } ;  
 	 	 A r r a y C o p y ( _ _ o u t b o u n d _ b l o c k s ,   _ _ _ o u t b o u n d _ b l o c k s ) ;  
 	 	 / /   B l o c k   i n p u t   p a r a m e t e r s  
 	 	 G r o u p   =   " 2 " ;  
 	 }  
  
 	 p u b l i c :   / *   C a l l b a c k   &   R u n   * /  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   v a l u e )   {  
 	 	 i f   ( v a l u e   = =   1 )   {  
 	 	 	 _ b l o c k s _ [ 5 3 ] . r u n ( 5 1 ) ;  
 	 	 }  
 	 }  
  
 	 v i r t u a l   v o i d   _ b e f o r e E x e c u t e _ ( )  
 	 {  
 	 	 S y m b o l   =   ( s t r i n g ) C u r r e n t S y m b o l ( ) ;  
 	 }  
 } ;  
  
 / /   B l o c k   3 0 4   ( C h e c k   S e l l   ( l a s t   c l o s e d ) )  
 c l a s s   B l o c k 5 2 :   p u b l i c   M D L _ C h e c k L a s t O r d e r T y p e < s t r i n g , s t r i n g , s t r i n g , s t r i n g , i n t , b o o l >  
 {  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 B l o c k 5 2 ( )   {  
 	 	 _ _ b l o c k _ n u m b e r   =   5 2 ;  
 	 	 _ _ b l o c k _ u s e r _ n u m b e r   =   " 3 0 4 " ;  
 	 	 _ b e f o r e E x e c u t e E n a b l e d   =   t r u e ;  
  
 	 	 / /   F i l l   t h e   l i s t   o f   o u t b o u n d   b l o c k s  
 	 	 i n t   _ _ _ o u t b o u n d _ b l o c k s [ 1 ]   =   { 5 3 } ;  
 	 	 A r r a y C o p y ( _ _ o u t b o u n d _ b l o c k s ,   _ _ _ o u t b o u n d _ b l o c k s ) ;  
 	 	 / /   B l o c k   i n p u t   p a r a m e t e r s  
 	 	 G r o u p   =   " 2 " ;  
 	 	 L a s t O r d e r T y p e   =   1 ;  
 	 }  
  
 	 p u b l i c :   / *   C a l l b a c k   &   R u n   * /  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   v a l u e )   {  
 	 	 i f   ( v a l u e   = =   1 )   {  
 	 	 	 _ b l o c k s _ [ 5 3 ] . r u n ( 5 2 ) ;  
 	 	 }  
 	 }  
  
 	 v i r t u a l   v o i d   _ b e f o r e E x e c u t e _ ( )  
 	 {  
 	 	 S y m b o l   =   ( s t r i n g ) C u r r e n t S y m b o l ( ) ;  
 	 }  
 } ;  
  
 / /   B l o c k   3 0 5   ( O R )  
 c l a s s   B l o c k 5 3 :   p u b l i c   M D L _ L o g i c a l O R  
 {  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 B l o c k 5 3 ( )   {  
 	 	 _ _ b l o c k _ n u m b e r   =   5 3 ;  
 	 	 _ _ b l o c k _ u s e r _ n u m b e r   =   " 3 0 5 " ;  
  
  
 	 	 / /   F i l l   t h e   l i s t   o f   o u t b o u n d   b l o c k s  
 	 	 i n t   _ _ _ o u t b o u n d _ b l o c k s [ 1 ]   =   { 4 6 } ;  
 	 	 A r r a y C o p y ( _ _ o u t b o u n d _ b l o c k s ,   _ _ _ o u t b o u n d _ b l o c k s ) ;  
 	 }  
  
 	 p u b l i c :   / *   C a l l b a c k   &   R u n   * /  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   v a l u e )   {  
 	 	 i f   ( v a l u e   = =   1 )   {  
 	 	 	 _ b l o c k s _ [ 4 6 ] . r u n ( 5 3 ) ;  
 	 	 }  
 	 }  
 } ;  
  
 / /   B l o c k   3 0 6   ( C h e c k   T r a d e F l a g   - - & g t ;   f a l s e )  
 c l a s s   B l o c k 5 4 :   p u b l i c   M D L _ F l a g C h e c k B < s t r i n g , b o o l >  
 {  
  
 	 p u b l i c :   / *   C o n s t r u c t o r   * /  
 	 B l o c k 5 4 ( )   {  
 	 	 _ _ b l o c k _ n u m b e r   =   5 4 ;  
 	 	 _ _ b l o c k _ u s e r _ n u m b e r   =   " 3 0 6 " ;  
  
  
 	 	 / /   F i l l   t h e   l i s t   o f   o u t b o u n d   b l o c k s  
 	 	 i n t   _ _ _ o u t b o u n d _ b l o c k s [ 1 ]   =   { 6 } ;  
 	 	 A r r a y C o p y ( _ _ o u t b o u n d _ b l o c k s ,   _ _ _ o u t b o u n d _ b l o c k s ) ;  
 	 	 / /   B l o c k   i n p u t   p a r a m e t e r s  
 	 	 F l a g N a m e   =   " T r a d e F l a g " ;  
 	 	 F l a g V a l u e   =   f a l s e ;  
 	 }  
  
 	 p u b l i c :   / *   C a l l b a c k   &   R u n   * /  
 	 v i r t u a l   v o i d   _ c a l l b a c k _ ( i n t   v a l u e )   {  
 	 	 i f   ( v a l u e   = =   1 )   {  
 	 	 	 _ b l o c k s _ [ 6 ] . r u n ( 5 4 ) ;  
 	 	 }  
 	 }  
 } ;  
  
  
 / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /  
 / /   + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +   / /  
 / /   |                                                                                                       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   N o r m a l i z e D o u b l e ( 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 ) ,   2 ) ; 
 }  
  
 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   =   N o r m a l i z e D o u b l e ( 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 ) ,   2 ) ; 
 
 	 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 ( 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   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 ) 
 { 
 	 d o u b l e   L o t S t e p   =   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   L o t 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 _ C O N T R A C T _ S I Z E ) ; 
 	 d o u b l e   M i n L o t s   =   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   M a x L o t s   =   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 ) ; 
 
 	 i f   ( L o t S t e p   >   M i n L o t s )   M i n L o t s   =   L o t S t e p ; 
 
 	 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 ; 
 	 } 
 
 	 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 _ 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   <   2 ) 
 	 { 
 	 	 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   & &   s l   ! =   s l o ) 
 	 { 
 	 	 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 ) ) 
 	 	 { 
 	 	 	 i f   ( U S E _ V I R T U A L _ S T O P S ) 
 	 	 	 { 
 	 	 	 	 r e t u r n   s l ; 
 	 	 	 } 
 
 	 	 	 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 ; 
 	 } 
 
 	 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 _ 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   <   2 ) 
 	 { 
 	 	 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   ( ( 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 ) ) 
 	 	 { 
 	 	 	 i f   ( U S E _ V I R T U A L _ S T O P S ) 
 	 	 	 { 
 	 	 	 	 r e t u r n   t p ; 
 	 	 	 } 
 
 	 	 	 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 > 
 b o o l   A r r a y E n s u r e V a l u e ( T   & a r r a y [ ] ,   T   v a l u e ) 
 { 
 	 i n t   s i z e       =   A r r a y S i z e ( a r r a y ) ; 
 	 
 	 i f   ( s i z e   >   0 ) 
 	 { 
 	 	 i f   ( I n A r r a y ( a r r a y ,   v a l u e ) ) 
 	 	 { 
 	 	 	 / /   v a l u e   f o u n d   - >   e x i t 
 	 	 	 r e t u r n   f a l s e ;   / /   n o   v a l u e   a d d e d 
 	 	 } 
 	 } 
 	 
 	 / /   v a l u e   d o e s   n o t   e x i s t s   - >   a d d   i t 
 	 A r r a y R e s i z e ( a r r a y ,   s i z e + 1 ) ; 
 	 a r r a y [ s i z e ]   =   v a l u e ; 
 	 	 
 	 r e t u r n   t r u e ;   / /   v a l u e   a d d e d 
 }  
  
 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 
 }  
  
 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 V a l u e ( T   & a r r a y [ ] ,   T   v a l u e ) 
 { 
 	 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   ( a r r a y [ i ]   ! =   v a l u e ) 
 	 	 { 
 	 	 	 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 
 }  
  
 d o u b l e   B e t 1 3 2 6 ( 
 	 s t r i n g   g r o u p , 
 	 s t r i n g   s y m b o l , 
 	 d o u b l e   i n i t i a l _ l o t s , 
 	 b o o l   r e v e r s e   =   f a l s e 
 )   {     
 	 i n t   p o s                         =   0 ; 
 	 i n t   t o t a l                     =   0 ; 
 	 d o u b l e   l o t s                 =   0 ; 
 	 d o u b l e   p r o f i t             =   0 ; 
 	 i n t   p r o f i t _ o r _ l o s s   =   0 ;   / /   0   -   u n k n o w n ,   1   -   p r o f i t ,   - 1   -   l o s s 
       
       / / - -   t r y   t o   g e t   l a s t   l o t   s i z e   f r o m   r u n n i n g   t r a d e s 
 	 t o t a l   =   T r a d e s T o t a l ( ) ; 
 	 
 	 f o r   ( p o s   =   t o t a l   -   1 ;   p o s   > =   0 ;   p o s - - ) 
 	 { 
 	 	 i f   ( T r a d e S e l e c t B y I n d e x ( p o s ,   " g r o u p " ,   g r o u p ,   " s y m b o l " ,   s y m b o l ) ) 
 	 	 { 
 	 	 	 i f   ( T i m e C u r r e n t ( )   -   O r d e r O p e n T i m e ( )   <   3 )   { c o n t i n u e ; } 
 
 	 	 	 i f   ( l o t s   = =   0 ) 
 	 	 	 { 
 	 	 	 	 l o t s   =   O r d e r L o t s ( ) ; 
 	 	 	 } 
 
 	 	 	 p r o f i t   =   O r d e r C l o s e P r i c e ( )   -   O r d e r O p e n P r i c e ( ) ; 
 	 	 	 p r o f i t   =   N o r m a l i z e D o u b l e ( p r o f i t ,   S y m b o l D i g i t s ( O r d e r S y m b o l ( ) ) ) ; 
 
 	 	 	 i f   ( I s O r d e r T y p e S e l l ( ) ) 
 	 	 	 { 
 	 	 	 	 p r o f i t   =   - 1   *   p r o f i t ; 
 	 	 	 } 
 
 	 	 	 i f   ( p r o f i t   = =   0 ) 
 	 	 	 { 
 	 	 	 	 r e t u r n   l o t s ; 
 	 	 	 } 
 
 	 	 	 i f   ( p r o f i t < 0 )   { p r o f i t _ o r _ l o s s = - 1 ; } 
 	 	 	 e l s e   { p r o f i t _ o r _ l o s s = 1 ; } 
 
 	 	 	 b r e a k ; 
 	 	 } 
 	 } 
       
       / / - -   i f   n o   r u n n i n g   t r a d e   w a s   f o u n d ,   s e a r c h   i n   h i s t o r y   t r a d e s 
       i f   ( l o t s = = 0 ) 
       { 
             t o t a l   =   H i s t o r y T r a d e s T o t a l ( ) ; 
 
 	 	 f o r   ( p o s   =   t o t a l   -   1 ;   p o s   > =   0 ;   p o s - - ) 
             { 
 	 	 	 i f   ( H i s t o r y T r a d e S e l e c t B y I n d e x ( p o s ,   " g r o u p " ,   g r o u p ,   " s y m b o l " ,   s y m b o l ) ) 
 	 	 	 { 
 	 	 	 	 i f   ( T i m e C u r r e n t ( )   -   O r d e r O p e n T i m e ( )   <   3 )   { c o n t i n u e ; } 
 
 	 	 	 	 i f   ( l o t s   = =   0 ) 
 	 	 	 	 { 
 	 	 	 	 	 l o t s   =   O r d e r L o t s ( ) ; 
 	 	 	 	 } 
 
 	 	 	 	 p r o f i t   =   O r d e r C l o s e P r i c e ( )   -   O r d e r O p e n P r i c e ( ) ; 
 	 	 	 	 p r o f i t   =   N o r m a l i z e D o u b l e ( p r o f i t ,   S y m b o l D i g i t s ( O r d e r S y m b o l ( ) ) ) ; 
 	 	 	 	 i f   ( O r d e r T y p e ( )   = =   0 )   { p r o f i t   =   - 1 * p r o f i t ; } 
 	 	 	 	 i f   ( p r o f i t   = =   0 )   { 
 	 	 	 	 	 r e t u r n ( l o t s ) ; 
 	 	 	 	 } 
 
 	 	 	 	 i f   ( p r o f i t < 0 )   { p r o f i t _ o r _ l o s s = - 1 ; } 
 	 	 	 	 e l s e   { p r o f i t _ o r _ l o s s = 1 ; } 
 
 	 	 	 	 b r e a k ; 
 	 	 	 } 
             } 
       } 
       
       / / - - 
       i f   ( i n i t i a l _ l o t s   <   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 ) )   { 
             i n i t i a l _ l o t s   =   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 ) ;     
       } 
 
       i f   ( l o t s = = 0 )   { l o t s   =   i n i t i a l _ l o t s ; } 
       e l s e 
       { 
             i f   ( ( r e v e r s e = = f a l s e   & &   p r o f i t _ o r _ l o s s = = 1 )   | |   ( r e v e r s e = = t r u e   & &   p r o f i t _ o r _ l o s s = = - 1 ) ) 
             { 
                   d o u b l e   d i v   =   l o t s / i n i t i a l _ l o t s ; 
                   
                   i f   ( d i v   <   1 . 5 )   { l o t s   =   i n i t i a l _ l o t s * 3 ; } 
                   e l s e   i f   ( d i v   <   2 . 5 )   { l o t s   =   i n i t i a l _ l o t s * 6 ; } 
                   e l s e   i f   ( d i v   <   3 . 5 )   { l o t s   =   i n i t i a l _ l o t s * 2 ; } 
                   e l s e   { l o t s   =   i n i t i a l _ l o t s ; } 
             } 
             e l s e   { 
                   l o t s   =   i n i t i a l _ l o t s ; 
             } 
       } 
       
       r e t u r n   l o t s ; 
 }  
  
 d o u b l e   B e t D a l e m b e r t ( 
 	 s t r i n g   g r o u p , 
 	 s t r i n g   s y m b o l , 
 	 d o u b l e   i n i t i a l _ l o t s , 
 	 d o u b l e   r e v e r s e   =   f a l s e 
 )   {     
 	 i n t   p o s                         =   0 ; 
 	 i n t   t o t a l                     =   0 ; 
 	 d o u b l e   l o t s                 =   0 ; 
 	 d o u b l e   p r o f i t             =   0 ; 
 	 i n t   p r o f i t _ o r _ l o s s   =   0 ;   / /   0   -   u n k n o w n ,   1   -   p r o f i t ,   - 1   -   l o s s 
       
       / / - -   t r y   t o   g e t   l a s t   l o t   s i z e   f r o m   r u n n i n g   t r a d e s 
 	 t o t a l   =   T r a d e s T o t a l ( ) ; 
 	 
 	 f o r   ( p o s   =   t o t a l   -   1 ;   p o s   > =   0 ;   p o s - - ) 
 	 { 
 	 	 i f   ( T r a d e S e l e c t B y I n d e x ( p o s ,   " g r o u p " ,   g r o u p ,   " s y m b o l " ,   s y m b o l ) ) 
 	 	 { 
 	 	 	 i f   ( T i m e C u r r e n t ( )   -   O r d e r O p e n T i m e ( )   <   3 )   { c o n t i n u e ; } 
 
 	 	 	 i f   ( l o t s   = =   0 ) 
 	 	 	 { 
 	 	 	 	 l o t s   =   O r d e r L o t s ( ) ; 
 	 	 	 } 
 
 	 	 	 p r o f i t   =   O r d e r C l o s e P r i c e ( )   -   O r d e r O p e n P r i c e ( ) ; 
 	 	 	 p r o f i t   =   N o r m a l i z e D o u b l e ( p r o f i t ,   S y m b o l D i g i t s ( O r d e r S y m b o l ( ) ) ) ; 
 
 	 	 	 i f   ( I s O r d e r T y p e S e l l ( ) ) 
 	 	 	 { 
 	 	 	 	 p r o f i t   =   - 1   *   p r o f i t ; 
 	 	 	 } 
 
 	 	 	 i f   ( p r o f i t   = =   0 ) 
 	 	 	 { 
 	 	 	 	 r e t u r n   l o t s ; 
 	 	 	 } 
 
 	 	 	 i f   ( p r o f i t < 0 )   { p r o f i t _ o r _ l o s s = - 1 ; } 
 	 	 	 e l s e   { p r o f i t _ o r _ l o s s = 1 ; } 
 
 	 	 	 b r e a k ; 
 	 	 } 
 	 } 
       
       / / - -   i f   n o   r u n n i n g   t r a d e   w a s   f o u n d ,   s e a r c h   i n   h i s t o r y   t r a d e s 
       i f   ( l o t s = = 0 ) 
       { 
             t o t a l   =   H i s t o r y T r a d e s T o t a l ( ) ; 
 
 	 	 f o r   ( p o s   =   t o t a l   -   1 ;   p o s   > =   0 ;   p o s - - ) 
             { 
 	 	 	 i f   ( H i s t o r y T r a d e S e l e c t B y I n d e x ( p o s ,   " g r o u p " ,   g r o u p ,   " s y m b o l " ,   s y m b o l ) ) 
 	 	 	 { 
 	 	 	 	 i f   ( T i m e C u r r e n t ( )   -   O r d e r O p e n T i m e ( )   <   3 )   { c o n t i n u e ; } 
 
 	 	 	 	 i f   ( l o t s   = =   0 ) 
 	 	 	 	 { 
 	 	 	 	 	 l o t s   =   O r d e r L o t s ( ) ; 
 	 	 	 	 } 
 
 	 	 	 	 p r o f i t   =   O r d e r C l o s e P r i c e ( )   -   O r d e r O p e n P r i c e ( ) ; 
 	 	 	 	 p r o f i t   =   N o r m a l i z e D o u b l e ( p r o f i t ,   S y m b o l D i g i t s ( O r d e r S y m b o l ( ) ) ) ; 
 	 	 	 	 i f   ( O r d e r T y p e ( )   = =   0 )   { p r o f i t   =   - 1 * p r o f i t ; } 
 	 	 	 	 i f   ( p r o f i t   = =   0 )   { 
 	 	 	 	 	 r e t u r n ( l o t s ) ; 
 	 	 	 	 } 
 
 	 	 	 	 i f   ( p r o f i t < 0 )   { p r o f i t _ o r _ l o s s = - 1 ; } 
 	 	 	 	 e l s e   { p r o f i t _ o r _ l o s s = 1 ; } 
 
 	 	 	 	 b r e a k ; 
 	 	 	 } 
             } 
       } 
       
       / / - - 
       i f   ( i n i t i a l _ l o t s   <   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 ) )   { 
             i n i t i a l _ l o t s   =   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 ) ;     
       } 
 
       i f   ( l o t s = = 0 )   { l o t s   =   i n i t i a l _ l o t s ; } 
       e l s e 
       { 
             i f   ( ( r e v e r s e = = 0   & &   p r o f i t _ o r _ l o s s = = 1 )   | |   ( r e v e r s e = = 1   & &   p r o f i t _ o r _ l o s s = = - 1 ) ) 
             { 
                   l o t s   =   l o t s   -   i n i t i a l _ l o t s ; 
                   i f   ( l o t s   <   i n i t i a l _ l o t s )   { l o t s   =   i n i t i a l _ l o t s ; } 
             } 
             e l s e   { 
                   l o t s   =   l o t s   +   i n i t i a l _ l o t s ; 
             } 
       } 
       
       r e t u r n   l o t s ; 
 }  
  
 d o u b l e   B e t F i b o n a c c i ( 
       s t r i n g   g r o u p , 
       s t r i n g   s y m b o l , 
       d o u b l e   i n i t i a l _ l o t s 
 )   { 
 	 i n t   p o s                         =   0 ; 
 	 i n t   t o t a l                     =   0 ; 
 	 d o u b l e   l o t s                 =   0 ; 
 	 d o u b l e   p r o f i t             =   0 ; 
 	 i n t   p r o f i t _ o r _ l o s s   =   0 ;   / /   0   -   u n k n o w n ,   1   -   p r o f i t ,   - 1   -   l o s s 
       
       / / - -   t r y   t o   g e t   l a s t   l o t   s i z e   f r o m   r u n n i n g   t r a d e s 
 	 t o t a l   =   T r a d e s T o t a l ( ) ; 
 	 
 	 f o r   ( p o s   =   t o t a l   -   1 ;   p o s   > =   0 ;   p o s - - ) 
 	 { 
 	 	 i f   ( T r a d e S e l e c t B y I n d e x ( p o s ,   " g r o u p " ,   g r o u p ,   " s y m b o l " ,   s y m b o l ) ) 
 	 	 { 
 	 	 	 i f   ( T i m e C u r r e n t ( )   -   O r d e r O p e n T i m e ( )   <   3 )   { c o n t i n u e ; } 
 
 	 	 	 i f   ( l o t s   = =   0 ) 
 	 	 	 { 
 	 	 	 	 l o t s   =   O r d e r L o t s ( ) ; 
 	 	 	 } 
 
 	 	 	 p r o f i t   =   O r d e r C l o s e P r i c e ( )   -   O r d e r O p e n P r i c e ( ) ; 
 	 	 	 p r o f i t   =   N o r m a l i z e D o u b l e ( p r o f i t ,   S y m b o l D i g i t s ( O r d e r S y m b o l ( ) ) ) ; 
 
 	 	 	 i f   ( I s O r d e r T y p e S e l l ( ) ) 
 	 	 	 { 
 	 	 	 	 p r o f i t   =   - 1   *   p r o f i t ; 
 	 	 	 } 
 
 	 	 	 i f   ( p r o f i t   = =   0 ) 
 	 	 	 { 
 	 	 	 	 r e t u r n   l o t s ; 
 	 	 	 } 
 
 	 	 	 i f   ( p r o f i t < 0 )   { p r o f i t _ o r _ l o s s = - 1 ; } 
 	 	 	 e l s e   { p r o f i t _ o r _ l o s s = 1 ; } 
 
 	 	 	 b r e a k ; 
 	 	 } 
 	 } 
       
       / / - -   i f   n o   r u n n i n g   t r a d e   w a s   f o u n d ,   s e a r c h   i n   h i s t o r y   t r a d e s 
       i f   ( l o t s = = 0 ) 
       { 
             t o t a l   =   H i s t o r y T r a d e s T o t a l ( ) ; 
 
 	 	 f o r   ( p o s   =   t o t a l   -   1 ;   p o s   > =   0 ;   p o s - - ) 
             { 
 	 	 	 i f   ( H i s t o r y T r a d e S e l e c t B y I n d e x ( p o s ,   " g r o u p " ,   g r o u p ,   " s y m b o l " ,   s y m b o l ) ) 
 	 	 	 { 
 	 	 	 	 i f   ( T i m e C u r r e n t ( )   -   O r d e r O p e n T i m e ( )   <   3 )   { c o n t i n u e ; } 
 
 	 	 	 	 i f   ( l o t s   = =   0 ) 
 	 	 	 	 { 
 	 	 	 	 	 l o t s   =   O r d e r L o t s ( ) ; 
 	 	 	 	 } 
 
 	 	 	 	 p r o f i t   =   O r d e r C l o s e P r i c e ( )   -   O r d e r O p e n P r i c e ( ) ; 
 	 	 	 	 p r o f i t   =   N o r m a l i z e D o u b l e ( p r o f i t ,   S y m b o l D i g i t s ( O r d e r S y m b o l ( ) ) ) ; 
 	 	 	 	 i f   ( O r d e r T y p e ( )   = =   0 )   { p r o f i t   =   - 1 * p r o f i t ; } 
 	 	 	 	 i f   ( p r o f i t   = =   0 )   { 
 	 	 	 	 	 r e t u r n ( l o t s ) ; 
 	 	 	 	 } 
 
 	 	 	 	 i f   ( p r o f i t < 0 )   { p r o f i t _ o r _ l o s s = - 1 ; } 
 	 	 	 	 e l s e   { p r o f i t _ o r _ l o s s = 1 ; } 
 
 	 	 	 	 b r e a k ; 
 	 	 	 } 
             } 
       } 
       
       / / - - 
       i f   ( i n i t i a l _ l o t s   <   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 ) )   { 
             i n i t i a l _ l o t s   =   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 ) ;     
       } 
 
       i f   ( l o t s = = 0 )   { l o t s   =   i n i t i a l _ l o t s ; } 
       e l s e 
       {     
             i n t   f i b o 1 = 1 ,   f i b o 2 = 0 ,   f i b o 3 = 0 ,   f i b o 4 = 0 ; 
             d o u b l e   d i v   =   l o t s / i n i t i a l _ l o t s ; 
             
             i f   ( d i v < = 0 )   { d i v = 1 ; } 
 
             w h i l e ( t r u e ) 
             { 
                   f i b o 1 = f i b o 1 + f i b o 2 ; 
                   f i b o 3 = f i b o 2 ; 
                   f i b o 2 = f i b o 1 - f i b o 2 ; 
                   f i b o 4 = f i b o 2 - f i b o 3 ; 
                   i f   ( f i b o 1   >   N o r m a l i z e D o u b l e ( d i v ,   2 ) )   { b r e a k ; } 
             } 
             / / P r i n t ( " ( " + f i b o 1   +   " + "   +   f i b o 2 + " + " + f i b o 3 + " )   >   " + d i v ) ; 
             i f   ( p r o f i t _ o r _ l o s s = = 1 ) 
             { 
                   i f   ( f i b o 4 < = 0 )   { f i b o 4 = 1 ; } 
                   / / P r i n t ( " P r o f i t   " + l o t s + " * " + f i b o 4 ) ; 
                   l o t s = i n i t i a l _ l o t s * ( f i b o 4 ) ; 
             } 
             e l s e   { 
                   / / P r i n t ( " L o s s   " + l o t s + " * " + f i b o 1 + " + " + f i b o 2 ) ; 
                   l o t s = i n i t i a l _ l o t s * ( f i b o 1 ) ; 
             } 
       } 
       
       l o t s = N o r m a l i z e D o u b l e ( l o t s ,   2 ) ; 
       r e t u r n   l o t s ; 
 }  
  
 d o u b l e   B e t L a b o u c h e r e ( 
 	 s t r i n g   g r o u p , 
 	 s t r i n g   s y m b o l , 
 	 d o u b l e   i n i t i a l _ l o t s , 
 	 s t r i n g   l i s t _ o f _ n u m b e r s , 
 	 d o u b l e   r e v e r s e   =   f a l s e 
 )   { 
 	 i n t   p o s                         =   0 ; 
 	 i n t   t o t a l                     =   0 ; 
 	 d o u b l e   l o t s                 =   0 ; 
 	 d o u b l e   p r o f i t             =   0 ; 
 	 i n t   p r o f i t _ o r _ l o s s   =   0 ;   / /   0   -   u n k n o w n ,   1   -   p r o f i t ,   - 1   -   l o s s 
       
       / / - -   t r y   t o   g e t   l a s t   l o t   s i z e   f r o m   r u n n i n g   t r a d e s 
 	 t o t a l   =   T r a d e s T o t a l ( ) ; 
 	 
 	 f o r   ( p o s   =   t o t a l   -   1 ;   p o s   > =   0 ;   p o s - - ) 
 	 { 
 	 	 i f   ( T r a d e S e l e c t B y I n d e x ( p o s ,   " g r o u p " ,   g r o u p ,   " s y m b o l " ,   s y m b o l ) ) 
 	 	 { 
 	 	 	 i f   ( T i m e C u r r e n t ( )   -   O r d e r O p e n T i m e ( )   <   3 )   { c o n t i n u e ; } 
 
 	 	 	 i f   ( l o t s   = =   0 ) 
 	 	 	 { 
 	 	 	 	 l o t s   =   O r d e r L o t s ( ) ; 
 	 	 	 } 
 
 	 	 	 p r o f i t   =   O r d e r C l o s e P r i c e ( )   -   O r d e r O p e n P r i c e ( ) ; 
 	 	 	 p r o f i t   =   N o r m a l i z e D o u b l e ( p r o f i t ,   S y m b o l D i g i t s ( O r d e r S y m b o l ( ) ) ) ; 
 
 	 	 	 i f   ( I s O r d e r T y p e S e l l ( ) ) 
 	 	 	 { 
 	 	 	 	 p r o f i t   =   - 1   *   p r o f i t ; 
 	 	 	 } 
 
 	 	 	 i f   ( p r o f i t   = =   0 ) 
 	 	 	 { 
 	 	 	 	 r e t u r n   l o t s ; 
 	 	 	 } 
 
 	 	 	 i f   ( p r o f i t < 0 )   { p r o f i t _ o r _ l o s s = - 1 ; } 
 	 	 	 e l s e   { p r o f i t _ o r _ l o s s = 1 ; } 
 
 	 	 	 b r e a k ; 
 	 	 } 
 	 } 
       
       / / - -   i f   n o   r u n n i n g   t r a d e   w a s   f o u n d ,   s e a r c h   i n   h i s t o r y   t r a d e s 
       i f   ( l o t s = = 0 ) 
       { 
             t o t a l   =   H i s t o r y T r a d e s T o t a l ( ) ; 
 
 	 	 f o r   ( p o s   =   t o t a l   -   1 ;   p o s   > =   0 ;   p o s - - ) 
             { 
 	 	 	 i f   ( H i s t o r y T r a d e S e l e c t B y I n d e x ( p o s ,   " g r o u p " ,   g r o u p ,   " s y m b o l " ,   s y m b o l ) ) 
 	 	 	 { 
 	 	 	 	 i f   ( T i m e C u r r e n t ( )   -   O r d e r O p e n T i m e ( )   <   3 )   { c o n t i n u e ; } 
 
 	 	 	 	 i f   ( l o t s   = =   0 ) 
 	 	 	 	 { 
 	 	 	 	 	 l o t s   =   O r d e r L o t s ( ) ; 
 	 	 	 	 } 
 
 	 	 	 	 p r o f i t   =   O r d e r C l o s e P r i c e ( )   -   O r d e r O p e n P r i c e ( ) ; 
 	 	 	 	 p r o f i t   =   N o r m a l i z e D o u b l e ( p r o f i t ,   S y m b o l D i g i t s ( O r d e r S y m b o l ( ) ) ) ; 
 	 	 	 	 i f   ( O r d e r T y p e ( )   = =   0 )   { p r o f i t   =   - 1 * p r o f i t ; } 
 	 	 	 	 i f   ( p r o f i t   = =   0 )   { 
 	 	 	 	 	 r e t u r n ( l o t s ) ; 
 	 	 	 	 } 
 
 	 	 	 	 i f   ( p r o f i t < 0 )   { p r o f i t _ o r _ l o s s = - 1 ; } 
 	 	 	 	 e l s e   { p r o f i t _ o r _ l o s s = 1 ; } 
 
 	 	 	 	 b r e a k ; 
 	 	 	 } 
             } 
       } 
       
       / / - -   L a b o u c h e r e   s t u f f 
       s t a t i c   s t r i n g   m e m _ g r o u p [ ] ; 
       s t a t i c   s t r i n g   m e m _ l i s t [ ] ; 
       s t a t i c   i n t   m e m _ t i c k e t [ ] ; 
       i n t   s t a r t _ a g a i n = f a l s e ; 
       
       / / -   g e t   t h e   l i s t   o f   n u m b e r s   a s   i t   i s   s t o r e d   i n   t h e   m e m o r y ,   o r   s t o r e   i t 
       i n t   i d = A r r a y S e a r c h ( m e m _ g r o u p ,   g r o u p ) ; 
       i f   ( i d   = =   - 1 )   { 
             s t a r t _ a g a i n = t r u e ; 
             i f   ( l i s t _ o f _ n u m b e r s = = " " )   { l i s t _ o f _ n u m b e r s = " 1 " ; } 
             i d   =   A r r a y S i z e ( m e m _ g r o u p ) ; 
             A r r a y R e s i z e ( m e m _ g r o u p ,   i d + 1 ,   i d + 1 ) ; 
             A r r a y R e s i z e ( m e m _ l i s t ,   i d + 1 ,   i d + 1 ) ; 
             A r r a y R e s i z e ( m e m _ t i c k e t ,   i d + 1 ,   i d + 1 ) ; 
             m e m _ g r o u p [ i d ] = g r o u p ; 
             m e m _ l i s t [ i d ] = l i s t _ o f _ n u m b e r s ; 
       } 
 
       i f   ( m e m _ t i c k e t [ i d ] = = ( i n t ) O r d e r T i c k e t ( ) )   { 
             / /   t h e   l a s t   k n o w n   t i c k e t   ( m e m _ t i c k e t [ i d ] )   s h o u l d   b e   d i f f e r e n t   t h a n   O d e r T i c k e t ( )   n o r m a l l y 
             / /   w h e n   f a i l e d   t o   c r e a t e   a   n e w   t r a d e   -   t h e   l a s t   t i c k e t   r e m a i n s   t h e   s a m e 
             / /   s o   w e   n e e d   t o   r e s e t 
             m e m _ l i s t [ i d ] = l i s t _ o f _ n u m b e r s ; 
       } 
       m e m _ t i c k e t [ i d ] = ( i n t ) O r d e r T i c k e t ( ) ; 
       
       / / -   n o w   t u r n   t h e   s t r i n g   i n t o   i n t e g e r   a r r a y 
       i n t   l i s t [ ] ; 
       s t r i n g   l i s t S [ ] ; 
       S t r i n g E x p l o d e ( " , " ,   m e m _ l i s t [ i d ] ,   l i s t S ) ; 
       A r r a y R e s i z e ( l i s t ,   A r r a y S i z e ( l i s t S ) ,   A r r a y S i z e ( l i s t S ) ) ; 
       f o r   ( i n t   s = 0 ;   s < A r r a y S i z e ( l i s t S ) ;   s + + )   { 
             l i s t [ s ] = ( i n t ) S t r i n g T o I n t e g e r ( S t r i n g T r i m ( l i s t S [ s ] ) ) ;     
       } 
 
       / / - -   
       i n t   s i z e   =   A r r a y S i z e ( l i s t ) ; 
 
       i f   ( i n i t i a l _ l o t s   <   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 ) )   { 
             i n i t i a l _ l o t s   =   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 ) ;     
       } 
 
       i f   ( l o t s = = 0 )   { 
             s t a r t _ a g a i n = t r u e ; 
       } 
       
       i f   ( s t a r t _ a g a i n = = t r u e ) 
       { 
             i f   ( s i z e = = 1 )   { 
                   l o t s   =   i n i t i a l _ l o t s * l i s t [ 0 ] ; 
             }   e l s e   { 
                   l o t s   =   i n i t i a l _ l o t s * ( l i s t [ 0 ] + l i s t [ s i z e - 1 ] ) ; 
             } 
       } 
       e l s e   
       { 
             i f   ( ( r e v e r s e = = 0   & &   p r o f i t _ o r _ l o s s = = 1 )   | |   ( r e v e r s e = = 1   & &   p r o f i t _ o r _ l o s s = = - 1 ) ) 
             { 
                   i f   ( s i z e = = 1 )   { 
                         l o t s = i n i t i a l _ l o t s * l i s t [ 0 ] ; 
                         A r r a y R e s i z e ( l i s t ,   0 ,   0 ) ; 
                   } 
                   e l s e   i f   ( s i z e = = 2 )   { 
                         l o t s   =   i n i t i a l _ l o t s * ( l i s t [ 0 ] + l i s t [ 1 ] ) ; 
                         A r r a y R e s i z e ( l i s t ,   0 ,   0 ) ; 
                   } 
                   e l s e   i f   ( s i z e > 2 )   { 
                         l o t s   =   i n i t i a l _ l o t s * ( l i s t [ 0 ] + l i s t [ s i z e - 1 ] ) ; 
                         / /   C a n c e l   f i r s t   a n d   l a s t   n u m b e r s   i n   o u r   l i s t 
                         / /   s h i f t   a r r a y   1   s t e p   l e f t 
                         f o r ( p o s = 0 ;   p o s < s i z e - 1 ;   p o s + + )   { 
                               l i s t [ p o s ] = l i s t [ p o s + 1 ] ; 
                         } 
                         A r r a y R e s i z e ( l i s t , A r r a y S i z e ( l i s t ) - 2 ,   A r r a y S i z e ( l i s t ) - 2 ) ;   / /   r e m o v e   l a s t   2   e l e m e n t s       	 
                   } 
                   i f   ( l o t s   <   i n i t i a l _ l o t s )   { l o t s   =   i n i t i a l _ l o t s ; } 
             } 
             e l s e   { 
                   i f   ( s i z e > 1 ) 
                   { 
                         A r r a y R e s i z e ( l i s t ,   s i z e + 1 ,   s i z e + 1 ) ; 
                         l i s t [ s i z e ] = l i s t [ 0 ] + l i s t [ s i z e - 1 ] ; 
                         l o t s   =   i n i t i a l _ l o t s * ( l i s t [ 0 ] + l i s t [ s i z e ] ) ; 
                   }   e l s e   { 
                         l o t s   =   i n i t i a l _ l o t s * l i s t [ 0 ] ; 
                   } 
                   i f   ( l o t s   <   i n i t i a l _ l o t s )   { l o t s   =   i n i t i a l _ l o t s ; } 
             } 
 
       } 
       
       P r i n t ( " L a b o u c h e r e   ( f o r   g r o u p   " + ( s t r i n g ) i d + " )   c u r r e n t   l i s t   o f   n u m b e r s : " + S t r i n g I m p l o d e ( " , " ,   l i s t ) ) ; 
       s i z e = A r r a y S i z e ( l i s t ) ; 
       i f   ( s i z e = = 0 )   { 
             A r r a y S t r i p K e y ( m e m _ g r o u p ,   i d ) ; 
             A r r a y S t r i p K e y ( m e m _ l i s t ,   i d ) ; 
             A r r a y S t r i p K e y ( m e m _ t i c k e t ,   i d ) ; 
       }   e l s e   { 
             m e m _ l i s t [ i d ] = S t r i n g I m p l o d e ( " , " ,   l i s t ) ; 
       } 
 
       r e t u r n   l o t s ; 
 }  
  
 d o u b l e   B e t M a r t i n g a l e ( 
 	 s t r i n g   g r o u p , 
 	 s t r i n g   s y m b o l , 
 	 d o u b l e   i n i t i a l _ l o t s , 
 	 d o u b l e   m u l t i p l y _ o n _ l o s s , 
 	 d o u b l e   m u l t i p l y _ o n _ p r o f i t , 
 	 d o u b l e   a d d _ o n _ l o s s , 
 	 d o u b l e   a d d _ o n _ p r o f i t , 
 	 i n t   r e s e t _ o n _ l o s s , 
 	 i n t   r e s e t _ o n _ p r o f i t 
 )   { 
 	 i n t   p o s                         =   0 ; 
 	 i n t   t o t a l                     =   0 ; 
 	 d o u b l e   l o t s                 =   0 ; 
 	 d o u b l e   p r o f i t             =   0 ; 
 	 i n t   p r o f i t _ o r _ l o s s   =   0 ;   / /   0   -   u n k n o w n ,   1   -   p r o f i t ,   - 1   -   l o s s 
 	 i n t   i n _ a _ r o w               =   0 ; 
 
 	 / / - -   t r y   t o   g e t   l a s t   l o t   s i z e   f r o m   r u n n i n g   t r a d e s 
 	 t o t a l   =   T r a d e s T o t a l ( ) ; 
 	 
 	 f o r   ( p o s   =   t o t a l   -   1 ;   p o s   > =   0 ;   p o s - - ) 
 	 { 
 	 	 i f   ( T r a d e S e l e c t B y I n d e x ( p o s ,   " g r o u p " ,   g r o u p ,   " s y m b o l " ,   s y m b o l ) ) 
 	 	 { 
 	 	 	 i f   ( T i m e C u r r e n t ( )   -   O r d e r O p e n T i m e ( )   <   3 )   { c o n t i n u e ; } 
 
 	 	 	 i f   ( l o t s   = =   0 ) 
 	 	 	 { 
 	 	 	 	 l o t s   =   O r d e r L o t s ( ) ; 
 	 	 	 } 
 
 	 	 	 p r o f i t   =   O r d e r C l o s e P r i c e ( )   -   O r d e r O p e n P r i c e ( ) ; 
 	 	 	 p r o f i t   =   N o r m a l i z e D o u b l e ( p r o f i t ,   S y m b o l D i g i t s ( O r d e r S y m b o l ( ) ) ) ; 
 
 	 	 	 i f   ( I s O r d e r T y p e S e l l ( ) ) 
 	 	 	 { 
 	 	 	 	 p r o f i t   =   - 1   *   p r o f i t ; 
 	 	 	 } 
 
 	 	 	 i f   ( p r o f i t   = =   0 ) 
 	 	 	 { 
 	 	 	 	 r e t u r n   l o t s ; 
 	 	 	 } 
 
 	 	 	 i f   ( p r o f i t _ o r _ l o s s   = =   0 ) 
 	 	 	 { 
 	 	 	 	 i f   ( p r o f i t   <   0 ) 
 	 	 	 	 { 
 	 	 	 	 	 p r o f i t _ o r _ l o s s   =   - 1 ; 
 	 	 	 	 } 
 	 	 	 	 e l s e 
 	 	 	 	 { 
 	 	 	 	 	 p r o f i t _ o r _ l o s s   =   1 ; 
 	 	 	 	 } 
 	 	 	 } 
 	 	 	 e l s e 
 	 	 	 { 
 	 	 	 	 i f   ( 
 	 	 	 	 	 ( p r o f i t _ o r _ l o s s   = =   1   & &   p r o f i t   <   0 ) 
 	 	 	 	 	 | |   ( p r o f i t _ o r _ l o s s   = =   - 1   & &   p r o f i t   > =   0 ) 
 	 	 	 	 )   { 
 	 	 	 	 	 b r e a k ; 
 	 	 	 	 } 
 	 	 	 } 
 
 	 	 	 i n _ a _ r o w + + ; 
 	 	 } 
 	 } 
 
 	 / / - -   i f   n o   r u n n i n g   t r a d e   w a s   f o u n d ,   s e a r c h   i n   h i s t o r y   t r a d e s 
 	 i f   ( l o t s   = =   0 ) 
 	 { 
 	 	 t o t a l   =   H i s t o r y T r a d e s T o t a l ( ) ; 
 
 	 	 f o r   ( p o s   =   t o t a l   -   1 ;   p o s   > =   0 ;   p o s - - ) 
 	 	 { 
 	 	 	 i f   ( H i s t o r y T r a d e S e l e c t B y I n d e x ( p o s ,   " g r o u p " ,   g r o u p ,   " s y m b o l " ,   s y m b o l ) ) 
 	 	 	 { 
 	 	 	 	 i f   ( T i m e C u r r e n t ( )   -   O r d e r O p e n T i m e ( )   <   3 )   { c o n t i n u e ; } 
 
 	 	 	 	 i f   ( l o t s   = =   0 ) 
 	 	 	 	 { 
 	 	 	 	 	 l o t s   =   O r d e r L o t s ( ) ; 
 	 	 	 	 } 
 
 	 	 	 	 p r o f i t   =   O r d e r C l o s e P r i c e ( )   -   O r d e r O p e n P r i c e ( ) ; 
 	 	 	 	 p r o f i t   =   N o r m a l i z e D o u b l e ( p r o f i t ,   S y m b o l D i g i t s ( O r d e r S y m b o l ( ) ) ) ; 
 
 	 	 	 	 i f   ( O r d e r T y p e ( )   = =   1 ) 
 	 	 	 	 { 
 	 	 	 	 	 p r o f i t   =   - 1   *   p r o f i t ; 
 	 	 	 	 } 
 	 	 	 	 
 	 	 	 	 i f   ( p r o f i t   = =   0 ) 
 	 	 	 	 { 
 	 	 	 	 	 r e t u r n   l o t s ; 
 	 	 	 	 } 
 
 	 	 	 	 i f   ( p r o f i t _ o r _ l o s s   = =   0 ) 
 	 	 	 	 { 
 	 	 	 	 	 i f   ( p r o f i t   <   0 ) 
 	 	 	 	 	 { 
 	 	 	 	 	 	 p r o f i t _ o r _ l o s s   =   - 1 ; 
 	 	 	 	 	 } 
 	 	 	 	 	 e l s e 
 	 	 	 	 	 { 
 	 	 	 	 	 	 p r o f i t _ o r _ l o s s   =   1 ; 
 	 	 	 	 	 } 
 	 	 	 	 } 
 	 	 	 	 e l s e   { 
 	 	 	 	 	 i f   ( 
 	 	 	 	 	 	 ( p r o f i t _ o r _ l o s s   = =   1   & &   p r o f i t   <   0 ) 
 	 	 	 	 	 	 | |   ( p r o f i t _ o r _ l o s s   = =   - 1   & &   p r o f i t   > =   0 ) 
 	 	 	 	 	 )   { 
 	 	 	 	 	 	 b r e a k ; 
 	 	 	 	 	 } 
 	 	 	 	 } 
 
 	 	 	 	 i n _ a _ r o w + + ; 
 	 	 	 } 
 	 	 } 
 	 } 
 
 	 / /   M a r t i n g a l e   s t u f f 
 	 i f   ( l o t s   = =   0 ) 
 	 { 
 	 	 l o t s   =   i n i t i a l _ l o t s ; 
 	 } 
 	 e l s e 
 	 { 
 	 	 i f   ( p r o f i t _ o r _ l o s s   = =   1 ) 
 	 	 { 
 	 	 	 i f   ( r e s e t _ o n _ p r o f i t   >   0   & &   i n _ a _ r o w   > =   r e s e t _ o n _ p r o f i t ) 
 	 	 	 { 
 	 	 	 	 l o t s   =   i n i t i a l _ l o t s ; 
 	 	 	 } 
 	 	 	 e l s e 
 	 	 	 { 
 	 	 	 	 i f   ( m u l t i p l y _ o n _ p r o f i t   < =   0 ) 
 	 	 	 	 { 
 	 	 	 	 	 m u l t i p l y _ o n _ p r o f i t   =   1 ; 
 	 	 	 	 } 
 
 	 	 	 	 l o t s   =   ( l o t s   *   m u l t i p l y _ o n _ p r o f i t )   +   a d d _ o n _ p r o f i t ; 
 	 	 	 } 
 	 	 } 
 	 	 e l s e 
 	 	 { 
 	 	 	 i f   ( r e s e t _ o n _ l o s s   >   0   & &   i n _ a _ r o w   > =   r e s e t _ o n _ l o s s ) 
 	 	 	 { 
 	 	 	 	 l o t s   =   i n i t i a l _ l o t s ;     
 	 	 	 } 
 	 	 	 e l s e 
 	 	 	 { 
 	 	 	 	 i f   ( m u l t i p l y _ o n _ l o s s   < =   0 ) 
 	 	 	 	 { 
 	 	 	 	 	 m u l t i p l y _ o n _ l o s s   =   1 ; 
 	 	 	 	 } 
 
 	 	 	 	 l o t s   =   ( l o t s   *   m u l t i p l y _ o n _ l o s s )   +   a d d _ o n _ l o s s ; 
 	 	 	 } 
 	 	 } 
 	 } 
 
 	 r e t u r n   l o t s ; 
 }  
  
 d o u b l e   B e t S e q u e n c e ( 
 	 s t r i n g   g r o u p , 
 	 s t r i n g   s y m b o l , 
 	 d o u b l e   i n i t i a l _ l o t s , 
 	 s t r i n g   s e q u e n c e _ o n _ l o s s , 
 	 s t r i n g   s e q u e n c e _ o n _ p r o f i t , 
 	 b o o l   r e v e r s e   =   f a l s e 
 )   { 
 	 i n t   p o s                         =   0 ; 
 	 i n t   t o t a l                     =   0 ; 
 	 d o u b l e   l o t s                 =   0 ; 
 	 d o u b l e   p r o f i t             =   0 ; 
 	 i n t   p r o f i t _ o r _ l o s s   =   0 ;   / /   0   -   u n k n o w n ,   1   -   p r o f i t ,   - 1   -   l o s s 
 	 i n t   s i z e                       =   0 ; 
       
       / / - -   t r y   t o   g e t   l a s t   l o t   s i z e   f r o m   r u n n i n g   t r a d e s 
 	 t o t a l   =   T r a d e s T o t a l ( ) ; 
 	 
 	 f o r   ( p o s   =   t o t a l   -   1 ;   p o s   > =   0 ;   p o s - - ) 
 	 { 
 	 	 i f   ( T r a d e S e l e c t B y I n d e x ( p o s ,   " g r o u p " ,   g r o u p ,   " s y m b o l " ,   s y m b o l ) ) 
 	 	 { 
 	 	 	 i f   ( T i m e C u r r e n t ( )   -   O r d e r O p e n T i m e ( )   <   3 )   { c o n t i n u e ; } 
 
 	 	 	 i f   ( l o t s   = =   0 ) 
 	 	 	 { 
 	 	 	 	 l o t s   =   O r d e r L o t s ( ) ; 
 	 	 	 } 
 
 	 	 	 p r o f i t   =   O r d e r C l o s e P r i c e ( )   -   O r d e r O p e n P r i c e ( ) ; 
 	 	 	 p r o f i t   =   N o r m a l i z e D o u b l e ( p r o f i t ,   S y m b o l D i g i t s ( O r d e r S y m b o l ( ) ) ) ; 
 
 	 	 	 i f   ( I s O r d e r T y p e S e l l ( ) ) 
 	 	 	 { 
 	 	 	 	 p r o f i t   =   - 1   *   p r o f i t ; 
 	 	 	 } 
 
 	 	 	 i f   ( p r o f i t   = =   0 ) 
 	 	 	 { 
 	 	 	 	 r e t u r n   l o t s ; 
 	 	 	 } 
 
 	 	 	 i f   ( p r o f i t < 0 )   { p r o f i t _ o r _ l o s s = - 1 ; } 
 	 	 	 e l s e   { p r o f i t _ o r _ l o s s = 1 ; } 
 
 	 	 	 b r e a k ; 
 	 	 } 
 	 } 
       
       / / - -   i f   n o   r u n n i n g   t r a d e   w a s   f o u n d ,   s e a r c h   i n   h i s t o r y   t r a d e s 
       i f   ( l o t s = = 0 ) 
       { 
             t o t a l   =   H i s t o r y T r a d e s T o t a l ( ) ; 
 
 	 	 f o r   ( p o s   =   t o t a l   -   1 ;   p o s   > =   0 ;   p o s - - ) 
             { 
 	 	 	 i f   ( H i s t o r y T r a d e S e l e c t B y I n d e x ( p o s ,   " g r o u p " ,   g r o u p ,   " s y m b o l " ,   s y m b o l ) ) 
 	 	 	 { 
 	 	 	 	 i f   ( T i m e C u r r e n t ( )   -   O r d e r O p e n T i m e ( )   <   3 )   { c o n t i n u e ; } 
 
 	 	 	 	 i f   ( l o t s   = =   0 ) 
 	 	 	 	 { 
 	 	 	 	 	 l o t s   =   O r d e r L o t s ( ) ; 
 	 	 	 	 } 
 
 	 	 	 	 p r o f i t   =   O r d e r C l o s e P r i c e ( )   -   O r d e r O p e n P r i c e ( ) ; 
 	 	 	 	 p r o f i t   =   N o r m a l i z e D o u b l e ( p r o f i t ,   S y m b o l D i g i t s ( O r d e r S y m b o l ( ) ) ) ; 
 	 	 	 	 i f   ( O r d e r T y p e ( )   = =   0 )   { p r o f i t   =   - 1 * p r o f i t ; } 
 	 	 	 	 i f   ( p r o f i t   = =   0 )   { 
 	 	 	 	 	 r e t u r n ( l o t s ) ; 
 	 	 	 	 } 
 
 	 	 	 	 i f   ( p r o f i t < 0 )   { p r o f i t _ o r _ l o s s = - 1 ; } 
 	 	 	 	 e l s e   { p r o f i t _ o r _ l o s s = 1 ; } 
 
 	 	 	 	 b r e a k ; 
 	 	 	 } 
             } 
       } 
       
       / / - -   S e q u e n c e   s t u f f 
       s t a t i c   s t r i n g   m e m _ g r o u p [ ] ; 
       s t a t i c   s t r i n g   m e m _ l i s t _ l o s s [ ] ; 
       s t a t i c   s t r i n g   m e m _ l i s t _ p r o f i t [ ] ; 
       s t a t i c   i n t   m e m _ t i c k e t [ ] ; 
       
       / / -   g e t   t h e   l i s t   o f   n u m b e r s   a s   i t   i s   s t o r e d   i n   t h e   m e m o r y ,   o r   s t o r e   i t 
       i n t   i d = A r r a y S e a r c h ( m e m _ g r o u p ,   g r o u p ) ; 
       i f   ( i d   = =   - 1 ) 
       { 
             i f   ( s e q u e n c e _ o n _ l o s s = = " " )   { s e q u e n c e _ o n _ l o s s = " 1 " ; } 
             i f   ( s e q u e n c e _ o n _ p r o f i t = = " " )   { s e q u e n c e _ o n _ p r o f i t = " 1 " ; } 
             i d   =   A r r a y S i z e ( m e m _ g r o u p ) ; 
             A r r a y R e s i z e ( m e m _ g r o u p ,   i d + 1 ,   i d + 1 ) ; 
             A r r a y R e s i z e ( m e m _ l i s t _ l o s s ,   i d + 1 ,   i d + 1 ) ; 
             A r r a y R e s i z e ( m e m _ l i s t _ p r o f i t ,   i d + 1 ,   i d + 1 ) ; 
             A r r a y R e s i z e ( m e m _ t i c k e t ,   i d + 1 ,   i d + 1 ) ; 
             m e m _ g r o u p [ i d ]                 = g r o u p ; 
             m e m _ l i s t _ l o s s [ i d ]         = s e q u e n c e _ o n _ l o s s ; 
             m e m _ l i s t _ p r o f i t [ i d ]     = s e q u e n c e _ o n _ p r o f i t ; 
       } 
       
       b o o l   l o s s _ r e s e t = f a l s e ; 
       b o o l   p r o f i t _ r e s e t = f a l s e ; 
       i f   ( p r o f i t _ o r _ l o s s = = - 1   & &   m e m _ l i s t _ l o s s [ i d ] = = " " )   { 
             l o s s _ r e s e t = t r u e ; 
             m e m _ l i s t _ p r o f i t [ i d ] = " " ; 
       } 
       i f   ( p r o f i t _ o r _ l o s s = = 1   & &   m e m _ l i s t _ p r o f i t [ i d ] = = " " )   { 
             p r o f i t _ r e s e t = t r u e ; 
             m e m _ l i s t _ l o s s [ i d ] = " " ; 
       } 
       
       i f   ( p r o f i t _ o r _ l o s s = = 1   | |   m e m _ l i s t _ l o s s [ i d ] = = " " )   { 
             m e m _ l i s t _ l o s s [ i d ] = s e q u e n c e _ o n _ l o s s ; 
             i f   ( l o s s _ r e s e t )   { m e m _ l i s t _ l o s s [ i d ] = " 1 , " + m e m _ l i s t _ l o s s [ i d ] ; } 
             
       } 
       i f   ( p r o f i t _ o r _ l o s s = = - 1   | | m e m _ l i s t _ p r o f i t [ i d ] = = " " )   { 
             m e m _ l i s t _ p r o f i t [ i d ] = s e q u e n c e _ o n _ p r o f i t ; 
             i f   ( p r o f i t _ r e s e t )   { m e m _ l i s t _ p r o f i t [ i d ] = " 1 , " + m e m _ l i s t _ p r o f i t [ i d ] ; } 
       } 
       
       i f   ( m e m _ t i c k e t [ i d ] = = ( i n t ) O r d e r T i c k e t ( ) )   { 
             / /   t h e   l a s t   k n o w n   t i c k e t   ( m e m _ t i c k e t [ i d ] )   s h o u l d   b e   d i f f e r e n t   t h a n   O d e r T i c k e t ( )   n o r m a l l y 
             / /   w h e n   f a i l e d   t o   c r e a t e   a   n e w   t r a d e   -   t h e   l a s t   t i c k e t   r e m a i n s   t h e   s a m e 
             / /   s o   w e   n e e d   t o   r e s e t 
             m e m _ l i s t _ l o s s [ i d ] = s e q u e n c e _ o n _ l o s s ; 
             m e m _ l i s t _ p r o f i t [ i d ] = s e q u e n c e _ o n _ p r o f i t ; 
       } 
       m e m _ t i c k e t [ i d ] = ( i n t ) O r d e r T i c k e t ( ) ; 
       
       / / -   n o w   t u r n   t h e   s t r i n g   i n t o   i n t e g e r   a r r a y 
       i n t   s = 0 ; 
       d o u b l e   l i s t _ l o s s [ ] ; 
       d o u b l e   l i s t _ p r o f i t [ ] ; 
       s t r i n g   l i s t S [ ] ; 
       S t r i n g E x p l o d e ( " , " ,   m e m _ l i s t _ l o s s [ i d ] ,   l i s t S ) ; 
       A r r a y R e s i z e ( l i s t _ l o s s ,   A r r a y S i z e ( l i s t S ) ,   A r r a y S i z e ( l i s t S ) ) ; 
       f o r   ( s = 0 ;   s < A r r a y S i z e ( l i s t S ) ;   s + + )   { 
             l i s t _ l o s s [ s ] = ( 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 T r i m ( l i s t S [ s ] ) ) ;     
       } 
       S t r i n g E x p l o d e ( " , " ,   m e m _ l i s t _ p r o f i t [ i d ] ,   l i s t S ) ; 
       A r r a y R e s i z e ( l i s t _ p r o f i t ,   A r r a y S i z e ( l i s t S ) ,   A r r a y S i z e ( l i s t S ) ) ; 
       f o r   ( s = 0 ;   s < A r r a y S i z e ( l i s t S ) ;   s + + )   { 
             l i s t _ p r o f i t [ s ] = ( 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 T r i m ( l i s t S [ s ] ) ) ;     
       } 
 
       / / - - 
       i f   ( i n i t i a l _ l o t s   <   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 ) )   { 
             i n i t i a l _ l o t s   =   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 ) ;     
       } 
 
       i f   ( l o t s = = 0 )   { l o t s   =   i n i t i a l _ l o t s ; } 
       e l s e 
       { 
             i f   ( ( r e v e r s e = = f a l s e   & &   p r o f i t _ o r _ l o s s = = 1 )   | |   ( r e v e r s e = = t r u e   & &   p r o f i t _ o r _ l o s s = = - 1 ) ) 
             { 
                   l o t s   =   i n i t i a l _ l o t s * l i s t _ p r o f i t [ 0 ] ; 
                   / /   s h i f t   a r r a y   1   s t e p   l e f t 
                   s i z e = A r r a y S i z e ( l i s t _ p r o f i t ) ; 
                   f o r ( p o s = 0 ;   p o s < s i z e - 1 ;   p o s + + )   { 
                         l i s t _ p r o f i t [ p o s ] = l i s t _ p r o f i t [ p o s + 1 ] ; 
                   } 
                   i f   ( s i z e > 0 )   { 
                         A r r a y R e s i z e ( l i s t _ p r o f i t ,   s i z e - 1 ,   s i z e - 1 ) ; 
                         m e m _ l i s t _ p r o f i t [ i d ] = S t r i n g I m p l o d e ( " , " ,   l i s t _ p r o f i t ) ; 
                   } 
                   / /   r e s e t   t h e   o p p o s i t e   s e q u e n c e 
                   / / m e m _ l i s t _ l o s s [ i d ] = " " ; 
             } 
             e l s e   { 
                   
                   l o t s   =   i n i t i a l _ l o t s * l i s t _ l o s s [ 0 ] ; 
                   / /   s h i f t   a r r a y   1   s t e p   l e f t 
                   s i z e = A r r a y S i z e ( l i s t _ l o s s ) ; 
                   f o r ( p o s = 0 ;   p o s < s i z e - 1 ;   p o s + + )   { 
                         l i s t _ l o s s [ p o s ] = l i s t _ l o s s [ p o s + 1 ] ; 
                   } 
                   i f   ( s i z e > 0 )   { 
                         A r r a y R e s i z e ( l i s t _ l o s s ,   s i z e - 1 ,   s i z e - 1 ) ; 
                         m e m _ l i s t _ l o s s [ i d ] = S t r i n g I m p l o d e ( " , " ,   l i s t _ l o s s ) ; 
                   } 
                   / /   r e s e t   t h e   o p p o s i t e   s e q u e n c e 
                   / / m e m _ l i s t _ p r o f i t [ i d ] = " " ; 
             } 
       } 
       
       r e t u r n   l o t s ; 
 }  
  
 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 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 + + ; 
 	 	 } 
 	 	 e l s e 
 	 	 { 
 	 	 	 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 ) ; 
 	 	 } 
 	 } 
 
 	 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 ( ) ; 
     
 	 A r r a y R e s i z e ( l i s t ,   t o t a l ) ; 
 
 	 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 B y T i c k e t ( P o s i t i o n G e t T i c k e t ( i ) ) ) 
 	 	 { 
 	 	 	 / /   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 + + ; 
 	 	 } 
 	 } 
 
 	 A r r a y R e s i z e ( l i s t ,   p o s i t i o n s _ c o u n t ) ; 
 
       r e t u r n   p o s i t i o n s _ c o u n t ; 
 }  
  
 l o n g   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   =   " " , 
 	 c o l o r   a r r o w c o l o r   =   c l r N O N E , 
 	 d a t e t i m e   e x p i r a t i o n   =   0 
 	 ) 
 { 
 	 r e t u r n   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 , 
 	 	 a r r o w c o l o r , 
 	 	 e x p i r a t i o n 
 	 ) ; 
 }  
  
 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 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 ,   c o l o r   c l r   =   c l r N O N E ) 
 { 
 	 w h i l e ( t r u 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 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 ) ; 
 	 	 d o u b l 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 ) ; 
 
 	 	 / /   W i t h   s o m e   C F D   w e   c a n   o p e n   p o s i t i o n   w i t h   t h e   m a x   v o l u m e   m o r e   t h a n   o n c e , 
 	 	 / /   s o   w e   g e t   a   p o s i t i o n   t h a t   h a s   v o l u m e   b i g g e r   t h a n   t h e   m a x i m u m . 
 	 	 / /   T h e n   w e   c a n n o t   c l o s e   t h a t   p o s i t i o n ,   b e c a u s e   t h e   v o l u m e   i s   t o o   h i g h . 
 	 	 / /   F o r   t h a t   r e a s o n   h e r e   w e   w i l l   c l o s e   i t   i n   p a r t s . 
 	 	 d o u b l e   m a x _ v o l u m 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 _ V O L U M E _ M A X ) ; 
 	 	 d o u b l e   p a r t _ v o l u m e   =   ( v o l u m e   >   m a x _ v o l u m e )   ?   m a x _ v o l u m e   :   v o l u m 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 . 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 a r t _ 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 o r   h e d g i n g   m o d e 
 	 	 r e q u e s t . p o s i t i o n     =   t i c k e t ; 
 
 	 	 / /   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 ; 
 	 	 e l 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 ; 
 
 	 	 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 ) 
 	 	 { 
 	 	 	 / /   w e   a r e   c l o s i n g   t h e   p o s i t i o n   i n   p a r t s ? 
 	 	 	 i f   ( v o l u m e   ! =   p a r t _ v o l u m e ) 
 	 	 	 { 
 	 	 	 	 c o n t i n u e ;   / /   c o n t i n u e   t h e   " w h i l e "   l o o p ,   s o   t h a t   t h e   w h o l e   v o l u m e   c o u l d   b e   c l o s e d 
 	 	 	 } 
 
 	 	 	 w h i l e   ( t r u e ) 
 	 	 	 { 
 	 	 	     	 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 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 ) ; 
 	 	 	 } 
 	 	 } 
 
 	 	 i f   ( s u c c e s s   = =   t r u e ) 
 	 	 { 
 	 	 	 i f   ( U S E _ V I R T U A L _ S T O P S ) 
 	 	 	 { 
 	 	 	 	 V i r t u a l S t o p s D r i v e r ( " c l e a r " ,   t i c k e t ) ; 
 	 	 	 } 
 	 	 } 
 	 	 
 	 	 b r e a k ; 
 	 } 
 	 
 	 O n T r a d e ( ) ; 
 
 	 r e t u r n   t r u e ; 
 }  
  
 t e m p l a t e < t y p e n a m e   D T 1 ,   t y p e n a m e   D T 2 > 
 b o o l   C o m p a r e V a l u e s ( s t r i n g   s i g n ,   D T 1   v 1 ,   D T 2   v 2 ) 
 { 
 	           i f   ( s i g n   = =   " > " )   r e t u r n ( v 1   >   v 2 ) ; 
 	 e l s e   i f   ( s i g n   = =   " < " )   r e t u r n ( v 1   <   v 2 ) ; 
 	 e l s e   i f   ( s i g n   = =   " > = " )   r e t u r n ( v 1   > =   v 2 ) ; 
 	 e l s e   i f   ( s i g n   = =   " < = " )   r e t u r n ( v 1   < =   v 2 ) ; 
 	 e l s e   i f   ( s i g n   = =   " = = " )   r e t u r n ( v 1   = =   v 2 ) ; 
 	 e l s e   i f   ( s i g n   = =   " ! = " )   r e t u r n ( v 1   ! =   v 2 ) ; 
 	 e l s e   i f   ( s i g n   = =   " x > " )   r e t u r n ( v 1   >   v 2 ) ; 
 	 e l s e   i f   ( s i g n   = =   " x < " )   r e t u r n ( v 1   <   v 2 ) ; 
 
 	 r e t u r n   f a l s 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 ) ;  
 }  
  
 E N U M _ T I M E F R A M E S   C u r r e n t T i m e f r a m e ( E N U M _ T I M E F R A M E S   t f = - 1 )  
 {  
       s t a t i c   E N U M _ T I M E F R A M E S   m e m o r y = 0 ;  
       i f   ( t f > = 0 )   { m e m o r y = t f ; }  
       r e t u r n ( m e m o r y ) ;  
 }  
  
 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   = =   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 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 ,   c o l o r   a r r o w c o l o r = c l r N O N E ) 
 { 
       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 ; 
                   } 
             } 
 	 	 
 	 	 i f   ( s u c c e s s = = t r u e )   { 
                   i f   ( U S E _ V I R T U A L _ S T O P S )   { 
                         V i r t u a l S t o p s D r i v e r ( " c l e a r " , t i c k e t ) ; 
                   } 
                   / / R e g i s t e r E v e n t ( " t r a d e " ) ; 
                   / / r e t u r n ( t r u 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   s y m b o l ,   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 ; 
       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 ; 
 	 	 c a s e   1 0 0 3 8 :   e   =   " A   c l o s e   v o l u m e   e x c e e d s   t h e   c u r r e n t   p o s i t i o n   v o l u m e " ;   b r e a k ; 
 	 	 c a s e   1 0 0 3 9 :   e   =   " A   c l o s e   o r d e r   a l r e a d y   e x i s t s   f o r   a   s p e c i f i e d   p o s i t i o n " ;   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 ; 
 }  
  
 v o i d   E x p i r a t i o n D r i v e r ( ) 
 { 
 	 s t a t i c   u l o n g   l a s t _ c h e c k e d _ t i c k e t ; 
 	 s t a t i c   u l o n g   d b _ t i c k e t s [ ] ; 
 	 s t a t i c   d a t e t i m e   d b _ e x p i r a t i o n s [ ] ; 
 
 	 i n t   t o t a l         =   O r d e r s T o t a l ( ) ; 
 	 i n t   s i z e           =   0 ; 
 	 i n t   d o _ r e s e t   =   f a l s e ; 
 	 s t r i n g   p r i n t ; 
 	 i n t   i ; 
 
 	 / / - -   c h e c k   e x p i r a t i o n s   a n d   c l o s e   t r a d e s 
 	 s i z e   =   A r r a y S i z e ( d b _ t i c k e t s ) ; 
 
 	 i f   ( s i z e   >   0 ) 
 	 { 
 	 	 i f   ( t o t a l = = 0 ) 
 	 	 { 
 	 	 	 A r r a y R e s i z e ( d b _ t i c k e t s ,   0 ) ; 
 	 	 	 A r r a y R e s i z e ( d b _ e x p i r a t i o n s ,   0 ) ; 
 	 	 } 
 	 	 e l s e 
 	 	 { 
 	 	 	 f o r   ( i   =   0 ;   i   <   s i z e ;   i + + ) 
 	 	 	 { 
 
 
 	 	 	 	 i f   ( ! L o a d P o s i t i o n ( d b _ t i c k e t s [ i ] ) )   { c o n t i n u e ; } 
 	 	 	 	 i f   ( O r d e r S y m b o l ( )   ! =   S y m b o l ( ) )   { c o n t i n u e ; } 
 
 	 	 	 	 i f   ( T i m e C u r r e n t ( )   > =   d b _ e x p i r a t i o n s [ i ] ) 
 	 	 	 	 { 
 	 	 	 	 	 / / - -   t r y i n g   t o   s k i p   c o n f l i c t s   w i t h   t h e   s a m e   f u n c t i o n a l i t y   r u n n i n g   f r o m   n e i g h b o u r   E A 
 
 
 	 	 	 	 	 i f   ( ! L o a d P o s i t i o n ( d b _ t i c k e t s [ i ] ) )   { c o n t i n u e ; } 
 	 	 	 	 	 i f   ( O r d e r C l o s e T i m e ( )   >   0 )   { c o n t i n u e ; } 
 
 	 	 	 	 	 / / - -   c l o s i n g   t h e   t r a d e 
 	 	 	 	 	 i f   ( C l o s e T r a d e ( O r d e r T i c k e t ( ) ) )   
 	 	 	 	 	 { 
 	 	 	 	 	 	 p r i n t   =   " # "   +   ( s t r i n g ) O r d e r T i c k e t ( )   +   "   w a s   c l o s e d   d u e   t o   e x p i r a t i o n " ; 
 	 	 	 	 	 	 P r i n t ( p r i n t ) ; 
 	 	 	 	 	 	 l a s t _ c h e c k e d _ t i c k e t   =   0 ; 
 	 	 	 	 	 	 d o _ r e s e t   =   t r u e ; 
 	 	 	 	 	 	 t o t a l 	   =   O r d e r s T o t a l ( ) ; 
 	 	 	 	 	 } 
 	 	 	 	 } 
 	 	 	 } 
 	 	 } 
 	 } 
 
 	 / / - -   c h e c k   t h e   t i c k e t   o f   t h e   n e w e s t   t r a d e 
 	 i f   ( d o _ r e s e t   = =   f a l s e   & &   t o t a l   >   0 ) 
 	 { 
 	 	 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 ( t o t a l - 1 ) ) ) 
 	 	 { 
 	 	 	 i f   ( O r d e r T i c k e t ( )   ! =   l a s t _ c h e c k e d _ t i c k e t ) 
 	 	 	 { 
 	 	 	 	 d o _ r e s e t   =   t r u e ; 
 	 	 	 } 
 	 	 } 
 	 } 
 
 	 / / - -   r e b u i l d   t h e   d a t a b a s e   o f   t r a d e s   w i t h   e x p i r a t i o n s 
 	 i f   ( d o _ r e s e t   = =   t r u e ) 
 	 { 
 	 	 A r r a y R e s i z e ( d b _ t i c k e t s ,   0 ) ; 
 	 	 A r r a y R e s i z e ( d b _ e x p i r a t i o n s ,   0 ) ; 
 
 	 	 f o r   ( i n t   p o s   =   0 ;   p o s   <   t o t a l ;   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 ) ) )   { c o n t i n u e ; } 
 	 	 	 l a s t _ c h e c k e d _ t i c k e t   =   O r d e r T i c k e t ( ) ; 
 
 	 	 	 s t r i n g   c o m m e n t   =   O r d e r C o m m e n t ( ) ; 
 	 	 	 i n t   e x p _ p o s _ b e g i n   =   S t r i n g F i n d ( c o m m e n t ,   " [ e x p : " ) ; 
 
 	 	 	 i f   ( e x p _ p o s _ b e g i n   > =   0 ) 
 	 	 	 { 
 	 	 	 	 e x p _ p o s _ b e g i n   =   e x p _ p o s _ b e g i n   +   5 ; 
 	 	 	 	 i n t   e x p _ p o s _ e n d   =   S t r i n g F i n d ( c o m m e n t ,   " ] " ,   e x p _ p o s _ b e g i n ) ; 
 	 	 	 	 i f   ( e x p _ p o s _ e n d   = =   - 1 )   { c o n t i n u e ; } 
 	 	 	 	 
 	 	 	 	 s i z e   =   A r r a y S i z e ( d b _ t i c k e t s ) ; 
 	 	 	 	 A r r a y R e s i z e ( d b _ t i c k e t s ,   s i z e + 1 ) ; 
 	 	 	 	 A r r a y R e s i z e ( d b _ e x p i r a t i o n s ,   s i z e + 1 ) ; 
 
 	 	 	 	 d b _ t i c k e t s [ s i z e ]           =   O r d e r T i c k e t ( ) ; 
 	 	 	 	 d b _ e x p i r a t i o n s [ s i z e ]   =   ( d a t e t i m e ) ( ( i n t ) O r d e r O p e n T i m e ( )   +   ( 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 ( c o m m e n t ,   e x p _ p o s _ b e g i n ,   e x p _ p o s _ e n d ) ) ) ; 
 	 	 	 } 
 	 	 } 
 	 } 
 }  
  
 d a t e t i m e   E x p i r a t i o n T i m e ( s t r i n g   m o d e = " G T C " , i n t   d a y s = 0 ,   i n t   h o u r s = 0 ,   i n t   m i n u t e s = 0 ,   d a t e t i m e   c u s t o m = 0 ) 
 { 
 	 d a t e t i m e   n o w                 =   T i m e C u r r e n t ( ) ; 
       d a t e t i m e   e x p i r a t i o n   =   n o w ; 
 
 	           i f   ( m o d e   = =   " G T C "   | |   m o d e   = =   " " )   { e x p i r a t i o n   =   0 ; } 
 	 e l s e   i f   ( m o d e   = =   " t o d a y " )                           { e x p i r a t i o n   =   ( d a t e t i m e ) ( M a t h F l o o r ( ( n o w   +   8 6 4 0 0 . 0 )   /   8 6 4 0 0 . 0 )   *   8 6 4 0 0 . 0 ) ; } 
 	 e l s e   i f   ( m o d e   = =   " s p e c i f i e d " ) 
 	 { 
 	 	 e x p i r a t i o n   =   0 ; 
 
 	 	 i f   ( ( d a y s   +   h o u r s   +   m i n u t e s )   >   0 ) 
 	 	 { 
 	 	 	 e x p i r a t i o n   =   n o w   +   ( 8 6 4 0 0   *   d a y s )   +   ( 3 6 0 0   *   h o u r s )   +   ( 6 0   *   m i n u t e s ) ; 
 	 	 } 
 	 } 
 	 e l s e 
 	 { 
 	 	 i f   ( c u s t o m   < =   n o w ) 
 	 	 { 
 	 	 	 i f   ( c u s t o m   <   3 1 5 5 7 6 0 0 ) 
 	 	 	 { 
 	 	 	 	 c u s t o m   =   n o w   +   c u s t o m ; 
 	 	 	 } 
 	 	 	 e l s e 
 	 	 	 { 
 	 	 	 	 c u s t o m   =   0 ; 
 	 	 	 } 
 	 	 } 
 
 	 	 e x p i r a t i o n   =   c u s t o m ; 
 	 } 
 
 	 r e t u r n   e x p i r a t i o n ; 
 }  
  
 E N U M _ O R D E R _ T Y P E _ T I M E   E x p i r a t i o n T y p e B y T i m e ( s t r i n g   s y m b o l ,   d a t e t i m e   e x p i r a t i o n ) 
 { 
 	 d a t e t i m e   n o w                                       =   T i m e C u r r e n t ( ) ; 
 	 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 e t e c t   T y p e   T i m e 
 	 i f   ( e x p i r a t i o n   = =   0   | |   e x p i r a t i o n   < =   n o w ) 
 	 { 
 	 	 t y p e _ t i m e   =   O R D E R _ T I M E _ G T C ; 
 	 } 
 	 e l s e   i f   ( e x p i r a t i o n   = =   ( d a t e t i m e ) ( M a t h F l o o r ( ( n o w   +   8 6 4 0 0 . 0 )   /   8 6 4 0 0 . 0 )   *   8 6 4 0 0 . 0 ) ) 
 	 { 
 	 	 t y p e _ t i m e   =   O R D E R _ T I M E _ D A Y ; 
 	 } 
 	 e l s e 
 	 { 
 	 	 t y p e _ t i m e   =   O R D E R _ T I M E _ S P E C I F I E D ; 
 	 } 
 
 	 / /   W h a t   i f   c e r t a i n   T y p e   T i m e   i s   n o t   a l l o w e d ? 
 	 i f   ( t y p e _ t i m e   = =   O R D E R _ T I M E _ G T C   & &   ! I s E x p i r a t i o n T y p e A l l o w e d ( s y m b o l ,   S Y M B O L _ E X P I R A T I O N _ G T C ) ) 
 	 { 
 	 	 t y p e _ t i m e   =   O R D E R _ T I M E _ D A Y ; 
 	 } 
 	 
 	 i f   ( t y p e _ t i m e   = =   O R D E R _ T I M E _ D A Y   & &   ! I s E x p i r a t i o n T y p e A l l o w e d ( s y m b o l ,   S Y M B O L _ E X P I R A T I O N _ D A Y ) ) 
 	 { 
 	 	 t y p e _ t i m e   =   O R D E R _ T I M E _ S P E C I F I E D ; 
 	 } 
 
 	 / /   R e t u r n   T y p e   T i m e 
 	 r e t u r n   t y p e _ t i m 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 ,   / /   f o r   M Q L 4   c o m p a t i b i l i t y 
 	 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 
 	 { 
 	 	 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 ) ; 
 }  
  
 b o o l   G e t F l a g B ( s t r i n g   f l a g n a m e )  
 {  
       r e t u r n ( S e t F l a g B ( f l a g n a m e , f a l s e , " g e t " ) ) ;  
 }  
  
 d o u b l e   H i g h e s t F r o m T o ( s t r i n g   s y m b o l ,   E N U M _ T I M E F R A M E S   t i m e f r a m e ,   d a t e t i m e   t i m e 1 ,   d a t e t i m e   t i m e 2 ,   i n t   w h a t _ t o _ g e t = 0 ) 
 { 
 	 s t a t i c   d a t e t i m e   H i g h e s t T i m e   =   0 ; 
 	 s t a t i c   d o u b l e   H i g h e s t I D           =   0 . 0 ; 
 
 	 d o u b l e   r e t v a l           =   0 . 0 ; 
 	 d o u b l e   H i g h e s t V a l   =   0 ; 
 
 	 i f   ( H i g h e s t T i m e   = =   0 )   { H i g h e s t T i m e   =   T i m e C u r r e n t ( ) ; } 
 
 	 / / - -   T i m e   m o d e   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 	 i f   ( t i m e 1   >   1 0 0 0 0 0 0 ) 
 	 { 
 	 	 d o u b l e   C a n d l e H i g h   =   0 . 0 ; 
 	 	 i n t   x 1                         =   i B a r S h i f t ( s y m b o l ,   t i m e f r a m e ,   t i m e 1 ,   f a l s e ) ; 
 	 	 i n t   x 2                         =   i B a r S h i f t ( s y m b o l ,   t i m e f r a m e ,   t i m e 2 ,   f a l s e ) ; 
 
 	 	 i f   ( x 1   <   x 2 ) 
 	 	 { 
 	 	 	 x 1   =   i B a r S h i f t ( s y m b o l ,   t i m e f r a m e ,   ( t i m e 1   -   8 6 4 0 0 ) ,   f a l s e ) ; 
 	 	 } 
 
 	 	 i f   ( x 1   <   0   | |   x 2   <   0 ) 
 	 	 { 
 	 	 	 r e t u r n   - 1 ; 
 	 	 } 
 
 	 	 f o r   ( i n t   i   =   x 2 ;   i   < =   x 1 ;   i + + ) 
 	 	 { 
 	 	 	 C a n d l e H i g h   =   i H i g h ( s y m b o l ,   t i m e f r a m e ,   i ) ; 
 
 	 	 	 i f   ( C a n d l e H i g h   >   H i g h e s t V a l ) 
 	 	 	 { 
 	 	 	 	 H i g h e s t V a l     =   C a n d l e H i g h ; 
 	 	 	 	 H i g h e s t T i m e   =   i T i m e ( s y m b o l ,   t i m e f r a m e ,   i ) ; 
 	 	 	 	 H i g h e s t I D       =   i ; 
 	 	 	 } 
 	 	 } 
 	 } 
 	 / / - -   B a r s   m o d e   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 	 e l s e 
 	 { 
 	 	 i n t   s h i f t   =   0 ; 
 
 	 	 i f   ( t i m e 1   = =   t i m e 2 ) 
 	 	 { 
 	 	 	 s h i f t   =   ( i n t ) t i m e 1 ; 
 	 	 } 
 	 	 e l s e 
 	 	 { 
 	 	 	 i n t   t o t a l b a r s   =   i B a r s ( s y m b o l ,   t i m e f r a m e )   -   1 ; 
 
 	 	 	 i f   ( t i m e 2   >   t o t a l b a r s   | |   t i m e 2   = =   0 ) 
 	 	 	 { 
 	 	 	 	 t i m e 2   =   t o t a l b a r s ; 
 	 	 	 } 
 
 	 	 	 s h i f t   =   i H i g h e s t ( s y m b o l ,   t i m e f r a m e ,   M O D E _ H I G H ,   ( i n t ) ( t i m e 2 - t i m e 1 ) + 1 ,   ( i n t ) t i m e 1 ) ; 
 	 	 } 
 
 	 	 H i g h e s t V a l     =   i H i g h ( s y m b o l ,   t i m e f r a m e ,   s h i f t ) ; 
 	 	 H i g h e s t T i m e   =   i T i m e ( s y m b o l ,   t i m e f r a m e ,   s h i f t ) ; 
 	 	 H i g h e s t I D       =   s h i f t ; 
 	 } 
 
 	 r e t v a l   =   H i g h e s t V a l ; 
 
 	 i f   ( w h a t _ t o _ g e t   = =   2 ) 
 	 { 
 	 	 r e t v a l   =   ( d o u b l e ) H i g h e s t T i m e ; 
 	 } 
 	 e l s e   i f   ( w h a t _ t o _ g e t   = =   0 ) 
 	 { 
 	 	 r e t v a l   =   H i g h e s t I D ; 
 	 } 
 
 	 r e t v a l   =   N o r m a l i z e D o u b l e ( r e t v a l ,   ( 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 ) ) ; 
 
 	 r e t u r n   r e t v a l ; 
 }  
  
 b o o l   H i s t o r y P e n d i n g O r d e r S e l e c t B y I n d e x ( 
 	 i n t   i n d e x , 
 	 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   =   " b o t h " 
 )   { 
 	 i f   ( L o a d H i s t o r y O r d e r ( i n d e x , " s e l e c t _ b y _ p o s " )   & &   L o a d e d T y p e ( )   = =   4 ) 
 	 { 
 	 	 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 , 
 	 	 	 L i m i t s O r S t o p s , 
 	 	 	 1 ) 
 	 	 )   { 
 	 	 	 r e t u r n   t r u e ; 
 	 	 } 
 	 } 
 
 	 r e t u r n   f a l s e ; 
 }  
  
 i n t   H i s t o r y P e n d i n g O r d e r s T o t a l ( d a t e t i m e   f r o m _ d a t e = 0 ,   d a t e t i m e   t o _ d a t e = 0 ) 
 { 
 	 i f   ( t o _ d a t e   = =   0 )   { t o _ d a t e   =   T i m e C u r r e n t ( )   +   1 ; } 
 	 
 	 H i s t o r y S e l e c t ( f r o m _ d a t e ,   t o _ d a t e ) ; 
 	 
 	 r e t u r n   H i s t o r y D e a l s T o t a l ( ) ; 
 }  
  
 b o o l   H i s t o r y T r a d e S e l e c t B y I n d e x ( 
 	 i n t   i n d e x , 
 	 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 " 
 )   { 
 	 i f   ( L o a d H i s t o r y T r a d e ( i n d e x ,   " s e l e c t _ b y _ p o s " )   & &   L o a d e d T y p e ( )   = =   3 ) 
 	 { 
 	 	 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 ) 
 	 	 )   { 
 	 	 	 r e t u r n   t r u e ; 
 	 	 } 
 	 } 
 
 	 r e t u r n   f a l s e ; 
 }  
  
 i n t   H i s t o r y T r a d e s T o t a l ( d a t e t i m e   f r o m _ d a t e = 0 ,   d a t e t i m e   t o _ d a t e = 0 ) 
 { 
 	 i f   ( t o _ d a t e   = =   0 )   { t o _ d a t e   =   T i m e C u r r e n t ( )   +   1 ; } 
 	 
 	 H i s t o r y S e l e c t ( f r o m _ d a t e ,   t o _ d a t e ) ; 
 	 
 	 S e l e c t e d H i s t o r y F r o m T i m e ( f r o m _ d a t e ) ; 
 	 S e l e c t e d H i s t o r y T o T i m e ( t o _ d a t e ) ; 
 	 
 	 r e t u r n   H i s t o r y D e a l s T o t a l ( ) ; 
 }  
  
 t e m p l a t e < t y p e n a m e   T > 
 b o o l   I n A r r a y ( T   & a r r a y [ ] ,   T   v a l u e ) 
 { 
 	 i n t   s i z e   =   A r r a y S i z e ( a r r a y ) ; 
 
 	 i f   ( s i z e   >   0 ) 
 	 { 
 	 	 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 ) 
 	 	 	 { 
 	 	 	 	 r e t u r n   t r u e ; 
 	 	 	 } 
 	 	 } 
 	 } 
 
 	 r e t u r n   f a l s e ; 
 }  
  
 / / + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +  
 / / |   C h e c k s   i f   t h e   s p e c i f i e d   e x p i r a t i o n   m o d e   i s   a l l o w e d                               |  
 / / + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +  
 b o o l   I s E x p i r a t i o n 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   e x p _ 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   e x p i r a t i o n   m o d e s  
       i n t   e x p i r a t i o n = ( 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 _ E X P I R A T I O N _ M O D E ) ;  
 / / - - -   R e t u r n   t r u e ,   i f   m o d e   e x p _ t y p e   i s   a l l o w e d  
       r e t u r n ( ( e x p i r a t i o n & e x p _ t y p e ) = = e x p _ t y p e ) ;  
     }  
  
 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 n t   l o a d e d T y p e   =   L o a d e d T y p 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   t r u e ; 
 	 	 } 
 	 } 
 	 e 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   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   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 ; 
 	 } 
 
 	 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 n t   l o a d e d T y p e   =   L o a d e d T y p 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 _ S E L L ) 
 	 	 { 
 	 	 	 r e t u r n   t r u e ; 
 	 	 } 
 	 } 
 	 e 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   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   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 ; 
 	 } 
 
 	 r e t u r n   f a l s e ; 
 }  
  
 b o o l   L o a d H i s t o r y O r d e r ( i n t   i n d e x ,   s t r i n g   s e l e c t b y = " s e l e c t _ b y _ p o s " ) 
 { 
 	 i f   ( s e l e c t b y   = =   " s e l e c t _ b y _ p o s " ) 
 	 { 
 	 	 u l o n g   t i c k e t     =   H i s t o r y O r d e r G e t T i c k e t ( i n d e x ) ; 
 
 	 	 i f   ( t i c k e t   >   0 ) 
 	 	 { 
 	 	 	 i f   ( 
 	 	 	 	       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 _ T Y P E )   > =   2 
 	 	 	 	 & &   H i s t o r y O r d e r S e l e c t ( t i c k e t ) ) 
 	 	 	 { 
 	 	 	 	 O r d e r T i c k e t ( t i c k e t ) ; 
 
 	 	 	 	 L o a d e d T y p e ( 4 ) ; 
 
 	 	 	 	 r e t u r n   t r u e ; 
 	 	 	 } 
 	 	 	 e l s e   i f   ( 
 	 	 	 	       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 _ T Y P E )   <   2 
 	 	 	 	 & &   H i s t o r y O r d e r S e l e c t ( H i s t o r y D e a l G e t I n t e g e r ( t i c k e t ,   D E A L _ P O S I T I O N _ I D ) ) 
 	 	 	 	 & &   ( E N U M _ D E A L _ E N T R Y ) H i s t o r y D e a l G e t I n t e g e r ( t i c k e t ,   D E A L _ E N T R Y )   = =   D E A L _ E N T R Y _ O U T 
 	 	 	 	 ) 
 	 	 	 { 
 	 	 	 	 O r d e r T i c k e t ( t i c k e t ) ; 
 
 	 	 	 	 L o a d e d T y p e ( 3 ) ; 
 
 	 	 	 	 r e t u r n   t r u e ; 
 	 	 	 } 
 	 	 } 
 	 } 
 
 	 i f   ( s e l e c t b y   = =   " s e l e c t _ b y _ t i c k e t " ) 
 	 { 
 	 	 i f   ( H i s t o r y O r d e r S e l e c t ( i n d e x ) ) 
 	 	 { 
 	 	 	 H i s t o r y D e a l S e l e c t ( i n d e x ) ;   / /   S e l e c t   d e a l ,   i t   w i l l   b e   j u s t   o n e   w i t h   p o s = 0 
 	 	 	 H i s t o r y D e a l G e t T i c k e t ( 0 ) ;   / /   L o a d   t h e   o n e   a n d   o n l y   s e l e c t e d   d e a l 
 
 	 	 	 O r d e r T i c k e t ( i n d e x ) ; 
 
 	 	 	 i f   ( H i s t o r y O r d e r G e t I n t e g e r ( i n d e x ,   O R D E R _ T Y P E )   > =   2 ) 
 	 	 	 { 
 	 	 	 	 L o a d e d T y p e ( 4 ) ; 
 
 	 	 	 	 r e t u r n   t r u e ; 
 	 	 	 } 
 	 	 	 e l s e 
 	 	 	 { 
 	 	 	 	 L o a d e d T y p e ( 3 ) ; 
 
 	 	 	 	 r e t u r n   t r u e ; 
 	 	 	 } 
 	 	 } 
 	 } 
 
 	 r e t u r n   f a l s e ; 
 }  
  
 b o o l   L o a d H i s t o r y T r a d e ( i n t   i n d e x ,   s t r i n g   s e l e c t b y = " s e l e c t _ b y _ p o s " ) 
 { 
 	 i f   ( s e l e c t b y   = =   " s e l e c t _ b y _ p o s " ) 
 	 { 
 	 	 u l o n g   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 ( i n d e x ) ; 
 
 	 	 i f   ( t i c k e t   >   0 ) 
 	 	 { 
 	 	 	 i f   ( 
 	 	 	 	       / / H i s t o r y D e a l S e l e c t ( t i c k e t )   -   c o m m e n t e d ,   b e c a u s e   i t   b r e a k s   H i s t o r y S e l e c t ( ) 
 	 	 	 	       H i s t o r y D e a l G e t I n t e g e r ( t i c k e t ,   D E A L _ T Y P E )   <   2 
 	 	 	 	 & &   ( E N U M _ D E A L _ E N T R Y ) H i s t o r y D e a l G e t I n t e g e r ( t i c k e t ,   D E A L _ E N T R Y )   = =   D E A L _ E N T R Y _ O U T 
 	 	 	 	 ) 
 	 	 	 { 
 	 	 	 	 O r d e r T i c k e t ( t i c k e t ) ; 
 
 	 	 	 	 L o a d e d T y p e ( 3 ) ; 
 
 	 	 	 	 r e t u r n   t r u e ; 
 	 	 	 } 
 	 	 } 
 	 } 
 
 	 i f   ( s e l e c t b y   = =   " s e l e c t _ b y _ t i c k e t " ) 
 	 { 
 	 	 i f   ( H i s t o r y D e a l S e l e c t ( i n d e x ) ) 
 	 	 { 
 	 	 	 O r d e r T i c k e t ( i n d e x ) ; 
 
 	 	 	 i f   ( H i s t o r y D e a l G e t I n t e g e r ( i n d e x ,   D E A L _ T Y P E )   <   2 ) 
 	 	 	 { 
 	 	 	 	 L o a d e d T y p e ( 3 ) ; 
 
 	 	 	 	 r e t u r n   t r u 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 ) 
 { 
 	 / /   T H I S   F U N C T I O N   N O W   P R O B A B L Y   D O E S N T   W O R K 
       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 ( ( 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 ; 
 }  
  
 b o o l   L o o p e d R e s u m e ( ) 
 { 
 	 u l o n g   t i c k e t     =   a t t r T i c k e t I n L o o p ( ) ; 
 	 i n t   t y p e             =   a t t r T y p e I n L o o p ( ) ; 
 
 	 i f   ( t i c k e t   >   0   & &   t i c k e t   ! =   O r d e r T i c k e t ( ) ) 
 	 { 
 	 	           i f   ( t y p e   = =   1 )   r e t u r n   L o a d P o s i t i o n ( t i c k e t ) ; 
 	 	 e l s e   i f   ( t y p e   = =   2 )   r e t u r n   L o a d O r d e r ( t i c k e t ) ; 
 	 	 e l s e   i f   ( t y p e   = =   3 )   r e t u r n   L o a d H i s t o r y O r d e r ( ( i n t ) t i c k e t , " s e l e c t _ b y _ t i c k e t " ) ; 
 	 } 
 
 	 r e t u r n   f a l s e ; 
 }  
  
 d o u b l e   L o w e s t F r o m T o ( s t r i n g   s y m b o l ,   E N U M _ T I M E F R A M E S   t i m e f r a m e ,   d a t e t i m e   t i m e 1 ,   d a t e t i m e   t i m e 2 ,   i n t   w h a t _ t o _ g e t = 0 ) 
 { 
 	 s t a t i c   d a t e t i m e   L o w e s t T i m e   =   0 ; 
 	 s t a t i c   d o u b l e   L o w e s t I D           =   0 . 0 ; 
 
 	 d o u b l e   r e t v a l         =   0 . 0 ; 
 	 d o u b l e   L o w e s t V a l   =   0 . 0 ; 
 
 	 i f   ( L o w e s t T i m e   = =   0 )   { L o w e s t T i m e   =   T i m e C u r r e n t ( ) ; } 
 
 	 / / - -   T i m e   m o d e   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 	 i f   ( t i m e 1   >   1 0 0 0 0 0 0 ) 
 	 { 
 	 	 d o u b l e   C a n d l e L o w   =   0 . 0 ; 
 	 	 i n t   x 1                       =   i B a r S h i f t ( s y m b o l ,   t i m e f r a m e ,   t i m e 1 ,   f a l s e ) ; 
 	 	 i n t   x 2                       =   i B a r S h i f t ( s y m b o l ,   t i m e f r a m e ,   t i m e 2 ,   f a l s e ) ; 
 
 	 	 i f   ( x 1   <   x 2 ) 
 	 	 { 
 	 	 	 x 1   =   i B a r S h i f t ( s y m b o l ,   t i m e f r a m e ,   ( t i m e 1   -   8 6 4 0 0 ) ,   f a l s e ) ; 
 	 	 } 
 
 	 	 i f   ( x 1   <   0   | |   x 2   <   0 ) 
 	 	 { 
 	 	 	 r e t u r n   - 1 ; 
 	 	 } 
 
 	 	 f o r   ( i n t   i   =   x 2 ;   i   < =   x 1 ;   i + + ) 
 	 	 { 
 	 	 	 C a n d l e L o w   =   i L o w ( s y m b o l ,   t i m e f r a m e ,   i ) ; 
 
 	 	 	 i f   ( C a n d l e L o w   <   L o w e s t V a l   | |   L o w e s t V a l   = =   0 ) 
 	 	 	 { 
 	 	 	 	 L o w e s t V a l     =   C a n d l e L o w ; 
 	 	 	 	 L o w e s t T i m e   =   i T i m e ( s y m b o l ,   t i m e f r a m e ,   i ) ; 
 	 	 	 	 L o w e s t I D       =   i ; 
 	 	 	 } 
 	 	 } 
 	 } 
 	 / / - -   B a r s   m o d e   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 	 e l s e 
 	 { 
 	 	 i n t   s h i f t   =   0 ; 
 
 	 	 i f   ( t i m e 1   = =   t i m e 2 ) 
 	 	 { 
 	 	 	 s h i f t   =   ( i n t ) t i m e 1 ; 
 	 	 } 
 	 	 e l s e 
 	 	 { 
 	 	 	 i n t   t o t a l b a r s   =   i B a r s ( s y m b o l ,   t i m e f r a m e )   -   1 ; 
 
 	 	 	 i f   ( t i m e 2   >   t o t a l b a r s   | |   t i m e 2   = =   0 ) 
 	 	 	 { 
 	 	 	 	 t i m e 2   =   t o t a l b a r s ; 
 	 	 	 } 
 
 	 	 	 s h i f t   =   i L o w e s t ( s y m b o l ,   t i m e f r a m e ,   M O D E _ L O W ,   ( i n t ) ( ( t i m e 2 - t i m e 1 ) + 1 ) ,   ( i n t ) t i m e 1 ) ; 
 	 	 } 
 
 	 	 L o w e s t V a l     =   i L o w ( s y m b o l ,   t i m e f r a m e ,   s h i f t ) ; 
 	 	 L o w e s t T i m e   =   i T i m e ( s y m b o l ,   t i m e f r a m e ,   s h i f t ) ; 
 	 	 L o w e s t I D       =   s h i f t ; 
 	 } 
 
 	 r e t v a l   =   L o w e s t V a l ; 
 
 	 i f   ( w h a t _ t o _ g e t   = =   2 ) 
 	 { 
 	 	 r e t v a l   =   ( d o u b l e ) L o w e s t T i m e ; 
 	 } 
 	 e l s e   i f   ( w h a t _ t o _ g e t   = =   0 ) 
 	 { 
 	 	 r e t v a l   =   L o w e s t I D ; 
 	 } 
 	 
 	 r e t v a l   =   N o r m a l i z e D o u b l e ( r e t v a l ,   ( 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 ) ) ; 
 
 	 r e t u r n   r e t v a l ; 
 }  
  
 b o o l   M o d i f y O r d e r ( 
 	 u l o n g   t i c k e t , 
 	 d o u b l e   o p , 
 	 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 a t e t i m e   e x p   =   0 , 
 	 c o l o r   c l r   =   c l r N O N E 
 )   { 
 	 i n t   b s   =   1 ; 
 
 	 i f   ( L o a d e d T y p e ( )   = =   1 ) 
 	 { 
 	 	 i f   ( O r d e r T y p e ( )   = =   P O S I T I O N _ T Y P E _ S E L L ) 
 	 	 { 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 
 	 } 
 	 e l s e 
 	 { 
 	 	 i f   ( 
 	 	 	 	 O r d e r T y p e ( )   = =   O R D E R _ T Y P E _ S E L L 
 	 	 	 | |   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 
 	 	 	 | |   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 
 	 	 ) 
 	 	 { 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 
 	 } 
 
 	 w h i l e   ( t r u e ) 
 	 { 
 	 	 u i n t   t i m e 0   =   G e t T i c k C o u n t ( ) ; 
 	 	 
 	 	 i f   ( L o a d e d T y p e ( )   = =   1 ) 
 	 	 { 
 	 	 	 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 ; } 
 	 	 } 
 	 	 e l s e 
 	 	 { 
 	 	 	 i f   ( ! O r d e r S e l e c 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             =   O r d e r S y m b o l ( ) ; 
 	 	 i n t   t y p e                       =   O r d e r T y p e ( ) ; 
 	 	 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 ) ; 
 	 	 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 ) ; 
 	 	 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 ) ; 
 	 	 d o u b l e   s t o p l e v e l       =   p o 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 _ T R A D E _ S T O P S _ L E V E L ) ; 
 	 	 d o u b l e   f r e e z e l e v e l   =   p o 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 _ T R A D E _ F R E E Z E _ L E V E L ) ; 
 
 	 	 i f   ( O r d e r T y p e ( )   <   2 )   { o p   =   O r d e r O p e n P r i c e ( ) ; }   e l s e   { 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 ) ; } 
 	 	 
 	 	 s l l   =   N o r m a l i z e D o u b l e ( s l l , d i g i t s ) ; 
 	 	 t p l   =   N o r m a l i z e D o u b l e ( t p l , d i g i t s ) ; 
 
 	 	 i f   ( o p   <   0   | |   o p   > =   E M P T Y _ V A L U E   | |   s l l   <   0   | |   s l p   <   0   | |   t p l   <   0   | |   t p p   <   0 ) 
 	 	 { 
 	 	 	 b r e a k ; 
 	 	 } 
 
 	 	 / / - -   O P   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 	 	 / /   h t t p s : / / b o o k . m q l 4 . c o m / a p p e n d i x / l i m i t s 
 	 	 i f   ( t y p e   = =   O R D E R _ T Y P E _ B U Y _ L I M I T ) 
 	 	 { 
 	 	 	 i f   ( a s k   -   o p   <   s t o p l e v e l )   { o p   =   a s k   -   s t o p l e v e l ; } 
 	 	 	 i f   ( a s k   -   o p   < =   f r e e z e l e v e l )   { o p   =   a s k   -   f r e e z e l e v e l   -   p o i n t ; } 
 	 	 } 
 	 	 e l s e   i f   ( t y p e   = =   O R D E R _ T Y P E _ B U Y _ S T O P ) 
 	 	 { 
 	 	 	 i f   ( o p   -   a s k   <   s t o p l e v e l )   { o p   =   a s k   +   s t o p l e v e l ; } 
 	 	 	 i f   ( o p   -   a s k   < =   f r e e z e l e v e l )   { o p   =   a s k   +   f r e e z e l e v e l   +   p o i n t ; } 
 	 	 } 
 	 	 e l s e   i f   ( t y p e   = =   O R D E R _ T Y P E _ S E L L _ L I M I T ) 
 	 	 { 
 	 	 	 i f   ( o p   -   b i d   <   s t o p l e v e l )   { o p   =   b i d   +   s t o p l e v e l ; } 
 	 	 	 i f   ( o p   -   b i d   < =   f r e e z e l e v e l )   { o p   =   b i d   +   f r e e z e l e v e l   +   p o i n t ; } 
 	 	 } 
 	 	 e l s e   i f   ( t y p e   = =   O R D E R _ T Y P E _ S E L L _ S T O P ) 
 	 	 { 
 	 	 	 i f   ( b i d   -   o p   <   s t o p l e v e l )   { o p   =   b i d   -   s t o p l e v e l ; } 
 	 	 	 i f   ( b i d   -   o p   <   f r e e z e l e v e l )   { o p   =   b i d   -   f r e e z e l e v e l   -   p o i n t ; } 
 	 	 } 
 
 	 	 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 ) ; 
 
 	 	 / / - -   S L   a n d   T P   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 	 	 d o u b l e   s l   =   0 ,   t p   =   0 ,   v s l   =   0 ,   v t p   =   0 ; 
 
 	 	 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 ,   a t t r S t o p L o s s ( ) ,   s l l ,   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 ,   a t t r T a k e P r o f i t ( ) ,   t p l ,   t p p ) ; 
 
 	 	 i f   ( t p   <   0 )   { b r e a k ; } 
 
 	 	 i f   ( U S E _ V I R T U A L _ S T O P S ) 
 	 	 { 
 	 	 	 / / - -   v i r t u a l   S L   a n d   T P   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 	 	 	 v s l   =   s l ; 
 	 	 	 v t p   =   t p ; 
 	 	 	 s l     =   0 ; 
 	 	 	 t p     =   0 ; 
 
 	 	 	 d o u b l e   a s k b i d   =   a s k ; 
 
 	 	 	 i f   ( b s   <   0 )   { a s k b i d   =   b i d ; } 
 
 	 	 	 i f   ( v s l   >   0   | |   U S E _ E M E R G E N C Y _ S T O P S   = =   " a l w a y s " ) 
 	 	 	 { 
 	 	 	 	 i f   ( E M E R G E N C Y _ S T O P S _ R E L   >   0   | |   E M E R G E N C Y _ S T O P S _ A D D   >   0 ) 
 	 	 	 	 { 
 	 	 	 	 	 s l   =   v s l   -   E M E R G E N C Y _ S T O P S _ R E L * M a t h A b s ( a s k b i d - v s l ) * b s ; 
 
 	 	 	 	 	 i f   ( s l   < =   0 )   { s l   =   a s k b i d ; } 
 	 	 	 	 	 s l   =   s l - t o D i g i t s ( E M E R G E N C Y _ S T O P S _ A D D , s y m b o l ) * b s ; 
 	 	 	 	 } 
 	 	 	 } 
 
 	 	 	 i f   ( v t p   >   0   | |   U S E _ E M E R G E N C Y _ S T O P S   = =   " a l w a y s " ) 
 	 	 	 { 
 	 	 	 	 i f   ( E M E R G E N C Y _ S T O P S _ R E L > 0   | |   E M E R G E N C Y _ S T O P S _ A D D > 0 ) 
 	 	 	 	 { 
 	 	 	 	 	 t p = v t p + E M E R G E N C Y _ S T O P S _ R E L * M a t h A b s ( v t p - a s k b i d ) * b s ; 
 
 	 	 	 	 	 i f   ( t p   < =   0 )   { t p   =   a s k b i d ; } 
 
 	 	 	 	 	 t p   =   t p   +   t o D i g i t s ( E M E R G E N C Y _ S T O P S _ A D D , s y m b o l ) * b s ; 
 	 	 	 	 } 
 	 	 	 } 
 
 	 	 	 v s l   =   N o r m a l i z e D o u b l e ( v s l , d i g i t s ) ; 
 	 	 	 v t p   =   N o r m a l i z e D o u b l e ( v t p , d i g i t s ) ; 
 	 	 } 
 
 	 	 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 ) ; 
 
 	 	 / / - -   m o d i f y   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 	 	 R e s e t L a s t E r r o r ( ) ; 
 	 	 
 	 	 i f   ( U S E _ V I R T U A L _ S T O P S ) 
 	 	 { 
 	 	 	 i f   ( v s l   ! =   a t t r S t o p L o s s ( )   | |   v t p   ! =   a t t r T a k e P r o f i t ( ) ) 
 	 	 	 { 
 	 	 	 	 V i r t u a l S t o p s D r i v e r ( " s e t " ,   t i c k e t ,   v s l ,   v t p ,   t o P i p s ( M a t h A b s ( o p - v s l ) ,   s y m b o l ) ,   t o P i p s ( M a t h A b s ( v t p - o p ) ,   s y m b o l ) ) ; 
 	 	 	 } 
 	 	 } 
 	 	 
 	 	 b o o l   s u c c e s s   =   f a l s e ; 
 	 	 
 	 	 / /   c h e c k   i f   n e e d e d   t o   m o d i f y 
 	 	 i f   ( L o a d e d T y p e ( )   = =   1 ) 
 	 	 { 
 	 	 	 i f   ( 
 	 	 	 	       s l   = =   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 _ 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 ( 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 ) , d i g i t s ) 
 	 	 	 )   { 
 	 	 	 	 r e t u r n   t r u e ; 
 	 	 	 } 
 	 	 } 
 	 	 e l s e 
 	 	 { 
 	 	 	 i f   ( 
 	 	 	 	       o p   = =   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 _ P R I C E _ O P E N ) , d i g i t s ) 
 	 	 	 	 & &   s l   = =   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 _ 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 ( O r d e r G e t D o u b l e ( O R D E R _ T P ) , d i g i t s ) 
 	 	 	 	 & &   e x p   = =   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 ) 
 	 	 	 )   { 
 	 	 	 	 r e t u r n   t r u e ; 
 	 	 	 } 
 	 	 } 
 
 	 	 / /   p r e p a r e   t o   m o d i f y 
 	 	 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 ) ; 
 
 	 	 / /   m o d i f y 
 	 	 i f   ( L o a d e d T y p e ( )   = =   1 ) 
 	 	 { 
 	 	 	 / /   i n   c a s e   o f   p o s i t i o n ,   o n l y   s l   a n d   t p   a r e   g o i n g   t o   b e   m o d i f i e d 
 	 	 	 r e q u e s t . a c t i o n       =   T R A D E _ A C T I O N _ S L T P ; 
 	 	 	 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 . p o s i 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 _ T I C K E T ) ; 
 	 	 	 r e q u e s t . 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 ) ; 
 	 	 	 r e q u e s t . 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 ) ; 
 	 	 } 
 	 	 e l s e 
 	 	 { 
 	 	 	 / /   i n   c a s e   o f   p e n d i n g   o r d e r 
 	 	 	 r e q u e s t . a c t i o n           =   T R A D E _ A C T I O N _ M O D I F Y ; 
 	 	 	 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 . p r i c e             =   o p ; 
 	 	 	 r e q u e s t . v o l u m 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 ) ; 
 	 	 	 r e q u e s t . 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 ) ; 
 	 	 	 r e q u e s t . t y p e _ t i m e     =   E x p i r a t i o n T y p e B y T i m e ( s y m b o l ,   e x p ) ; 
 	 	 	 r e q u e s t . e x p i r a t i o n   =   e x p ; 
 	 	 	 r e q u e s t . 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 ) ; 
 
 	 	 	 / / - -   f i l l i n g   t y p e 
 	 	 	 u i n t   f i l l i n g   =   ( u i n t ) S y m b o l I n f o I n t e g e r ( r e q u e s t . s y m b o l , S Y M B O L _ F I L L I N G _ M O D E ) ; 
 
 	 	 	 i f   ( f i l l i n g   = =   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   ( f i l l i n g   = =   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 ; 
 	 	 	 } 
 	 	 } 
 	 	 
 	 	 r e q u e s t . s l   =   s l ; 
 	 	 r e q u e s t . t p   =   t p ; 
 
 	 	 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 ; 
 	 	 } 
 
 	 	 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   ( 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   =   " M o d i f y   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   ( ( ( L o a d e d T y p e ( )   = =   1   & &   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 ) )   | |   O r d e r S e l e c t ( t i c k e t ) )   & &   ( s l   = =   N o r m a l i z e D o u b l e ( O r d e r S t o p L o s s ( ) ,   d i g i t s )   & &   t p   = =   N o r m a l i z e D o u b l e ( O r d e r T a k e P r o f i t ( ) ,   d i g i t s ) ) ) 
 	 	 	 	 { 
 	 	 	 	 	 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 :   M o d i f y   o r d e r   s t o p s " ) ;     
 	 	 	 } 
 
 	 	 	 i f   ( ! ( ( L o a d e d T y p e ( )   = =   1   & &   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 ) )   | |   O r d e r S e l e c t ( t i c k e t ) )   | |   ( s l   ! =   N o r m a l i z e D o u b l e ( O r d e r S t o p L o s s ( ) ,   d i g i t s )   | |   t p   ! =   N o r m a l i z e D o u b l e ( O r d e r T a k e P r o f i t ( ) ,   d i g i t s ) ) ) 
 	 	 	 { 
 	 	 	 	 P r i n t ( " S o m e t h i n g   w e n t   w r o n g   w h e n   t r y i n g   t o   m o d i f y   t h e   s t o p s " ) ; 
 
 	 	 	 	 r e t u r n   f a l s e ; 
 	 	 	 } 
 
 	 	 	 i f   ( ! ( ( ( L o a d e d T y p e ( )   = =   1   & &   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 ) )   | |   O r d e r S e l e c t ( t i c k e t ) ) ) ) 
 	 	 	 { 
 	 	 	 	 r e t u r n   f a l s e ; 
 	 	 	 } 
 
 	 	 	 O r d e r M o d i f i e d ( ( i n t ) t i c k e t ) ; 
 	 	 } 
 
 	 	 b r e a k ; 
 	 } 
 
 	 O n T r a d e ( ) ; 
 
 	 r e t u r n   t r u e ; 
 }  
  
 b o o l   M o d i f y S t o p s ( u l o n g   t i c k e t ,   d o u b l e   s l = - 1 ,   d o u b l e   t p = - 1 ,   c o l o r   c l r = c l r N O N E ) 
 { 
       r e t u r n   M o d i f y O r d e r ( 
 	 	 t i c k e t , 
 	 	 O r d e r O p e n P r i c e ( ) , 
 	 	 s l , 
 	 	 t p , 
 	 	 0 , 
 	 	 0 , 
 	 	 O r d e r E x p i r a t i o n ( ) 
 	 ) ; 
 }  
  
 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 = s i z e - 1 ;   i > = 0 ;   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 = s i z e - 1 ;   i > = 0 ;   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         =   - 1 ;         / /   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   =   - 1 ;   / /   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 ) ; 
 	 i n t   o r d e r s _ t o t a l         =   O r d e r s T o t a l ( ) ; 
 	 i n 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 ( ) ; 
 	 b o o l   d e b u g   =   f a l s e ; 
 	 
 	 / /   i n i t i a l   v a l u e s   f o r   t h e   s t a t i c   v a r i a b l e s 
 	 i f   ( l a s t O r d e r s T o t a l   = =   - 1 )   { 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 ; } 
 	 i f   ( l a s t P o s i t i o n s T o t a l   = =   - 1 )   { 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 ; } 
 
 	 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 ( ) + 1 ) ; 
 
 	 / / = =   P e n d i n g   o r d e r   c r e a t e d ? 
 	 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   l a s t   o r d e r 
 	 	 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 ) ; 
 
 	 	 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   ( 
 	 	 	 	 O r d e r S e l e c t ( t i c k e 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 )   >   1 
 	 	 	 & &   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 )   = =   O R D E R _ S T A T E _ P L A C E D 
 	 	 )   { 
 	 	 	 / /   E v e n t :   N e w   p e n d i n g   o r d e r   c r e a t e d 
 	 	 	 i f   ( d e b u g )   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 ; 
 	 	 } 
 	 } 
 	 / / = =   P e n d i n g   o r d e r   g o n 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 - - ) 
 	 	 { 
 	 	 	 b o o l   f o u n d   =   f a l s e ; 
 	 	 	 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 ; 
 
 	 	 	 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 ) ; 
 	 	 
 	 	 / /   s o m e t i m e s   w e   l a n d   h e r e   e v e n   w h e n   a   t r a d e   i s   c l o s e d , 
 	 	 / /   s o   w e   w a n t   t o   c h e c k   w h e t h e r   t h e   s e l e c t e d   o r d e r   i s   a   p e n d i n g   o r d e r 
 	 	 l o n g   t y p 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 _ T Y P E ) ; 
 
 	 	 i f   ( t y p e   >   1 ) 
 	 	 { 
 	 	 	 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 ) 
 	 	 	 { 
 	 	 	 	 i f   ( d e b u g )   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 ) 
 	 	 	 { 
 	 	 	 	 i f   ( d e b u g )   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 ) 
 	 	 	 { 
 	 	 	 	 i f   ( d e b u g )   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 ] ,   " c l o s e " ,   " 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 " ; } 
 
 	 	 	 	 	 	 i f   ( d e b u g )   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 ) ) 
 	 	 	 	 	 	 	 { 
 	 	 	 	 	 	 	 	 i f   ( d e b u g )   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 ; 
 	 	 	 	 	 	 	 } 
 	 	 	 	 	 	 	 / /   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 
 	 	 	 	 	 	 	 e l s e   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 ) ) 
 	 	 	 	 	 	 	 { 
 	 	 	 	 	 	 	 	 i f   ( d e b u g )   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 ; 
 	 	 	 	 	 	 	 } 
 	 	 	 	 	 	 	 / /   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 
 	 	 	 	 	 	 	 e l s e   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 ) ) 
 	 	 	 	 	 	 	 { 
 	 	 	 	 	 	 	 	 i f   ( d e b u g )   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 " ; } 
 
 	 	 	 	 	 	 i f   ( d e b u g )   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 ) 
 	 	 	 	 	 	 { 
 	 	 	 	 	 	 	 i f   ( d e b u g )   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 
 	 	 	 	 	 	 { 
 	 	 	 	 	 	 	 i f   ( d e b u g )   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 : 
 
 	 	 	 	 	 	 i f   ( d e b u g )   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 : 
 	 	 	 	 	 	 	 	 i f   ( d e b u g )   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 : 
 	 	 	 	 	 	 	 	 i f   ( d e b u g )   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 : 
 	 	 	 	 	 	 	 	 i f   ( d e b u g )   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 ; 
 	 	 	 	 } 
 	 	 	 } 
 	 	 } 
 	 } 
 
 	 / / = =   N e w   p o s i t i o n   c r e a t e d ? 
 	 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 ; 
 	 } 
 	 / / = =   P o s i t i o n   g o n 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 
 	 	 s t r i n g   e _ d e t a i l   =   " " ; 
 
 	 	 i f   ( S t r i n g F i n d ( H i s t o r y D e a l 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 ( d e a l _ t i c k e t ,   D E A L _ P O S I T I O N _ I D ) ,   D E A L _ C O M M E N T ) ,   " [ e x p : " )   > =   0 ) 
 	 	 { 
 	 	 	 e _ d e t a i l   =   " e x p i r e " ; 
 	 	 } 
 
 	 	 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 _ d e t a i l ) ; 
 	 	 
 	 	 / /   T O D O :   I   c o m m e n t e d   o u t   t h e   r o w   b e l o w   b e c a u s e   i t   g i v e s   ' a r r a y   o u t   o f   t a n g e "   i n   t h i s   e x a m p l e :   h t t p s : / / f x d r e e m a . c o m / b u i l d e r / s h a r e d / d g y i 9 E q R 
 	 	 / / 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 ) ) 
 	 	 	 { 
 	 	 	 	 i f   ( d e b u g )   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 ) ; 
 	 	 	 	 i f   ( d e b u g )   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 ) 
 	 	 	 	 { 
 	 	 	 	 	 i f   ( d e b u g )   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 ) 
 	 	 	 	 { 
 	 	 	 	 	 i f   ( d e b u g )   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 ) 
 	 	 	 { 
 	 	 	 	 i f   ( d e b u g )   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 ) 
 	 	 	 { 
 	 	 	 	 i f   ( d e b u g )   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 ] . 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 ) 
 	 	 	 { 
 	 	 	 	 i f   ( d e b u g )   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 " , " m o v e " ) ; 
 	 	 	 	 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 )   & &   ( 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 ) ) 
 	 	 	 { 
 	 	 	 	 i f   ( d e b u g )   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 ) ; 
 	 	 	 	 i f   ( d e b u g )   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 ) 
 	 	 	 	 { 
 	 	 	 	 	 i f   ( d e b u g )   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 ) 
 	 	 	 	 { 
 	 	 	 	 	 i f   ( d e b u g )   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 ] . 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 ) 
 	 	 	 { 
 	 	 	 	 i f   ( d e b u g )   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 ( ) ; 
 
 	 r e t u r n   e v e n t ; 
 }  
  
 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 n t   t y p e   =   L o a d e d T y p e ( ) ; 
 
 	 i f   ( 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 _ B I D ) ; 
 	 	 } 
 	 	 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 _ A S K ) ; 
 	 	 } 
 	 } 
 	 i f   ( 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 I C E ) ; } 
 	 i f   ( 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 ( O r d e 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 ) ) ; 
 }  
  
 d a t e t i m e   O r d e r C l o s e T i m e ( ) 
 { 
 	 i n t   t y p e   =   L o a d e d T y p e ( ) ; 
 
 	 i f   ( t y p e   = =   1 ) 
 	 { 
 	 	 r e t u r n   0 ; 
 	 } 
 
 	 i f   ( 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 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 I M E ) ; 
 	 } 
 
 	 i f   ( 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 _ D O N E ) ; 
 	 } 
 	 
 	 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 _ D O N E ) ; 
 }  
  
 s t r i n g   O r d e r C o m m e n t ( ) 
 { 
 	 i n t   t y p e   =   L o a d e d T y p e ( ) ; 
 
 	 i f   ( 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   ( 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   ( 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 ) ; 
 }  
  
 l o n g   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 , 
 	 c o l o r         a r r o w c o l o r   =   c l r N O N E , 
 	 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 ( ) ;   / /   u s e d   t o   m e a s u r e   s p e e d   o f   e x e c u t i o n   o f   t h e   o r d e r 
 
 	 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   ( 
 	 	       ( 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 ) 
 	 	 & &   ( 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 ; 
 
 	 / /   c a l c u l a t e   b u y / s e l l   f l a g   ( 1   w h e n   B u y   o r   - 1   w h e n   S e l l ) 
 	 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 ; 
 	 } 
 
 	 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 ( s y m b o l ,   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 ; 
 	 d o u b l e   v s l   =   0 ,   v 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 ,   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 ) ,   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   - 1 ; 
 	 	 	 	 	 } 
 	 	 	 	 	 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 ; 
 	 	 } 
 
 	 	 / /   f i x   t h e   c o m m e n t ,   b e c a u s e   i t   s e e m s   t h a t   t h e   c o m m e n t   i s   d e l e t e d   i f   i t s   l e n g h t   i s   >   3 1   s y m b o l s 
 	 	 i f   ( S t r i n g L e n ( c o m m e n t )   >   3 1 ) 
 	 	 { 
 	 	 	 c o m m e n t   =   S t r i n g S u b s t r ( c o m m e n t ,   0 ,   3 1 ) ; 
 	 	 } 
 
 	 	 / / -   e x p i r a t i o n   f o r   t r a d e s 
 	 	 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   ( e x p i r a t i o n   >   0 ) 
 	 	 	 { 
 	 	 	 	 / / -   c o n v e r t   U N I X   t o   s e c o n d s 
 	 	 	 	 i f   ( e x p i r a t i o n   >   T i m e C u r r e n t ( ) - 1 0 0 ) 
 	 	 	 	 { 
 	 	 	 	 	 e x p i r a t i o n   =   e x p i r a t i o n   -   T i m e C u r r e n t ( ) ; 
 	 	 	 	 } 
 	 	 	 	 
 	 	 	 	 / / -   b o   b r o k e r ? 
 	 	 	 	 i f   ( 
 	 	 	 	 	       S t r i n g L e n ( s y m b o l )   >   6 
 	 	 	 	 	 & &   S t r i n g S u b s t r ( s y m b o l ,   S t r i n g L e n ( s y m b o l )   -   2 )   = =   " b o " 
 	 	 	 	 )   { 
 	 	 	 	 	 c o m m e n t   =   " B O   e x p : "   +   ( s t r i n g ) e x p i r a t i o n ; 
 	 	 	 	 } 
 	 	 	 	 e l s e 
 	 	 	 	 { 
 	 	 	 	 	 s t r i n g   e x p i r a t i o n _ s t r   =   " [ e x p : "   +   I n t e g e r T o S t r i n g ( e x p i r a t i o n )   +   " ] " ; 
 	 	 	 	 	 i n t   e x p i r a t i o n _ l e n         =   S t r i n g L e n ( e x p i r a t i o n _ s t r ) ; 
 	 	 	 	 	 i n t   c o m m e n t _ l e n               =   S t r i n g L e n ( c o m m e n t ) ; 
 
 	 	 	 	 	 i f   ( c o m m e n t _ l e n   >   ( 2 7   -   e x p i r a t i o n _ l e n ) ) 
 	 	 	 	 	 { 
 	 	 	 	 	 	 c o m m e n t   =   S t r i n g S u b s t r ( c o m m e n t ,   0 ,   ( 2 7   -   e x p i r a t i o n _ l e n ) ) ; 
 	 	 	 	 	 } 
 
 	 	 	 	 	 c o m m e n t   =   c o m m e n t   +   e x p i r a t i o n _ s t r ; 
 	 	 	 	 } 
 	 	 	 } 
 	 	 } 
 
 	 	 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   =   ( b s   >   0 )   ?   a s k   :   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 ) ; 
 	 	 s l l   =   N o r m a l i z e D o u b l e ( s l l ,   d i g i t s ) ; 
 	 	 t p l   =   N o r m a l i z e D o u b l e ( t p l ,   d i g i t s ) ; 
 
 	 	 i f   ( o p   <   0   | |   o p   > =   E M P T Y _ V A L U E   | |   s l l   <   0   | |   s l p   <   0   | |   t p l   <   0   | |   t p p   <   0 ) 
 	 	 { 
 	 	 	 b r e a k ; 
 	 	 } 
 
 	 	 / / - -   S L   a n d   T P   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 	 	 v s l   =   0 ; 
 	 	 v t p   =   0 ; 
 
 	 	 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 ; } 
 
 	 	 i f   ( U S E _ V I R T U A L _ S T O P S ) 
 	 	 { 
 	 	 	 / / - -   v i r t u a l   S L   a n d   T P   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 	 	 	 v s l   =   s l ; 
 	 	 	 v t p   =   t p ; 
 	 	 	 s l   =   0 ; 
 	 	 	 t p   =   0 ; 
 	 	 	 
 	 	 	 d o u b l e   a s k b i d   =   ( b s   >   0 )   ?   a s k   :   b i d ; 
 	 	 	 
 	 	 	 i f   ( v s l   >   0   | |   U S E _ E M E R G E N C Y _ S T O P S   = =   " a l w a y s " ) 
 	 	 	 { 
 	 	 	 	 i f   ( E M E R G E N C Y _ S T O P S _ R E L   >   0   | |   E M E R G E N C Y _ S T O P S _ A D D   >   0 ) 
 	 	 	 	 { 
 	 	 	 	 	 s l   =   v s l   -   E M E R G E N C Y _ S T O P S _ R E L   *   M a t h A b s ( a s k b i d   -   v s l )   *   b s ; 
 
 	 	 	 	 	 i f   ( s l   < =   0 )   { s l   =   a s k b i d ; } 
 
 	 	 	 	 	 s l   =   s l   -   t o D i g i t s ( E M E R G E N C Y _ S T O P S _ A D D ,   s y m b o l )   *   b s ; 
 	 	 	 	 } 
 	 	 	 } 
 
 	 	 	 i f   ( v t p   >   0   | |   U S E _ E M E R G E N C Y _ S T O P S   = =   " a l w a y s " ) 
 	 	 	 { 
 	 	 	 	 i f   ( E M E R G E N C Y _ S T O P S _ R E L   >   0   | |   E M E R G E N C Y _ S T O P S _ A D D   >   0 ) 
 	 	 	 	 { 
 	 	 	 	 	 t p   =   v t p   +   E M E R G E N C Y _ S T O P S _ R E L   *   M a t h A b s ( v t p   -   a s k b i d )   *   b s ; 
 
 	 	 	 	 	 i f   ( t p   < =   0 )   { t p   =   a s k b i d ; } 
 
 	 	 	 	 	 t p   =   t p   +   t o D i g i t s ( E M E R G E N C Y _ S T O P S _ A D D ,   s y m b o l )   *   b s ; 
 	 	 	 	 } 
 	 	 	 } 
 
 	 	 	 v s l   =   N o r m a l i z e D o u b l e ( v s l ,   d i g i t s ) ; 
 	 	 	 v t p   =   N o r m a l i z e D o u b l e ( v t p ,   d i g i t s ) ; 
 	 	 } 
 
 	 	 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 ) ; 
 
 	 	 / / - -   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     =   E x p i r a t i o n T y p e B y T i m e ( s y m b o l ,   e x p i r a t i o n ) ; 
 	 	 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 ; 
 	 	 	 e l 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   - 1 ; 
 	 	 } 
 
 	 	 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 ) ; 
 
 	 	 / / - -   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   = =   f a l s 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 _ 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   =   ( t y p e   >   O R D E R _ T Y P E _ S E L L )   ?   " N e w   p e n d i n g   o r d e r   e r r o r "   :   " N e w   p o s i t i o n   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   - 1 ; 
 	 	 } 
 
 	 	 / / - -   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 ) ; 
 	 	 	 	 } 
 	 	 	 } 
 
 	 	 	 / / - -   f i x   a r r o w   c o l o r   ( i t   w o r k s   o n l y   i n   v i s u a l   m o d e ) 
 	 	 	 / /   T O D O :   t h i s   p i e c e   o f   c o d e   s l o w s   d o w n   t h e   b a c k t e s t   f o r   s o m e   r e a s o n 
 	 	 	 i f   ( 0   & &   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 r r o w c o l o r   ! =   C L R _ N O N E ) 
 	 	 	 { 
 	 	 	 	 i f   ( t y p e   < =   O R D E R _ T Y P E _ S E L L ) 
 	 	 	 	 { 
 	 	 	 	 	 u i n t   t 0   =   G e t T i c k C o u n t ( ) ; 
 	 	 	 	 	 E N U M _ O B J E C T   o b j T y p e   =   ( t y p e = = P O S I T I O N _ T Y P E _ B U Y )   ?   O B J _ A R R O W _ B U Y   :   O B J _ A R R O W _ S E L L ; 
 
 	 	 	 	 	 / /   w a i t   f o r   t h e   o b j e c t   t o   b e   c r e a t e d   ( M Q L 5   i s   a s y n c   e v e n   h e r e ) 
 	 	 	 	 	 w h i l e ( t r u e ) 
 	 	 	 	 	 { 
 	 	 	 	 	 	 i n t   t o t a l                 =   O b j e c t s T o t a l ( 0 , 0 , o b j T y p e ) ; 
 	 	 	 	 	 	 s t r i n g   n a m e             =   O b j e c t N a m e ( 0 , t o t a l - 1 , 0 , o b j T y p e ) ; 
 	 	 	 	 	 	 d a t e t i m e   o b j T i m e   =   ( d a t e t i m e ) O b j e c t G e t I n t e g e r ( 0 , n a m e , O B J P R O P _ T I M E ) ; 
 
 	 	 	 	 	 	 i f   ( o b j T i m e   >   T i m e C u r r e n t ( ) - 1 ) 
 	 	 	 	 	 	 { 
 	 	 	 	 	 	 	 i f   ( S t r i n g F i n d ( n a m e ,   " # "   +   I n t e g e r T o S t r i n g ( t i c k e t )   +   "   " )   = =   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 _ C O L O R , a r r o w c o l o r ) ; 
 	 	 	 	 	 	 	 } 
 
 	 	 	 	 	 	 	 b r e a k ; 
 	 	 	 	 	 	 } 
 
 	 	 	 	 	 	 i f   ( G e t T i c k C o u n t ( )   -   t 0   >   1 0 0 0 )   b r e a k ; 
 	 	 	 	 	 } 
 	 	 	 	 } 
 	 	 	 	 e l s e 
 	 	 	 	 { 
 	 	 	 	 	 / /   P e n d i n g   o r d e r s   d o n ' t   h a v e   a r r o w s 
 	 	 	 	 } 
 	 	 	 } 
 	 	 } 
 
 	 	 i f   ( t i c k e t   >   0 ) 
 	 	 { 
 	 	 	 i f   ( U S E _ V I R T U A L _ S T O P S ) 
 	 	 	 { 
 	 	 	 	 V i r t u a l S t o p s D r i v e r ( " s e t " ,   t i c k e t ,   v s l ,   v t p ,   t o P i p s ( M a t h A b s ( o p - v s l ) ,   s y m b o l ) ,   t o P i p s ( M a t h A b s ( v t p - o p ) ,   s y m b o l ) ) ; 
 	 	 	 } 
 
 	 	 	 / / - -   s h o w   s o m e   i n f o 
 	 	 	 d o u b l e   s l i p   =   0 ; 
 
 	 	 	 i f   ( L o a d P o s i t i o n ( t i c k e t ) ) 
 	 	 	 { 
 	 	 	 	 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 ) 
 	 	 	 	 	 & &   ! M Q L I n f o I n t e g e r ( M Q L _ O P T I M I Z A T I O N ) 
 	 	 	 	 )   { 
 	 	 	 	 	 s l i p   =   O r d e r O p e n P r i c e ( )   -   o p ; 
 
 	 	 	 	 	 P r i n t ( 
 	 	 	 	 	 	 " O p e r a t i o n   d e t a i l s :   S p e e d   " , 
 	 	 	 	 	 	 ( G e t T i c k C o u n t ( )   -   t i m e 0 ) , 
 	 	 	 	 	 	 "   m s   |   S l i p p a g e   " , 
 	 	 	 	 	 	 D o u b l e T o S t r ( t o P i p s ( s l i p ,   s y m b o l ) ,   1 ) , 
 	 	 	 	 	 	 "   p i p s " 
 	 	 	 	 	 ) ; 
 	 	 	 	 } 
 	 	 	 } 
 	 	 	 
 	 	 	 / / - -   f i x   s t o p s   i n   c a s e   o f   s l i p p a g e 
 	 	 	 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 ) 
 	 	 	 	 & &   ! M Q L I n f o I n t e g e r ( M Q L _ O P T I M I Z A T I O N ) 
 	 	 	 )   { 
 
 	 	 	 	 s l i p   =   N o r m a l i z e D o u b l e ( O r d e r O p e n P r i c e ( ) ,   d i g i t s )   -   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   ( s l i p   ! =   0   & &   ( O r d e r S t o p L o s s ( )   ! =   0   | |   O r d e r T a k e P r o f i t ( )   ! =   0 ) ) 
 	 	 	 	 { 
 	 	 	 	 	 P r i n t ( " C o r r e c t i n g   s t o p s   b e c a u s e   o f   s l i p p a g e . . . " ) ; 
 
 	 	 	 	 	 s l   =   O r d e r S t o p L o s s ( ) ; 
 	 	 	 	 	 t p   =   O r d e r T a k e P r o f i t ( ) ; 
 
 	 	 	 	 	 i f   ( s l   ! =   0   | |   t p   ! =   0 ) 
 	 	 	 	 	 { 
 	 	 	 	 	 	 i f   ( s l   ! =   0 )   { s l   =   N o r m a l i z e D o u b l e ( O r d e r S t o p L o s s ( )   +   s l i p ,   d i g i t s ) ; } 
 	 	 	 	 	 	 i f   ( t p   ! =   0 )   { t p   =   N o r m a l i z e D o u b l e ( O r d e r T a k e P r o f i t ( )   +   s l i p ,   d i g i t s ) ; } 
 
 	 	 	 	 	 	 M o d i f y O r d e r ( t i c k e t ,   O r d e r O p e n P r i c e ( ) ,   s l ,   t p ,   0 ,   0 ) ; 
 	 	 	 	 	 } 
 	 	 	 	 } 
 	 	 	 } 
 
 	 	 	 / / R e g i s t e r E v e n t ( " t r a d e " ) ; 
 
 	 	 	 b r e a k ; 
 	 	 } 
 
 	 	 b r e a k ; 
 	 } 
 
 	 i f   ( o c o   = =   t r u e   & &   t i c k e t   >   0 ) 
 	 { 
 	 	 i f   ( U S E _ V I R T U A L _ S T O P S ) 
 	 	 { 
 	 	 	 s l   =   v s l ; 
 	 	 	 t p   =   v t p ; 
 	 	 } 
 
 	 	 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 , 
 	 	 	 a r r o w c o l o r , 
 	 	 	 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   ( l o n g ) t i c k e t ; 
 }  
  
 d a t e t i m e   O r d e r E x p i r a t i o n ( ) 
 { 
 	 i f   ( L o a d e d T y p e ( )   = =   2 )   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 _ E X P I R A T I O N ) ; 
 
 	 r e t u r n   0 ; 
 }  
  
 d o u b l e   O r d e r L o t s ( ) 
 { 
 	 i n t   t y p e         =   L o a d e d T y p e ( ) ; 
 	 d o u b l e   l o t s   =   0 ; 
 
 	           i f   ( t y p e   = =   1 )   { l o t s   =   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 ) ; } 
 	 e l s e   i f   ( t y p e   = =   3 )   { l o t s   =   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 _ V O L U M E ) ; } 
 	 e l s e   i f   ( t y p e   = =   4 )   { l o t s   =   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 _ V O L U M E _ I N I T I A L ) ; } 
 	 e l s e                                 { l o t s   =   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 ) ; } 
 
 	 r e t u r n   N o r m a l i z e D o u b l e ( l o t s ,   2 ) ; 
 }  
  
 i n t   O r d e r M a g i c N u m b e r ( ) 
 { 
 	 i n t   t y p e   =   L o a d e d T y p e ( ) ; 
 
 	 i f   ( 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   ( 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   ( 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 ) ; 
 }  
  
 b o o l   O r d e r M o d i f i e d ( u l o n g   t i c k e t   =   0 ,   s t r i n g   a c t i o n   =   " s e t " ) 
 { 
 	 s t a t i c   u l o n g   m e m o r y [ ] ; 
 
 	 i f   ( t i c k e t   = =   0 ) 
 	 { 
 	 	 t i c k e t   =   O r d e r T i c k e t ( ) ; 
 	 	 a c t i o n   =   " g e t " ; 
 	 } 
 	 e l s e   i f   ( t i c k e t   >   0   & &   a c t i o n   ! =   " c l e a r " ) 
 	 { 
 	 	 a c t i o n   =   " s e t " ; 
 	 } 
 
 	 b o o l   m o d i f i e d _ s t a t u s   =   I n A r r a y ( m e m o r y ,   t i c k e t ) ; 
 	 
 	 i f   ( a c t i o n   = =   " g e t " ) 
 	 { 
 	 	 r e t u r n   m o d i f i e d _ s t a t u s ; 
 	 } 
 	 e l s e   i f   ( a c t i o n   = =   " s e t " ) 
 	 { 
 	 	 A r r a y E n s u r e V a l u e ( m e m o r y ,   t i c k e t ) ; 
 
 	 	 r e t u r n   t r u e ; 
 	 } 
 	 e l s e   i f   ( a c t i o n   = =   " c l e a r " ) 
 	 { 
 	 	 A r r a y S t r i p V a l u e ( m e m o r y ,   t i c k e t ) ; 
 
 	 	 r e t u r n   t r u e ; 
 	 } 
 
 	 r e t u r n   f a l s e ; 
 }  
  
 d o u b l e   O r d e r O p e n P r i c e ( ) 
 { 
 	 d o u b l e   o p     =   0 . 0 ; 
 	 i n t   t y p e       =   L o a d e d T y p e ( ) ; 
 	 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 ( O r d e r S y m b o l ( ) ,   S Y M B O L _ D I G I T S ) ; 
 
 	 i f   ( t y p e   = =   1 ) 
 	 { 
 	 	 o 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 _ P R I C E _ O P E N ) ; 
 	 } 
 	 e l s e   i f   ( t y p e   = =   3 ) 
 	 { 
 	 	 / /   I n   m o s t   b r o k e r s   w e   c a n   g e t   t h e   " i n "   o r d e r   a n d   g e t   t h e   o p e n   p r i c e   f r o m   i t , 
 	 	 / /   b u t   i n   A d m i r a l   M a r k e t s   t h i s   r e t u r n s   0 .   S o   w e   s e a r c h   f o r   t h e   " i n "   d e a l . 
 	 	 u l o n g   o u t D e a l T i c k e t   =   O r d e r T i c k e t ( ) ; 
 	 	 u l o n g   p o s i t i o n I D         =   H i s t o r y D e a l G e t I n t e g e r ( o u t D e a l T i c k e t ,   D E A L _ P O S I T I O N _ I D ) ; 
 	 	 
 	 	 i f   ( H i s t o r y S e l e c t B y P o s i t i o n ( p o s i t i o n I D ) ) 
 	 	 { 
 	 	 	 i n t   d e a l s T o t a l   =   H i s t o r y D e a l s T o t a l ( ) ; 
 	 
 	 	 	 f o r   ( i n t   i n d e x   =   d e a l s T o t a l   -   1 ;   i n d e x   > =   0 ;   i n d e x - - ) 
 	 	 	 { 
 	 	 	 	 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 ( i n d e x ) ; 
 	 
 	 	 	 	 i f   ( 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 )   = =   D E A L _ E N T R Y _ I N ) 
 	 	 	 	 { 
 	 	 	 	 	 o p   =   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 ) ; 
 	 
 	 	 	 	 	 b r e a k ; 
 	 	 	 	 } 
 	 	 	 } 
 	 	 } 
 
 	 	 / /   R e s t o r e   p r e v i o u s l y   s e l e c t e d   h i s t o r y 
 	 	 H i s t o r y S e l e c t ( S e l e c t e d H i s t o r y F r o m T i m e ( ) ,   S e l e c t e d H i s t o r y T o T i m e ( ) ) ; 
 	 } 
 	 e l s e   i f   ( t y p e   = =   4 ) 
 	 { 
 	 	 o p   =   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 ) ; 
 	 } 
       e l s e 
       { 
       	 o p   =   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 ) ; 
       } 
 
 	 r e t u r n   N o r m a l i z e D o u b l e ( o p ,   d i g i t s ) ; 
 }  
  
 d a t e t i m e   O r d e r O p e n T i m e ( ) 
 { 
 	 d a t e t i m e   t i m e   =   0 ; 
 	 i n t   t y p e             =   L o a d e d T y p e ( ) ; 
 
 	 i f   ( t y p e   = =   1 ) 
 	 { 
 	 	 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 ) ; 
 	 } 
 	 / / i f   ( 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 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 ) ; } 
 	 e l s e   i f   ( t y p e   = =   3 ) 
 	 { 
 	 	 u l o n g   o u t D e a l T i c k e t   =   O r d e r T i c k e t ( ) ; 
 	 	 u l o n g   p o s i t i o n I D         =   H i s t o r y D e a l G e t I n t e g e r ( o u t D e a l T i c k e t ,   D E A L _ P O S I T I O N _ I D ) ; 
 
 	 	 i f   ( H i s t o r y S e l e c t B y P o s i t i o n ( p o s i t i o n I D ) ) 
 	 	 { 
 	 	 	 i n t   d e a l s T o t a l   =   H i s t o r y D e a l s T o t a l ( ) ; 
 	 
 	 	 	 f o r   ( i n t   i n d e x   =   d e a l s T o t a l   -   1 ;   i n d e x   > =   0 ;   i n d e x - - ) 
 	 	 	 { 
 	 	 	 	 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 ( i n d e x ) ; 
 	 
 	 	 	 	 i f   ( 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 )   = =   D E A L _ E N T R Y _ I N ) 
 	 	 	 	 { 
 	 	 	 	 	 t i m e   =   ( d a t e t i m 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 ) ; 
 	 
 	 	 	 	 	 b r e a k ; 
 	 	 	 	 } 
 	 	 	 } 
 	 	 } 
 
 	 	 / /   R e s t o r e   p r e v i o u s l y   s e l e c t e d   h i s t o r y 
 	 	 H i s t o r y S e l e c t ( S e l e c t e d H i s t o r y F r o m T i m e ( ) ,   S e l e c t e d H i s t o r y T o T i m e ( ) ) ; 
 	 } 
 	 e l s e   i f   ( t y p e   = =   4 ) 
 	 { 
 	 	 t i m e   =   ( 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 ) ; 
 	 } 
 	 e l s e 
 	 { 
 	 	 t i m 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 _ S E T U P ) ; 
 	 } 
 	 
 	 r e t u r n   t i m e ; 
 }  
  
 d o u b l e   O r d e r S t o p L o s s ( ) 
 { 
 	 i n t   t y p e   =   L o a d e d T y p e ( ) ; 
 
 	 i f   ( 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 L ) ; } 
 	 i f   ( 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 _ S L ) ; } 
 	 i f   ( 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 _ S L ) ; } 
 
 	 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 _ S L ) ; 
 }  
  
 s t r i n g   O r d e r S y m b o l ( ) 
 { 
 	 i n t   t y p e   =   L o a d e d T y p e ( ) ; 
 
 	 i f   ( 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   ( 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   ( 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 ) ; 
 }  
  
 d o u b l e   O r d e r T a k e P r o f i t ( ) 
 { 
 	 i n t   t y p e   =   L o a d e d T y p e ( ) ; 
 
 	 i f   ( 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 _ T P ) ; } 
 	 i f   ( 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 _ T P ) ; } 
 	 i f   ( 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 _ T P ) ; } 
 
 	 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 _ T P ) ; 
 }  
  
 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   =   0 ; 
 	 
 	 i f   ( t i c k e t   >   0 )   { m e m o r y   =   t i c k e t ; } 
 	 
 	 r e t u r n   m e m o r y ; 
 }  
  
 i n t   O r d e r T y p e ( ) 
 { 
 	 i n t   t y p e   =   L o a d e d T y p e ( ) ; 
 
 	 i f   ( 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   ( t y p e   = =   2 )   { 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 ) ; } 
 	 i f   ( 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   ( 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 ) ; 
 }  
  
 b o o l   P e n d i n g O r d e r S e l e c t B y T i c k e t ( 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 ; 
 }  
  
 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   =   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 n t   S e c o n d s F r o m C o m p o n e n t s ( d o u b l e   d a y s ,   d o u b l e   h o u r s ,   d o u b l e   m i n u t e s ,   i n t   s e c o n d s ) 
 { 
 	 i n t   r e t v a l   = 
 	 	 8 6 4 0 0   *   ( i n t ) M a t h F l o o r ( d a y s ) 
 	 	 +   3 6 0 0   *   ( i n t ) ( M a t h F l o o r ( h o u r s )   +   ( 2 4   *   ( d a y s   -   M a t h F l o o r ( d a y s ) ) ) ) 
 	 	 +   6 0   *   ( i n t ) ( M a t h F l o o r ( m i n u t e s )   +   ( 6 0   *   ( h o u r s   -   M a t h F l o o r ( h o u r s ) ) ) ) 
 	 	 +   ( i n t ) ( ( d o u b l e ) s e c o n d s   +   ( 6 0   *   ( m i n u t e s   -   M a t h F l o o r ( m i n u t e s ) ) ) ) ; 
 
 	 r e t u r n   r e t v a l ; 
 }  
  
 d a t e t i m e   S e l e c t e d H i s t o r y F r o m T i m e ( d a t e t i m e   s e t T i m e   =   - 1 ) 
 { 
 	 s t a t i c   d a t e t i m e   t i m e ; 
 	 
 	 i f   ( s e t T i m e   >   - 1 ) 
 	 { 
 	 	 t i m e   =   s e t T i m e ; 
 	 } 
 	 
 	 r e t u r n   t i m e ; 
 }  
  
 d a t e t i m e   S e l e c t e d H i s t o r y T o T i m e ( d a t e t i m e   s e t T i m e   =   - 1 ) 
 { 
 	 s t a t i c   d a t e t i m e   t i m e ; 
 	 
 	 i f   ( s e t T i m e   >   - 1 ) 
 	 { 
 	 	 t i m e   =   s e t T i m e ; 
 	 } 
 	 
 	 r e t u r n   t i m e ; 
 }  
  
 l o n g   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   =   " " , 
 	 c o l o r   a r r o w c o l o r   =   c l r N O N E , 
 	 d a t e t i m e   e x p i r a t i o n   =   0 
 	 ) 
 { 
 	 r e t u r n   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 , 
 	 	 a r r o w c o l o r , 
 	 	 e x p i r a t i o n 
 	 ) ; 
 }  
  
 b o o l   S e t F l a g B ( s t r i n g   f l a g n a m e ,   b o o l   f l a g v a l u e ,   s t r i n g   c o m m a n d = " s e t " ) 
 { 
 	 s t a t i c   s t r i n g   i d s [ ] ; 
 	 s t a t i c   b o o l   m e m o r y [ ] ; 
 
 	 i n t   s i z e ; 
 	 i n t   i ; 
 	 i n t   i d   =   - 1 ; 
 
 	 s i z e   =   A r r a y S i z e ( i d s ) ; 
 
 	 i f   ( s i z e   >   0 ) 
 	 { 
 	 	 f o r   ( i   =   0 ;   i   <   s i z e ;   i + + ) 
 	 	 { 
 	 	 	 i f   ( i d s [ i ]   = =   f l a g n a m e ) 
 	 	 	 { 
 	 	 	 	 i d   =   i ; 
 	 	 	 	 b r e a k ; 
 	 	 	 } 
 	 }     } 
 
 	 i f   ( c o m m a n d   = =   " s e t " ) 
 	 { 
 	 	 i f   ( i d   >   - 1 ) 
 	 	 { 
 	 	 	 m e m o r y [ i d ]   =   f l a g v a l u e ; 
 	 	 	 r e t u r n   m e m o r y [ i d ] ; 
 	 	 } 
 
 	 	 i f   ( f l a g n a m e   ! =   " " ) 
 	 	 { 
 	 	 	 A r r a y R e s i z e ( i d s , s i z e + 1 ) ; 
 	 	 	 A r r a y R e s i z e ( m e m o r y , s i z e + 1 ) ; 
 
 	 	 	 i d s [ s i z e ]         =   f l a g n a m e ; 
 	 	 	 m e m o r y [ s i z e ]   =   f l a g v a l u e ; 
 	 	 } 
 	 } 
 	 e l s e 
 	 { 
 	 	 i f   ( i d   >   - 1 ) 
 	 	 { 
 	 	 	 r e t u r n   m e m o r y [ i d ] ; 
 	 	 } 
 
 	 	 r e t u r n   f a l s e ; 
 	 } 
 
 	 r e t u r n   f a l s e ; 
 }  
  
 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 ) ; 
 }  
  
 t e m p l a t e < t y p e n a m e   T > 
 v o i d   S t r i n g E x p l o d e ( s t r i n g   d e l i m i t e r ,   s t r i n g   i n p u t S t r i n g ,   T   & o u t p u t [ ] ) 
 { 
 	 i n t   b e g i n       =   0 ; 
 	 i n t   e n d           =   0 ; 
 	 i n t   e l e m e n t   =   0 ; 
 	 i n t   l e n g t h     =   S t r i n g L e n ( i n p u t S t r i n g ) ; 
 	 i n t   l e n g t h _ d e l i m i t e r   =   S t r i n g L e n ( d e l i m i t e r ) ; 
 	 T   e m p t y _ v a l     =   ( t y p e n a m e ( T )   = =   " s t r i n g " )   ?   ( T ) " "   :   ( T ) 0 ; 
 
 	 i f   ( l e n g t h   >   0 ) 
 	 { 
 	 	 w h i l e   ( t r u e ) 
 	 	 { 
 	 	 	 e n d   =   S t r i n g F i n d ( i n p u t S t r i n g ,   d e l i m i t e r ,   b e g i n ) ; 
 
 	 	 	 A r r a y R e s i z e ( o u t p u t ,   e l e m e n t   +   1 ) ; 
 	 	 	 o u t p u t [ e l e m e n t ]   =   e m p t y _ v a l ; 
 	 
 	 	 	 i f   ( e n d   ! =   - 1 ) 
 	 	 	 { 
 	 	 	 	 i f   ( e n d   >   b e g i n ) 
 	 	 	 	 { 
 	 	 	 	 	 o u t p u t [ e l e m e n t ]   =   ( T ) S t r i n g S u b s t r ( i n p u t S t r i n g ,   b e g i n ,   e n d   -   b e g i n ) ; 
 	 	 	 	 } 
 	 	 	 } 
 	 	 	 e l s e 
 	 	 	 { 
 	 	 	 	 o u t p u t [ e l e m e n t ]   =   ( T ) S t r i n g S u b s t r ( i n p u t S t r i n g ,   b e g i n ,   l e n g t h   -   b e g i n ) ; 
 	 	 	 	 b r e a k ; 
 	 	 	 } 
 	 	 	 
 	 	 	 b e g i n   =   e n d   +   1   +   ( l e n g t h _ d e l i m i t e r   -   1 ) ; 
 	 	 	 e l e m e n t + + ; 
 	 	 } 
 	 } 
 	 e l s e 
 	 { 
 	 	 A r r a y R e s i z e ( o u t p u t ,   1 ) ; 
 	 	 o u t p u t [ e l e m e n t ]   =   e m p t y _ v a l ; 
 	 } 
 }  
  
 t e m p l a t e < t y p e n a m e   T > 
 s t r i n g   S t r i n g I m p l o d e ( s t r i n g   d e l i m e t e r ,   T   & a r r a y [ ] ) 
 { 
       s t r i n g   r e t v a l   =   " " ; 
 	 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 + + ) 
 	 { 
             S t r i n g C o n c a t e n a t e ( r e t v a l ,   r e t v a l ,   ( s t r i n g ) a r r a y [ i ] ,   d e l i m e t e r ) ; 
       } 
 
       r e t u r n   S t r i n g S u b s t r ( r e t v a l ,   0 ,   ( S t r i n g L e n ( r e t v a l )   -   S t r i n g L e n ( d e l i m e t e r ) ) ) ; 
 }  
  
 d a t e t i m e   S t r i n g T o T i m e E x ( s t r i n g   s t r ,   s t r i n g   m o d e = " s e r v e r " ) 
 { 
 	 / /   m o d e :   s e r v e r ,   l o c a l ,   g m t 
 	 i f   ( S t r i n g F i n d ( s t r ,   "   " )   ! =   - 1 )   { 
 	       r e t u r n   S t r i n g T o T i m e ( s t r ) ; 
 	 } 
 
 	 d a t e t i m e   n o w   =   0 ; 
 	 d a t e t i m e   r e t v a l   =   0 ; 
 
 	           i f   ( m o d e   = =   " s e r v e r " )   { n o w   =   T i m e C u r r e n t ( ) ; } 
 	 e l s e   i f   ( m o d e   = =   " l o c a l " )   { n o w   =   T i m e L o c a l ( ) ; } 
 	 e l s e   i f   ( m o d e   = =   " g m t " )   { n o w   =   T i m e G M T ( ) ; } 
 
 	 r e t u r n   S t r i n g T o T i m e ( ( s t r i n g ) T i m e Y e a r ( n o w ) + " . " + ( s t r i n g ) T i m e M o n t h ( n o w ) + " . " + ( s t r i n g ) T i m e D a y ( n o w ) + "   " + s t r ) ; 
 }  
  
 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   =   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   =   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 ) ; 
 }  
  
 i n t   S y m b o l 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   =   S y m b o l ( ) ; 
 
 	 r e t u r n   ( 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   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 ) 
 { 
 	 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   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 ) 
 	 { 
 	 	 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 ) ; 
 	 	 	 	 	 } 
 	 	 	 	 } 
 	 	 	 } 
 	 	 } 
 	 } 
 
 	 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 ; 
 	 s t a t i c   i n t   t i c k s             =   0 ; 
 	 s t a t i c   i n t   t p s                 =   0 ; 
 	 s t a t i c   i n t   t p s m a x           =   0 ; 
 
 	 d a t e t i m e   t i m e 1   =   T i m e L o c a l ( ) ; 
 
 	 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 ; 
 }  
  
 i n t   T i m e D a y ( 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 . d a y ) ;  
 }  
  
 i n t   T i m e D a y O f W e e k ( 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 . d a y _ o f _ w e e k ) ;  
 }  
  
 d a t e t i m e   T i m e F r o m C o m p o n e n t s ( 
 	 i n t   t i m e _ s r c   =   0 , 
 	 i n t         y   =   0 , 
 	 i n t         m   =   0 , 
 	 d o u b l e   d   =   0 , 
 	 d o u b l e   h   =   0 , 
 	 d o u b l e   i   =   0 , 
 	 i n t         s   =   0 
 )   { 
 	 M q l D a t e T i m e   t m ; 
 
 	           i f   ( t i m e _ s r c   = =   0 )   { T i m e C u r r e n t ( t m ) ; } 
 	 e l s e   i f   ( t i m e _ s r c   = =   1 )   { T i m e L o c a l ( t m ) ; } 
 	 e l s e   i f   ( t i m e _ s r c   = =   2 )   { T i m e G M T ( t m ) ; } 
 
 	 i f   ( y   >   0 ) 
 	 { 
 	 	 i f   ( y   <   1 0 0 )   { y   =   2 0 0 0   +   y ; } 
 	 	 t m . y e a r   =   y ; 
 	 } 
 	 i f   ( m   >   0 )   { t m . m o n   =   m ; } 
 	 i f   ( d   >   0 )   { t m . d a y   =   ( i n t ) M a t h F l o o r ( d ) ; } 
 
 	 t m . h o u r   =   ( i n t ) ( M a t h F l o o r ( h )   +   ( 2 4   *   ( d   -   M a t h F l o o r ( d ) ) ) ) ; 
 	 t m . m i n     =   ( i n t ) ( M a t h F l o o r ( i )   +   ( 6 0   *   ( h   -   M a t h F l o o r ( h ) ) ) ) ; 
 	 t m . s e c     =   ( i n t ) ( ( d o u b l e ) s   +   ( 6 0   *   ( i   -   M a t h F l o o r ( i ) ) ) ) ; 
 
 	 r e t u r n   S t r u c t T o T i m e ( t m ) ; 
 }  
  
 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 M o n t h ( 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 o 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 ; 
 }  
  
 i n t   T i m e Y e a 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 . y e a r ; 
 }  
  
 b o o l   T r a d e S e l e c t B y I n d e x ( 
 	 i n t   i n d e x , 
 	 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 " 
 )   { 
 	 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 ( i n d e x ) ) ) 
 	 { 
 	 	 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 ) 
 	 	 	 ) 
 	 	 { 
 	 	 	 r e t u r n   t r u e ; 
 	 	 } 
 	 } 
 
 	 r e t u r n   f a l s e ; 
 }  
  
 b o o l   T r a d e S e l e c t B y T i c k e t ( u l o n g   t i c k e t ) 
 { 
 	 i f   ( L o a d P o s i t i o n ( t i c k e t )   & &   O r d e r T y p e ( )   <   2 ) 
 	 { 
 	 	 r e t u r n   t r u e ; 
 	 } 
 
 	 r e t u r n   f a l s e ; 
 }  
  
 i n t   T r a d e s T o t a l ( ) 
 { 
 	 r e t u r n   P o s i t i o n s T o t a l ( ) ; 
 }  
  
 / /   T O D O :   V i r t u a l   S L   a n d   T P   i n   M Q L 5 
 
 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 _ P O S I T I O N _ I D ) ,   O R D E R _ S 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 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 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 _ P O S I T I O N _ I D ) ,   O R D E R _ T P ) ) ; 
 	 e _ a t t r T i c k e t           ( 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 _ P O S I T I O N _ I D ) ) ; 
 
 	 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 w a p               ( t r u e ,   d a t a . s w a p ) ; 
 	 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 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 w a p               ( t r u e ,   0 ) ; 
 	 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 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   V i r t u a l S t o p s D r i v e r ( 
 	 s t r i n g   c o m m a n d   =   " " , 
 	 u l o n g   t i               =   0 , 
 	 d o u b l e   s l             =   0 , 
 	 d o u b l e   t p             =   0 , 
 	 d o u b l e   s l p           =   0 , 
 	 d o u b l e   t p p           =   0 
 ) 
 { 
 	 s t a t i c   b o o l   i n i t i a l i z e d           =   f a l s e ; 
 	 s t a t i c   s t r i n g   n a m e                     =   " " ; 
 	 s t a t i c   s t r i n g   l o o p _ n a m e [ 2 ]     =   { " s l " ,   " t p " } ; 
 	 s t a t i c   c o l o r     l o o p _ c o l o r [ 2 ]   =   { D e e p P i n k ,   D o d g e r B l u e } ; 
 	 s t a t i c   d o u b l e   l o o p _ p r i c e [ 2 ]   =   { 0 ,   0 } ; 
 	 s t a t i c   u l o n g   m e m _ t o _ t i [ ] ;   / /   t i c k e t s 
 	 s t a t i c   i n t   m e m _ t o [ ] ;             / /   t i m e o u t s 
 	 s t a t i c   b o o l   t r a d e _ p a s s   =   f a l s e ; 
 	 i n t   i   =   0 ; 
 
 	 / /   A r e   V i r t u a l   S t o p s   e v e n   e n a b l e d ? 
 	 i f   ( ! U S E _ V I R T U A L _ S T O P S ) 
 	 { 
 	 	 r e t u r n   0 ; 
 	 } 
 	 
 	 i f   ( i n i t i a l i z e d   = =   f a l s e   | |   c o m m a n d   = =   " i n i t i a l i z e " ) 
 	 { 
 	 	 i n i t i a l i z e d   =   t r u e ; 
 	 } 
 
 	 / /   L i s t e n 
 	 i f   ( c o m m a n d   = =   " "   | |   c o m m a n d   = =   " l i s t e n " ) 
 	 { 
 	 	 i n t   t o t a l           =   O b j e c t s T o t a l ( 0 ,   - 1 ,   O B J _ H L I N E ) ; 
 	 	 i n t   l e n g t h         =   0 ; 
 	 	 c o l o r   c l r           =   c l r N O N E ; 
 	 	 i n t   s l t p             =   0 ; 
 	 	 u l o n g   t i c k e t     =   0 ; 
 	 	 d o u b l e   l e v e l     =   0 ; 
 	 	 d o u b l e   a s k b i d   =   0 ; 
 	 	 i n t   p o l a r i t y     =   0 ; 
 	 	 s t r i n g   s y m b o l   =   " " ; 
 
 	 	 f o r   ( i   =   t o t a l   -   1 ;   i   > =   0 ;   i - - ) 
 	 	 { 
 	 	 	 n a m e   =   O b j e c t N a m e ( 0 ,   i ,   - 1 ,   O B J _ H L I N E ) ;   / /   f o r   e x a m p l e :   # 1   s l 
 
 	 	 	 i f   ( S t r i n g S u b s t r ( n a m e ,   0 ,   1 )   ! =   " # " ) 
 	 	 	 { 
 	 	 	 	 c o n t i n u e ; 
 	 	 	 } 
 
 	 	 	 l e n g t h   =   S t r i n g L e n ( n a m e ) ; 
 
 	 	 	 i f   ( l e n g t h   <   5 ) 
 	 	 	 { 
 	 	 	 	 c o n t i n u e ; 
 	 	 	 } 
 
 	 	 	 c l r   =   ( c o l o r ) O b j e c t G 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 ) ; 
 
 	 	 	 i f   ( c l r   ! =   l o o p _ c o l o r [ 0 ]   & &   c l r   ! =   l o o p _ c o l o r [ 1 ] ) 
 	 	 	 { 
 	 	 	 	 c o n t i n u e ; 
 	 	 	 } 
 
 	 	 	 s t r i n g   l a s t _ s y m b o l s   =   S t r i n g S u b s t r ( n a m e ,   l e n g t h - 2 ,   2 ) ; 
 
 	 	 	 i f   ( l a s t _ s y m b o l s   = =   " s l " ) 
 	 	 	 { 
 	 	 	 	 s l t p   =   - 1 ; 
 	 	 	 } 
 	 	 	 e l s e   i f   ( l a s t _ s y m b o l s   = =   " t p " ) 
 	 	 	 { 
 	 	 	 	 s l t p   =   1 ; 
 	 	 	 } 
 	 	 	 e l s e 
 	 	 	 { 
 	 	 	 	 c o n t i n u e ; 	 
 	 	 	 } 
 
 	 	 	 u l o n g   t i c k e t 0   =   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 ( n a m e ,   1 ,   l e n g t h   -   4 ) ) ; 
 
 	 	 	 / /   p r e v e n t   l o a d i n g   t h e   s a m e   t i c k e t   n u m b e r   t w i c e   i n   a   r o w 
 	 	 	 i f   ( t i c k e t 0   ! =   t i c k e t ) 
 	 	 	 { 
 	 	 	 	 t i c k e t   =   t i c k e t 0 ; 
 
 	 	 	 	 i f   ( T r a d e S e l e c t B y T i c k e t ( t i c k e t ) ) 
 	 	 	 	 { 
 	 	 	 	 	 s y m b o l           =   O r d e r S y m b o l ( ) ; 
 	 	 	 	 	 p o l a r i t y       =   ( O r d e r T y p e ( )   = =   0 )   ?   1   :   - 1 ; 
 	 	 	 	 	 a s k b i d       =   ( O r d e r T y p e ( )   = =   0 )   ?   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 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 ) ; 
 	 	 	 	 	 
 	 	 	 	 	 t r a d e _ p a s s   =   t r u e ; 
 	 	 	 	 } 
 	 	 	 	 e l s e 
 	 	 	 	 { 
 	 	 	 	 	 t r a d e _ p a s s   =   f a l s e ; 
 	 	 	 	 } 
 	 	 	 } 
 
 	 	 	 i f   ( t r a d e _ p a s s ) 
 	 	 	 { 
 	 	 	 	 l e v e l         =   O b j e c t G e t D o u b l e ( 0 ,   n a m e ,   O B J P R O P _ P R I C E ,   0 ) ; 
 
 	 	 	 	 i f   ( l e v e l   >   0 ) 
 	 	 	 	 { 
 	 	 	 	 	 / /   p o l a r i z e   l e v e l s 
 	 	 	 	 	 d o u b l e   l e v e l _ p     =   p o l a r i t y   *   l e v e l ; 
 	 	 	 	 	 d o u b l e   a s k b i d _ p   =   p o l a r i t y   *   a s k b i d ; 
 
 	 	 	 	 	 i f   ( 
 	 	 	 	 	 	       ( s l t p   = =   - 1   & &   ( l e v e l _ p   -   a s k b i d _ p )   > =   0 )   / /   s l 
 	 	 	 	 	 	 | |   ( s l t p   = =   1   & &   ( a s k b i d _ p   -   l e v e l _ p )   > =   0 )     / /   t p 
 	 	 	 	 	 ) 
 	 	 	 	 	 { 
 	 	 	 	 	 	 / / - -   V i r t u a l   S t o p s   S L   T i m e o u t 
 	 	 	 	 	 	 i f   ( 
 	 	 	 	 	 	 	       ( V I R T U A L _ S T O P S _ T I M E O U T   >   0 ) 
 	 	 	 	 	 	 	 & &   ( s l t p   = =   - 1   & &   ( l e v e l _ p   -   a s k b i d _ p )   > =   0 )   / /   s l 
 	 	 	 	 	 	 ) 
 	 	 	 	 	 	 { 
 	 	 	 	 	 	 	 / /   s t a r t   t i m e o u t ? 
 	 	 	 	 	 	 	 i n t   i n d e x   =   A r r a y S e a r c h ( m e m _ t o _ t i ,   t i c k e t ) ; 
 
 	 	 	 	 	 	 	 i f   ( i n d e x   <   0 ) 
 	 	 	 	 	 	 	 { 
 	 	 	 	 	 	 	 	 i n t   s i z e   =   A r r a y S i z e ( m e m _ t o _ t i ) ; 
 	 	 	 	 	 	 	 	 A r r a y R e s i z e ( m e m _ t o _ t i ,   s i z e + 1 ) ; 
 	 	 	 	 	 	 	 	 A r r a y R e s i z e ( m e m _ t o ,   s i z e + 1 ) ; 
 	 	 	 	 	 	 	 	 m e m _ t o _ t i [ s i z e ]   =   t i c k e t ; 
 	 	 	 	 	 	 	 	 m e m _ t o [ s i z e ]         =   ( i n t ) T i m e L o c a l ( ) ; 
 
 	 	 	 	 	 	 	 	 P r i n t ( 
 	 	 	 	 	 	 	 	 	 " # " , 
 	 	 	 	 	 	 	 	 	 t i c k e t , 
 	 	 	 	 	 	 	 	 	 "   t i m e o u t   o f   " , 
 	 	 	 	 	 	 	 	 	 V I R T U A L _ S T O P S _ T I M E O U T , 
 	 	 	 	 	 	 	 	 	 "   s e c o n d s   s t a r t e d " 
 	 	 	 	 	 	 	 	 ) ; 
 
 	 	 	 	 	 	 	 	 r e t u r n   0 ; 
 	 	 	 	 	 	 	 } 
 	 	 	 	 	 	 	 e l s e 
 	 	 	 	 	 	 	 { 
 	 	 	 	 	 	 	 	 i f   ( T i m e L o c a l ( )   -   m e m _ t o [ i n d e x ]   < =   V I R T U A L _ S T O P S _ T I M E O U T ) 
 	 	 	 	 	 	 	 	 { 
 	 	 	 	 	 	 	 	 	 r e t u r n   0 ; 
 	 	 	 	 	 	 	 	 } 
 	 	 	 	 	 	 	 } 
 	 	 	 	 	 	 } 
 
 	 	 	 	 	 	 i f   ( C l o s e T r a d e ( t i c k e t ) ) 
 	 	 	 	 	 	 { 
 	 	 	 	 	 	 	 / /   c h e c k   t h i s   b e f o r e   d e l e t i n g   t h e   l i n e s 
 	 	 	 	 	 	 	 / / O n T r a d e L i s t e n e r ( ) ; 
 
 	 	 	 	 	 	 	 / /   d e l e t e   o b j e c t s 
 	 	 	 	 	 	 	 O b j e c t D e l e t e ( 0 ,   " # "   +   ( s t r i n g ) t i c k e t   +   "   s l " ) ; 
 	 	 	 	 	 	 	 O b j e c t D e l e t e ( 0 ,   " # "   +   ( s t r i n g ) t i c k e t   +   "   t p " ) ; 
 	 	 	 	 	 	 } 
 	 	 	 	 	 } 
 	 	 	 	 	 e l s e 
 	 	 	 	 	 { 
 	 	 	 	 	 	 i f   ( V I R T U A L _ S T O P S _ T I M E O U T   >   0 ) 
 	 	 	 	 	 	 { 
 	 	 	 	 	 	 	 i   =   A r r a y S e a r c h ( m e m _ t o _ t i ,   t i c k e t ) ; 
 
 	 	 	 	 	 	 	 i f   ( i   > =   0 ) 
 	 	 	 	 	 	 	 { 
 	 	 	 	 	 	 	 	 A r r a y S t r i p K e y ( m e m _ t o _ t i ,   i ) ; 
 	 	 	 	 	 	 	 	 A r r a y S t r i p K e y ( m e m _ t o ,   i ) ; 
 	 	 	 	 	 	 	 } 
 	 	 	 	 	 	 } 
 	 	 	 	 	 } 
 	 	 	 	 } 
 	 	 	 } 
 	 	 	 e l s e   i f   ( 
 	 	 	 	 	 ! P e n d i n g O r d e r S e l e c t B y T i c k e t ( t i c k e t ) 
 	 	 	 	 | |   O r d e r C l o s e T i m e ( )   >   0   / /   i n   c a s e   t h e   o r d e r   h a s   b e e n   c l o s e d 
 	 	 	 ) 
 	 	 	 { 
 	 	 	 	 O b j e c t D e l e t e ( 0 ,   n a m e ) ; 
 	 	 	 } 
 	 	 	 e l s e 
 	 	 	 { 
 	 	 	 	 P e n d i n g O r d e r S e l e c t B y T i c k e t ( t i c k e t ) ; 
 	 	 	 } 
 	 	 } 
 	 } 
 	 / /   G e t   S L   o r   T P 
 	 e l s e   i f   ( 
 	 	 t i   >   0 
 	 	 & &   ( 
 	 	 	       c o m m a n d   = =   " g e t   s l " 
 	 	 	 | |   c o m m a n d   = =   " g e t   t p " 
 	 	 ) 
 	 ) 
 	 { 
 	 	 d o u b l e   v a l u e   =   0 ; 
 
 	 	 n a m e   =   " # "   +   I n t e g e r T o S t r i n g ( t i )   +   "   "   +   S t r i n g S u b s t r ( c o m m a n d ,   4 ,   2 ) ; 
 
 	 	 i f   ( O b j e c t F i n d ( 0 ,   n a m e )   >   - 1 ) 
 	 	 { 
 	 	 	 v a l u e   =   O b j e c t G e t D o u b l e ( 0 ,   n a m e ,   O B J P R O P _ P R I C E ,   0 ) ; 
 	 	 } 
 
 	 	 r e t u r n   v a l u e ; 
 	 } 
 	 / /   S e t   S L   a n d   T P 
 	 e l s e   i f   ( 
 	 	 t i   >   0 
 	 	 & &   ( 
 	 	 	       c o m m a n d   = =   " s e t " 
 	 	 	 | |   c o m m a n d   = =   " m o d i f y " 
 	 	 	 | |   c o m m a n d   = =   " c l e a r " 
 	 	 	 | |   c o m m a n d   = =   " p a r t i a l " 
 	 	 ) 
 	 ) 
 	 { 
 	 	 l o o p _ p r i c e [ 0 ]   =   s l ; 
 	 	 l o o p _ p r i c e [ 1 ]   =   t p ; 
 
 	 	 f o r   ( i   =   0 ;   i   <   2 ;   i + + ) 
 	 	 { 
 	 	 	 n a m e   =   " # "   +   I n t e g e r T o S t r i n g ( t i )   +   "   "   +   l o o p _ n a m e [ i ] ; 
 	 	 	 
 	 	 	 i f   ( l o o p _ p r i c e [ i ]   >   0 ) 
 	 	 	 { 
 	 	 	 	 / /   1 )   c r e a t e   a   n e w   l i n e 
 	 	 	 	 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 _ H L I N E ,   0 ,   0 ,   l o o p _ p r i c e [ i ] ) ; 
 	 	 	 	 	 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 _ W I D T H ,   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 L O R ,   l o o p _ c o l o r [ i ] ) ; 
 	 	 	 	 	 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 _ S T Y L E ,   S T Y L E _ D O T ) ; 
 	 	 	 	 	 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 ,   n a m e   +   "   ( v i r t u a l ) " ) ; 
 	 	 	 	 } 
 	 	 	 	 / /   2 )   m o d i f y   e x i s t i n g   l i n e 
 	 	 	 	 e l s e 
 	 	 	 	 { 
 	 	 	 	 	 O b j e c t S e t D o u b l e ( 0 ,   n a m e ,   O B J P R O P _ P R I C E ,   0 ,   l o o p _ p r i c e [ i ] ) ; 
 	 	 	 	 } 
 	 	 	 } 
 	 	 	 e l s e 
 	 	 	 { 
 	 	 	 	 / /   3 )   d e l e t e   e x i s t i n g   l i n e 
 	 	 	 	 O b j e c t D e l e t e ( 0 ,   n a m e ) ; 
 	 	 	 } 
 	 	 } 
 
 	 	 / /   p r i n t   m e s s a g e 
 	 	 i f   ( c o m m a n d   = =   " s e t "   | |   c o m m a n d   = =   " m o d i f y " ) 
 	 	 { 
 	 	 	 P r i n t ( 
 	 	 	 	 c o m m a n d , 
 	 	 	 	 "   # " , 
 	 	 	 	 I n t e g e r T o S t r i n g ( t i ) , 
 	 	 	 	 " :   v i r t u a l   s l   " , 
 	 	 	 	 D o u b l e T o S t r ( s l ,   ( 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   " , 
 	 	 	 	 D o u b l e T o S t r ( t p , ( 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 ) ) 
 	 	 	 ) ; 
 	 	 } 
 
 	 	 r e t u r n   1 ; 
 	 } 
 
 	 r e t u r n   1 ; 
 }  
  
 d o u b l e   a s k ( s t r i n g   s y m b o l   =   N U L 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 S t o p L o s s ( ) 
 { 
 	 i f   ( U S E _ V I R T U A L _ S T O P S ) 
 	 { 
 	 	 r e t u r n   V i r t u a l S t o p s D r i v e r ( " g e t   s l " ,   O r d e r T i c k e t ( ) ) ; 
 	 } 
 
 	 r e t u r n   O r d e r S t o p L o s s ( ) ; 
 }  
  
 d o u b l e   a t t r T a k e P r o f i t ( ) 
 { 
 	 i f   ( U S E _ V I R T U A L _ S T O P S ) 
 	 { 
 	 	 r e t u r n   V i r t u a l S t o p s D r i v e r ( " g e t   t p " ,   O r d e r T i c k e t ( ) ) ; 
 	 } 
 
       r e t u r n   O r d e r T a k e P r o f i t ( ) ; 
 }  
  
 u l o n g   a t t r T i c k e t I n L o o p ( u l o n g   t i c k e t = 0 ) 
 { 
 	 s t a t i c   u l o n g   t ; 
 
 	 i f   ( t i c k e t   >   0 )   { t   =   t i c k e t ; } 
 
 	 r e t u r n   t ; 
 }  
  
 u l o n g   a t t r T i c k e t P a r e n t ( l o n g   t i c k e t ) 
 { 
 	 u l o n g   r e t v a l   =   0 ; 
 
 	 / / - -   c h e c k   i f   t r a d e   i s   a d d e d   t o   v o l u m 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 ) ) 
 	 { 
 	 	 s t r i n g   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 ) ; 
 	 	 i n t   p _ p o s             =   S t r i n g F i n d ( c o m m e n t ,   " [ p = " ) ; 
 	 	 
 	 	 i f   ( p _ p o s   > =   0 ) 
 	 	 { 
 	 	 	 s t r i n g   p _ t a g   =   S t r i n g S u b s t r ( c o m m e n t , p _ p o s ) ; 
 	 	 	 p _ t a g                 =   S t r i n g S u b s t r ( p _ t a g , 0 , S t r i n g F i n d ( p _ t a g , " ] " ) + 1 ) ; 
 	 	 	 r e t v a l               =   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 ( p _ t a g , 3 , - 1 ) ) ; 
 	 	 } 
 	 } 
 
 	 i f   ( r e t v a l   = =   0 ) 
 	 { 
 	 	 r e t v a l   =   ( u l o n g ) H i s t o r y D e a l G e t I n t e g e r ( t i c k e t ,   D E A L _ P O S I T I O N _ I D ) ; 
 	 } 
 
 	 i f   ( r e t v a l   = =   0 ) 
 	 { 
 	 	 r e t v a l   =   t i c k e t ; 
 	 } 
 
 	 r e t u r n   r e t v a l ; 
 }  
  
 i n t   a t t r T y p e I n L o o p ( i n t   t y p e = 0 ) 
 { 
 	 s t a t i c   i n t   t ; 
 
 	 i f   ( t y p e   >   0 )   { t   =   t y p e ; } 
 
 	 r e t u r n   t ; 
 }  
  
 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   f x d C u s t o m I n d i c a t o r ( i n t   h a n d l e ,   i n t   m o d e = 0 ,   i n t   s h i f t = 0 ) 
 { 
 	 s t a t i c   d o u b l e   b u f f e r [ 1 ] ; 
 
 	 i f   ( h a n d l e   <   0 ) 
 	 { 
 	 	 P r i n t ( " E r r o r :   I n d i c a t o r   n o t   h a n d l e d .   ( h a n d l e = " , h a n d l e , "   |   e r r o r   c o d e = " , G e t L a s t E r r o r ( ) , " ) " ) ; 
 	 	 r e t u r n   0 ; 
 	 } 
 
 	 i n t   t r y o u t s   =   0 ; 
 
 	 w h i l e   ( t r u e ) 
 	 { 
 	 	 i f   ( B a r s C a l c u l a t e d ( h a n d l e )   >   0 )   b r e a k ; 
 	 	 e l s e 
 	 	 { 
 	 	 	 t r y o u t s + + ; 
 
 	 	 	 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 ) ) 
 	 	 	 { 
 	 	 	 	 S l e e p ( 1 0 ) ; 
 	 	 	 } 
 	 	 	 e l s e 
 	 	 	 { 
 	 	 	 	 i f   ( t r y o u t s   >   1 0 0 ) 
 	 	 	 	 { 
 	 	 	 	 	 P r i n t ( " E r r o r :   C u s t o m   i n d i c a t o r   c o u l d   n o t   l o a d   ( h a n d l e = " , h a n d l e , "   |   e r r o r   c o d e = " , G e t L a s t E r r o r ( ) , " ) " ) ; 
 
 	 	 	 	 	 b r e a k ; 
 	 	 	 	 } 
 
 	 	 	 	 S l e e p ( 5 0 ) ; 
 	 	 	 } 
 	 	 } 
 	 } 
 
 	 i n t   s u c c e s s   =   C o p y B u f f e r ( h a n d l e , m o d e , s h i f t , 1 , b u f f e r ) ; 
 
 	 i f   ( s u c c e s s   <   0 ) 
 	 { 
 	 	 P r i n t ( " E r r o r :   C a n n o t   g e t   v a l u e   f r o m   a   c u s t o m   i n d i c a t o r .   ( h a n d l e = " , h a n d l e , "   |   e r r o r   c o d e = " , G e t L a s t E r r o r ( ) , " ) " ) ; 
 	 	 r e t u r n   0 ; 
 	 } 
 
 	 / / A r r a y S e t A s S e r i e s ( b u f f e r , t r u e ) ; 
 
 	 r e t u r n   b u f f e r [ 0 ] ; 
 }  
  
 v o i d   f x d G e t I n b o u n d B l o c k s ( i n t   b l o c k _ i d ,   i n t   & l i s t [ ] ) 
 { 
 	 i f   ( b l o c k _ i d   >   - 1   & &   A r r a y S i z e ( _ b l o c k s _ )   >   b l o c k _ i d )   { 
 	 	 A r r a y C o p y ( l i s t ,   _ b l o c k s _ [ b l o c k _ i d ] . _ _ i n b o u n d _ b l o c k s ) ; 
 	 } 
 } 
 
 v o i d   f x d G e t I n b o u n d B l o c k s ( s t r i n g   b l o c k _ s t r i n g _ i d ,   i n t   & l i s t [ ] ) 
 { 
 	 / /   f i r s t   w e   n e e d   t o   g e t   t h e   n u m e r i c   i d   o f   t h e   b l o c k 
 	 i n t   b l o c k _ i d   =   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 ,   b l o c k _ s t r i n g _ i d ) ; 
 
 	 i f   ( b l o c k _ i d   >   - 1   & &   A r r a y S i z e ( _ b l o c k s _ )   >   b l o c k _ i d )   { 
 	 	 A r r a y C o p y ( l i s t ,   _ b l o c k s _ [ b l o c k _ i d ] . _ _ i n b o u n d _ b l o c k s ) ; 
 	 } 
 }  
  
 d o u b l e   i A C (   
 	 s t r i n g                           s y m b o l , 
 	 E N U M _ T I M E F R A M E S         t i m e f r a m e , 
 	 i n t                                 s h i f t 
 ) 
 { 
 	 i n t   h a n d l e   =   i A C ( s y m b o l ,   t i m e f r a m e ) ; 
 	 d o u b l e   v a l   =   f x d C u s t o m I n d i c a t o r ( h a n d l e ,   0 ,   s h i f t ) ; 
 
 	 r e t u r n   N o r m a l i z e D o u b l e ( v a l ,   7 ) ; 
 }  
  
 d o u b l e   i A T R (   
 	 s t r i n g                           s y m b o l , 
 	 E N U M _ T I M E F R A M E S         t i m e f r a m e , 
 	 i n t                                 m a _ p e r i o d , 
 	 i n t                                 s h i f t 
 ) 
 { 
 	 i n t   h a n d l e   =   i A T R ( s y m b o l ,   t i m e f r a m e ,   m a _ p e r i o d ) ; 
 	 d o u b l e   v a l   =   f x d C u s t o m I n d i c a t o r ( h a n d l e ,   0 ,   s h i f t ) ; 
 
 	 r e t u r n   N o r m a l i z e D o u b l e ( v a l ,   ( 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 n t   i C a n d l e I D ( s t r i n g   S Y M B O L ,   E N U M _ T I M E F R A M E S   T I M E F R A M E ,   d a t e t i m e   t i m e _ s t a m p ) 
 { 
       b o o l   T i m e S t a m p P r e v D a y S h i f t   =   t r u e ; 
       i n t   C a n d l e I D   =   0 ; 
       / / = =   c a l c u l a t e   c a n d l e   I D 
       / / - -   g e t   t h e   t i m e   r e s o l u t i o n   o f   t h e   d e s i r e d   p e r i o d ,   i n   m i n u t e s 
       i n t   m i n s _ t f   =   T I M E F R A M E ; 
       i n t   m i n s _ t f 0   =   0 ; 
       i f   ( T I M E F R A M E   = =   P E R I O D _ C U R R E N T ) 
       { 
             m i n s _ t f   =   ( i n t ) P e r i o d S e c o n d s ( P E R I O D _ C U R R E N T )   /   6 0 ; 
       } 
       
       / / - -   g e t   t h e   d i f f e r e n c e   b e t w e e n   n o w   a n d   t h e   t i m e   w e   w a n t ,   i n   m i n u t e s 
       / / i n t   t i m e _ s t a m p   =   S t r T o T i m e ( T i m e S t a m p ) ; 
       i n t   d a y s _ a d j u s t   =   0 ; 
       i f   ( T i m e S t a m p P r e v D a y S h i f t ) 
       { 
             / / - -   a u t o m a t i c a l l y   s h i f t   t o   t h e   p r e v i o u s   d a y 
             i f   ( t i m e _ s t a m p   >   T i m e C u r r e n t ( ) ) 
             { 
                   t i m e _ s t a m p   =   t i m e _ s t a m p   -   8 6 4 0 0 ; 
             } 
             / / - -   a l s o   s h i f t   w e e k d a y s 
             w h i l e   ( t r u e ) 
             { 
                   i n t   d o w   =   T i m e D a y O f W e e k ( t i m e _ s t a m p ) ; 
                   
                   i f   ( d o w   >   0   & &   d o w   <   6 )   { b r e a k ; } 
                   t i m e _ s t a m p   =   t i m e _ s t a m p   -   8 6 4 0 0 ; 
                   d a y s _ a d j u s t + + ; 
             } 
       } 
       
       i n t   m i n s _ d i f f   =   ( i n t ) ( T i m e C u r r e n t ( )   -   t i m e _ s t a m p ) ; 
       m i n s _ d i f f   =   m i n s _ d i f f   -   d a y s _ a d j u s t * 8 6 4 0 0 ; 
       m i n s _ d i f f   =   m i n s _ d i f f   /   6 0 ; 
       
       / / - -   t h e   d i f f e r e n c e   i s   n e g a t i v e   = >   q u i t   h e r e 
       i f   ( m i n s _ d i f f   <   0 )   { r e t u r n   ( i n t ) E M P T Y _ V A L U E ; } 
       
       / / - -   n o w   c a l c u l a t e   t h e   c a n d l e   I D ,   i t   i s   r e l a t i v e   t o   t h e   c u r r e n t   t i m e 
       i f   ( m i n s _ d i f f   >   0 )   { 
             C a n d l e I D   =   ( i n t ) M a t h C e i l ( ( d o u b l e ) m i n s _ d i f f / ( d o u b l e ) m i n s _ t f ) ; 
       } 
       / / P r i n t ( T i m e T o S t r ( T i m e C u r r e n t ( ) ) + "   " + T i m e T o S t r ( t i m e _ s t a m p )   + "   : : :   "   +   m i n s _ t f   +   "   "   +   d a y s _ a d j u s t   +   "   "   +   ( d a y s _ a d j u s t * 1 4 4 0 / m i n s _ t f )   +   "   "   +   C a n d l e I D ) ; 
       
       
       / / - -   n o w ,   a f t e r   a l l   t h e   s h i f t i n g   a n d   i n   c a s e   o f   m i s s i n g   c a n d l e s ,   t h e   c a l c u l a t e d   c a n d l e   i d   c a n   b e   f e w   c a n d l e s   e a r l y 
       / /   s o   w e   w i l l   s e a r c h   f o r   t h e   r i g h t   c a n d l e 
       w h i l e ( t r u e ) 
       { 
             i f   ( i T i m e ( S Y M B O L ,   T I M E F R A M E ,   C a n d l e I D )   > =   t i m e _ s t a m p )   { b r e a k ; } 
             
             C a n d l e I D - - ; 
 	 	 
 	 	 i f   ( C a n d l e I D   < =   0 )   { C a n d l e I D   =   0 ;   b r e a k ; } 
       } 
       
       r e t u r n   C a n d l e I D ; 
 }  
  
 d o u b l e   i M A (   
 	 s t r i n g                           s y m b o l , 
 	 E N U M _ T I M E F R A M E S         t i m e f r a m e , 
 	 i n t                                 m a _ p e r i o d , 
 	 i n t                                 m a _ s h i f t , 
 	 E N U M _ M A _ M E T H O D           m a _ m e t h o d , 
 	 E N U M _ A P P L I E D _ P R I C E   a p p l i e d _ p r i c e , 
 	 i n t                                 s h i f t 
 ) 
 { 
 	 i n t   h a n d l e   =   i M A ( s y m b o l ,   t i m e f r a m e ,   m a _ p e r i o d ,   m a _ s h i f t ,   m a _ m e t h o d ,   a p p l i e d _ p r i c e ) ; 
 	 d o u b l e   v a l   =   f x d C u s t o m I n d i c a t o r ( h a n d l e ,   0 ,   s h i f t ) ; 
 
 	 r e t u r n   N o r m a l i z e D o u b l e ( v a l ,   ( 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   i S A R (   
 	 s t r i n g                           s y m b o l , 
 	 E N U M _ T I M E F R A M E S         t i m e f r a m e , 
 	 d o u b l e                           s t e p , 
 	 d o u b l e                           m a x i m u m , 
 	 i n t                                 s h i f t 
 ) 
 { 
 	 i n t   h a n d l e   =   i S A R ( s y m b o l ,   t i m e f r a m e ,   s t e p ,   m a x i m u m ) ; 
 	 d o u b l e   v a l   =   f x d C u s t o m I n d i c a t o r ( h a n d l e ,   0 ,   s h i f t ) ; 
 
 	 r e t u r n   N o r m a l i z e D o u b l e ( v a l ,   ( 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 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   =   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 ) ; 
 	 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 ) ; 
 
 	 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 )   *   p o i n t ,   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   =   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 ) ) ; 
 }  
  
  
  
  
  
  
 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 ] ;  
 	 	 	 	 _ b l o c k s _ [ b l o c k _ t o _ r u n ] . r u n ( ) ;  
 	 	 	 }  
  
 	 	 	 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 P e 1 y 4 z a S r 8 J y q r Y 2 V z M J v 0 V q U q n y Z + J a e + y 1 n e T 2 l 4 q W I J l n i u S S 1 N j e 1 L z P v c e 9 2 H X j g w Q p U p Y U W i N Z T N X u y A T Q a D S 6 G 9 2 N B u D 1 3 f 6 f a V / T + g f D K A z J M P O j M D 3 4 5 P U t o / + n 3 1 f h l 4 E 1 r P 7 B 2 C f B 6 O B T 2 u / 1 D 0 5 O z w 5 / u 7 j D v + z + Q R r N k i H B P / T + g W b w r 5 m X T E j G v + r m w a e v f l 9 b H R 6 2 n I e n a R S e 3 h o 8 n c I z V o d n 2 r X w b A r P X A N e r x Z e j 8 K z V o f n 1 M 6 H p V J 4 9 u r w X K 0 O n s P m o 7 c i P O A 7 t w 6 c y 9 j F W Y P 9 1 F p 4 F o X n r j F c q w 6 e y a Z X W 0 M + 3 F r + M 9 n 8 a q s K i A E M j b w 7 D 9 F m Q 9 b 0 1 q a Y i Y h m r I G i O Y 8 i x Z z j a L Y i x q I j h G i t Q 0 e r H q T B Q K 4 h K 5 q 2 E G J v H U r W i r P G x F l z 1 o D Y a 0 C S a + w 1 Z E a r n + 0 e m x t d b W 2 2 e 3 w V W E d q T H M h k v o 6 l J w f N 1 N w C H A d s X H U e h y Z 2 O j m O j j W M z n X 3 7 r V I k i O p b 3 O w O t 5 0 m F a U l 9 H c B x r I c h 1 J M f p 1 U 8 P k x z d X Q e k X Y 8 l Y y J D X Q e k v h D k O r L j 1 t P S Z V r I W E d 2 H L c e S 4 e B X E d 6 3 H r p 4 e u Y Y b Y I k p k D x h r S Y 6 i 1 0 2 O o T C A N e x 2 Q R j 1 I J p B G b x 2 Q 5 k K Q z j o g G 5 i I z / g 6 6 0 6 t K a 4 z H E 2 1 L Y B c c k y t L Y A G U x i m 3 g p A S k S O 4 h r + j N a r W 8 S 4 O 2 O 2 A g 9 N T K Y q T K s V g J S d O E S 7 L R Q N z j d r + D R a P Y a c i G s J S 7 2 X y Q x J c w 1 Z s e r 9 J A b Q U l s D y J S t t Y a s 2 L W e l 8 M x 1 N s C i M 7 O 1 6 / 0 + 3 0 Q D R 9 Z 9 M P G 6 A c i r W v Y i U P j I 1 k S B a w Y v 7 n 9 g 1 + S a B Z f R i P a A y A y w b / 5 7 1 / E b 7 V / Q N k C / r 1 9 m d 5 H g W i A + N E P / I / b / A / R B F j p a P a S X i W 3 J M C e 0 7 4 J W E b Z A 6 B M E U C k P D 8 k C S + 7 8 4 e P + B P w H f m p d x 8 Q o M t 9 X 2 W 0 I c 8 Z S V h 4 R + 3 / + Z U O 3 x / J P A s g / X Q w n K V Z N B U N H U E Y R j K K d Z q R K e 9 n C q M J B h w M o P A 5 u o p J S E Z X y Y g k F G c N u o 6 9 x J s S 6 B 6 g R 1 E y S q V h A s T Y D 8 M C V a B e O v Q C Q a Q w S q Z e I G i Y E o S V R Y k 0 D s Q p 8 7 I Z / a R z r o j C a D w + + O R T k I D Y y M u 8 v N e v t E r m Z 6 w X p P T n S I m j 1 M c I G O 8 Y 2 t N B c 5 g A I y D j D E H q m s o E M 4 t i / N t W E S J U e P L 8 T A w D i P n F S 3 y c B Q l X I E Y 0 y + J Z l s q A f f i G 7 T S G K + F / U r D Q z T C l t S n D a 8 i p 3 v A R m S 0 c f R x G Q Z R w 5 v / u 0 D 1 2 z 8 4 4 B + Y l M L j v x C j H w D E f n 4 g / e c h k Y u D M C Q 4 f A J 8 k X o G x p i P T 4 X R + T L M X R j D W j g W Q 6 k V E C G c u B 5 J e n O d 0 + P f 3 K J h N i S R N Y / + Z j M q l t / 5 / h E p U f 9 A E y x V l N 3 7 6 W N J H R V N R h M v j D 1 Q T a I Y o u y a g J c I s h 0 x N M s 0 R x U f I / l I d G I k h 6 D m S E e P z W Y i V h i w Q z M i A / j + X G J l M g l l / F + X S y A D 1 4 6 u b m 9 P j u / O r z w X R v z L U z p A 6 N x 6 w 6 2 + h n w n C m N h c Z e 0 t u d I J C R j 7 o 0 W k i v L p 9 H J y D s 1 9 L 7 i I s r S C g M M q X M 6 C z I + D l 6 v w I k p T T g B K I l 2 t 1 r h O o r G f y d O N 0 o 9 1 D k c j 7 K I E h O H h V i q U Y J R Q v S E g j z U Q e q X i J h w 0 Q 7 e b B 2 u I K j f k C 6 i p n A m 9 g P 1 m M M 7 8 + 6 g R h q 5 j l R P Q X N N 7 k m S v E D a v 1 9 C h T j G 6 8 O 6 j 2 f C B J K Q Z n F 2 u e O G n m e A + 7 Y P + w f h g f r A + 2 A W t i 6 p N Y 6 V d 3 5 J / H 3 k p q e l Q 4 8 X F V E B r A 7 q y S 6 1 r p 0 L n h U 1 d 2 0 L q f o t j k l z 4 U z + T F Q U 0 v w W l i / 0 K V Q F j i p l w 3 l 1 X 6 1 z 7 c V p S C M i y e S F r d Z 3 4 w 0 J 4 L E v M d q U a A w 5 j 0 w r V M g p E p V a E P y f S A t H H X u N W e 8 U h q e o y / Y 5 a 7 V f W V Q s 6 R r P G e y S M l c S c I 4 + N X k J v 6 g 9 P / I n P O L R c V U x 9 M T y U T 6 l 8 w e y 7 N R V v L y r E 0 n H + i 2 o b 4 w D s N 2 7 u 1 + v T 9 Z g K 2 o s f j v w h t 5 b Y u A 7 v b h T a  
 n X I u y q g F U M X M o U C g 1 / M w P v H T O P B e O J U E Y Q H v E 5 I O t Y p 4 Q n 3 o A 4 j m R y P h p 5 h C i 7 P C O 3 9 K x m g Q i l m 7 P r 0 5 v z o Z H P 8 G I / 5 8 J y Y Y K v O V x S e J T B 3 e s y 7 3 z O r f g e 1 y H C X c I s Y J u D n / 5 d e 7 w W / X 0 I U g L N S 7 o q b d f w t X T 5 0 r + l e 5 S J e g c 6 s K F N U w S G 6 4 i W L l F c 6 A i m I 5 z j e k U K 3 l 9 D 6 a j c f C N u Z L W J 1 R B N 8 K K j Z Q C a q i S F x R i 5 L 3 y J g P W R j I f J t 5 U + G S q G q f s S 6 U / e 6 n P h i m 5 y e l h V T P C 2 4 f / H H W U J Y r Z U k Y A N k b L 5 y Q Y y 8 c B d h r U m 5 t l s p P w 1 G Z P B Y v p i j n T h v a 9 S T 5 w i f T l O u I D n B Y W r + Q y L w G 7 w L L H V E u I J x 4 L 1 f c t p d Q V H m p r B i n 3 j O H k h N E M l k X S e h o o W Y A g I V o D n y Q i R r t I N x M K I 3 n x W l N l l l t K L A M n j 7 n L i 4 Q 5 J e 7 Y + 5 s w H e g o + z I O f T j r z B 9 a V W X I R A / n G V E r o 9 O G R T U k E c V i j P z p 7 V 6 U 7 g c i N k d r y N P Z J m P R M k i m c B J w 0 L G o L l c a D L E S y 9 5 J C X K u X K j s l q T j F N a J Z r G U Q j r y L + I l 8 g g n E r 5 J Y z z Q a 5 g V y q c M E 0 s i q v w k f 6 l j b g c y b w H O h N V G 7 x U 5 Z Y A u U e l K k Z B b V k 5 6 P n K K w p w g P I 0 I 7 P n h X R 0 p V K 5 6 R + E P K Y V r Z 4 X C m 7 L Z 0 V u m X N d h W q s 0 z n W K x W z w d Y W P / o x 4 j T i X U O P W Y L K 4 S t b M W 8 D P 4 6 9 i a C l y Z n s 8 g U I O e X e o j S U w y S J n u g C c j R 7 4 W I E a 8 g R 1 T e t R 3 T s F i I 6 N o 1 A f Y 6 e 3 j q Q Y 7 G A m 5 h d T O 0 p f h v S b z P n S U y H E b / b C A L 1 6 F i V k A 1 2 Y f z H s C r x H 9 1 q K Q C k l g N A 2 o o B I F V 1 V K b P 5 A A Q l o z p f w 1 h I B p W x B j q X w g F u U 2 h o B 5 f x i R 7 c 2 m L F e X / / L z W Q D V y s H H J 2 O T R D U 0 q u T w s W X O s 0 S X J H l g j X E e u T k 4 H t 6 y e s F N j t D t H u X + A E K 9 v z o 9 P B 8 c X V 7 e n k t F 5 B R Y K e N S c l h i k l l H A 0 j Q K K u h 1 9 u D + 2 I P A X z d + K o c 2 c 3 + Q e i h Q x s i Q y u s I k v D 0 e U h i j E i X y z X O t d h S i n B o Y j L x + 5 x L C f W v v T S 9 e 4 m F u 4 v i 9 A b r j t v G T o I h y Q c O 5 6 3 X H 6 2 8 / r S x n j h U d y k J x 3 7 h g m K q 5 Q X F 1 K z t 2 F E 4 O z s x b X 2 D O w o 0 p 7 J b R 7 p 1 p F t H a t a R M y 8 I m t Y R L F t v H c G W d e s I f v 9 G 6 4 i M R m s L C Y 5 n d x e S M c d + 4 U K i a d 1 C c l D k 0 t c u J C Z f M y 6 i J S J z T J d X I L g i M n d 5 W I 7 M 5 f r i z E s z u T C P l O D m V B A 9 V R q y B c W h E N M 6 F b n E K r K p g O A w m g L D i / j 2 8 0 / 8 x 8 1 m q W m 9 B 2 p i 0 T C J 0 v T J H 7 G g X 6 4 1 6 t l e y 4 9 r Y a v B f L O W V X A b W U H Q / D g C J h C Z N b u Q D 2 T i l n S a / S 3 I P j 0 r a b B E S E i z y 4 p X t 7 d H 8 R 4 f u u s o 3 k X K V e + U 6 y a U 6 8 + d c n 2 / y l X f U + V q c O U 6 A e W 6 l G 7 V 3 b 3 S r U a T b t U o + j Q 3 i b q v V 8 l F B H M n N k B L b q 2 L C U z g z I r t Q E B Q E w 4 r 7 t 6 G I 6 l E 1 / u F v 8 2 2 w + i G G s 1 8 n E v R s k S d a g e q L c A Y o k q 5 H y 3 v B / c E H / x k U T c m r z I 3 D F 3 e s s U a l U 4 c a T B n 8 D 1 7 W D w Y V q e R W j g Y V q X c D w 9 7 t K 8 X j D b 8 X u A 9 O u o z P 8 h 4 o O M N V Y P R s H 2 n S t t 3 L W 3 T 4 a z T k S n j f G g r J W t r 5 p Z k a 9 + r R G f H 8 9 / Y J X Z w 2 9 r 3 w g n + K c 4 y 1 2 o Y W 2 R 9 3 f q T E D R L E e S J w q G A V U m R y I O U l 3 5 4 F I 1 e R P J T b k d g k f c s F x U c t 7 o Z 0 L 6 8 t b F R T h U n p d k R 8 R J G o R 0 6 / I B I K 8 M c 6 8 W e j m q V 5 M n a h t X Y x N X 4 W N 1 k f K n X C Z E k R L 1 2 h W g m Y t m 7 J E S A 9 L J C Z F R M 2 j 0 V I n q H Q b 2 t S x E 1 q E B g 8 t Z 1 1 X l t n Y V 1 s 6 U j c F c g 5 Y C u l H W 2 I y E v R F w B Z 1 / R 1 K n / + i k 4 z S 0 v B J p j 7 Z l h l b O x 9 Q 7 P w Y k t 2 O 4 c X H c O r j s H 1 5 2 D 6 8 7 B 7 f Q 5 u G L q 9 + I Y 3 B u y Q H e 8 p z v e 0 x 3 v 6 Y 7 3 Z J V x  
 F s d 7 8 L 6 W y h n R 9 t 1 V q w V 3 l W 4 l B c F + H P B x 2 G C X O u F j b + k B n / F Y / V Y H f A x z J S d X 7 5 z c z s n t n N z O y W 3 V y a 1 3 e D p P 9 x t 4 u l v u 5 E D L / 9 J Q + T d 7 z y a a L C F Z e H e M r n Z O c + c 0 d 0 5 z 5 z R 3 T v P u O 8 2 G 2 T n N b + c 0 a 7 b V e c 1 V r 9 l 6 h 1 5 z d 0 V q 5 z V 3 X n P n N X d e c + c 1 d 1 5 z d + N q d + N q d z N K d + N q F 1 3 q o k t d d G l f b 1 z l T 0 Z 1 V 6 6 + z Z W r Z n f l 6 l x s y b T X u o U D B h e j D Z 4 O 2 D 8 1 6 t 7 k k 5 n b 6 t D m i K l o m 4 l I 2 Y 5 p i l g t d d E F A F l 0 i Z B u 5 / h e R E 8 k z c 6 S a H o X S V e Z 1 Z 2 / c / j 5 9 y M v q Z y 6 A D u F f 5 Q v G f v j w c v u o l 9 I 9 t o Z j S W N x L Y u p W B c 0 K 6 e M u 0 9 v X k C F U F M Q r z W R w m 8 N F O W O e Z U O e V k a e / 5 8 g m z t 0 m V c n j 7 j z d T K Y u u z t F 7 O b 6 / A n U 6 n d K C T u n t u U 6 Z 5 D q F e b C L j / / 2 9 k m p W O r i U 7 6 4 D R w E 0 d N V I D 0 b W V j + b b O q p b Z 0 w c p F F M X 8 s O 8 O X i u K u y e R O P E r n r 7 8 k U 7 h 6 + n R l f x o Q 9 8 S / h 2 P n S G z u T f 1 A q a 1 P S f Y b a s 7 w b 7 S C X b b q V w N Z K l 7 e o L d a b w t 1 1 B X e e 0 4 j 0 + 1 + 9 w x i y Q m n h + g T S W b U 3 S L C Q v 8 c H J D x i Q h y L v 5 3 Y M i l m Y X t X B z b u H G K H S V Y S V p U 9 T M 4 5 w Z a x 6 S l 3 I 8 3 R B F b P 8 k v x R E V 3 + 0 P i i G + q O W R 8 Q Z 8 O p u a X E Q Q S 4 v t o f l N 7 b H t M r r U e 7 b w 5 s m W 9 Z E W 5 b E R U a E z n n v 0 n v 2 p 7 N p O d N j I 6 F v B w c m p m G 3 N 0 5 L 7 E b i u p Q d x m U k n t t 6 5 y x C c h a 5 L X N a T 4 Y N 3 k j d v i x j V C i c u 9 Y d 6 c i L Z P A S B 1 Y r s G 3 Y B Q C u S + U 9 x p 5 0 t 6 i F / d k l N n + s v M e z x B s y 3 6 G F n i 0 q F s s d z O b z c X c 9 n Z 8 M I A j Q K C 4 m Q s + 3 P / B 7 Z R b 4 z j l e Q E w p u x k S w q 8 L 8 o U E + V 4 r v Q Y 1 S E 4 I M m j 4 + A b G i t P K i / N G W a / r b 2 2 r 2 M t d d J g H z b V y 0 B x f T G / T h s d p E u N X m K A u N H i c S o a m Y a h v E 0 V f 1 e A x b U e / N 1 e O o k u z 9 V e M H 3 3 H j B 8 Y y 8 f O + u m s n 8 7 6 6 a y f z v r Z S e t H 7 6 y f d q 0 f J o i L d / I 6 6 6 f O + m m 8 b 9 4 S a a 2 o R w + f v J f 5 q 8 a 4 e p T q N J s h T l G p d L W t V X y v X M 5 g i 4 3 q c d F w E z m / 7 Y u 7 0 V J k F r c c B C 3 4 N W 8 7 t u t A 8 Y l T x Y M R K O M k m i q Z 9 0 g + x r m p t z h i W 0 k D 0 n v q n m 4 8 O M 1 X 5 9 p b 4 b Q g 8 n Q 7 r y Y Z E D N / S e B l / h d y F 3 H R w F 3 U O N c Z a A K I K l y T 1 B n F 7 L p l Y P v G n f s e Z 1 L / 6 t e L Y z 4 S / z i I i s M 0 O F 6 2 8 3 8 G N v b R S y m r u + G q 7 k W J r W + w w w / d f i Z P t x e F i V U 6 / c e L 8 1 M n z E O 0 h E s l l U k K t j C 5 4 d e 4 1 H 6 O 0 m b F / T h u S v D Y z M s + B h 2 T n O + d N 8 O D S 6 W y 2 h G b b M Q t n y U p n a n c J m O z l Z u t d S o p / v j l C g S V M 9 6 G b E 1 1 C V t T T k / V J F u z p V R V N H G O E u I 9 K j B 5 o R K N / x b e p / E n 5 T v 9 9 a B b r / I m p 2 l 1 Z m f f c Z v W L 5 1 / O w u 8 y W c v f 9 v o 8 g U / i K d p 4 a d 8 g + o b p Y o 4 b T x m z o d y S 7 K j H d l K p 6 c / S a Y w k i s f M b m J U X i 1 X E n b 3 R J O d x z X 7 f U 2 a J 2 5 6 g 5 w t 6 v u J X f j 2 Z u C u 5 d n b q O S L b L H 3 K 3 t A n e 3 s s G o M n y P H 8 j w c W f U N / A O R b i k w P M L B B Y b K 9 W 3 F r U t c b A 3 z + R 6 a 0 x e X N / Q P p f r n Y U y W Y G / b a d s o p j a 3 i p x o w s g 7 X E A q Z f H 8 B t C S N J x 6 f o A E t 0 1 t d 5 P B K l 0 + U 1 T D A k 3 K f c y i O Q a O x 5 E 0 r Y g i G S J 4 S t A w D h V o n F + 8 i J d Y u + j s n T 1 u u 1 L W M Y a 9 0 F 6 f B W T r t 1 Z / u I e G M n 9 D N a k e 7 x b I Y 6 e S P 2 l P W r e R 1 w 6 3 5 E n K + H r n 5 e H X B Q u r 0 5 O B 6 f s T 5 e V F b u k Q K D r m / P j 0 8 H x x d X t a X e H z Z 7 d Y Q P s c e O n R M p n E k k z 9 F I l K J J O p 4 q r L 5 C C p 8 9 D E q M G K Z d r n O e w 5 V w e l M u + z + 2 I 4 x a 9  
 l 6 b S k 7 X I 7 W + x m p g t 5 b / k 8 o H j 2 c H 9 c B j S 0 d G 1 k v j p M o / G V h Y A e 3 t O j Z q 2 v k n f x e q U f q f 0 3 4 X S P / O C o E H p Y 9 F 6 S h 9 b 1 i l 9 / P 4 N l b 7 V t t L H 8 e y u 0 h 9 7 + Y 3 n C y 7 V 1 i q 7 x 7 a 6 p 0 p f 1 / S F m Y r f O G D V r r h g n E H T W 8 o a P B 8 z d 7 u 4 X e E t B c Z Y 7 m K x t j K A z w s f + n U X u v p k u b o l w n T o H r t n Z x s V J m u t m 3 4 q c b z c y p E B O O K u y M O 4 e u c B O 2 R z m F Z t B l o b m P E h G t W Y T T i Q w x h v p R 0 t M p 0 2 d U H n 8 n e X z Z 3 b q a W X K 8 7 t 1 B I M B 3 / m p Z l c m K s w v M M 7 i J 4 q D Q 1 B 0 8 M a U m 8 T M b / 9 1 U V U z 1 p 7 e n e R i T w G M k Y v R B t 7 6 e v 5 1 0 Y 1 / f o 9 3 1 u k m / p a O r I T + p 3 Q o F a n Q d v S o K a + v x o U 9 S Y q 0 G c l D Z a 5 y L a i Q Y 3 3 r U E b k w z e h g + N d v j w I p q A x g m u b n Y l H a Z / w H B d K Z R g G F u S + z I e k / v R / S a 9 H 9 P s v J 9 W 1 u 6 f O + 9 n 1 9 d u c 9 + 9 n 8 m y 3 g 8 m C 5 Y W b 0 d 9 z 4 t 3 T + v c n / e r Q j v 3 p z U V 2 t P 2 V I U a 3 P 0 B D f q 8 p P d j 7 Z P 7 0 9 M 3 6 v 7 0 9 M 7 9 W T 5 9 x j D 3 1 v 3 p N b o / z i o 7 q Z J + / u s b q c g 2 4 v e C 1 P + G R 6 A Q h + K 1 p w 2 k R F N 5 M 1 u 6 S Z 4 e J 9 h M S r S 1 x L n 6 N 3 7 2 i a 7 n O G J F e v N 9 Q d h C r 6 Z A 6 F 3 i M 9 t 7 2 Y 6 r 5 6 k o d H f P r 3 b 3 v K Z V T l p q 2 5 L N u f H L 5 9 G N b i O x 5 4 2 W o / a F x V G 7 x J 5 X X w Y 8 H y + 7 P K g V Q d L 2 N q n H W S N i 0 y V E d w n R W 5 M Q v V p w b K 1 r b T + q P 7 x + r e 1 W h J W c f Q 0 r 6 T Q / G q N K + W S 9 Y k t V T v X r 5 r s O K z l 6 p + Y 7 N f + e 1 P x P 7 a p 5 d q n / j m j 5 f c 2 d 0 p i W D 7 J P y y n 5 6 h P g 7 1 3 J v 8 k Z R 7 w y / v y 8 V r 0 b D e q d 3 9 i v S S V M q + c b h a z R 5 V w C y y 1 P Y L F o + R J 7 h u x w V 3 w F C u 0 + m n F q 4 T 2 M M g p Y m t K 3 0 2 X 0 u u V j b 8 / K W 3 x 9 a D 4 s r 7 d 8 W N 7 Y 3 L l J u k R Y 3 W l 5 s e 6 D 9 l r u t L y m 9 7 b X K d j w y U n H 7 t a S b i 3 p 1 p L X j + B X 1 5 L 5 M / h 6 y 2 f w N 7 2 W 2 N 0 h f H k t W e 4 Q v m G r 3 V r C 1 5 L e R n O a n F 5 L 1 / j y p K b D z y c 7 4 i D D 6 D m y r 9 g 5 e u V Y h 2 Z t y 5 s 4 m 8 5 r c p z t y 2 v C C y L g y w 6 l N T l O l 9 a 0 h r y 6 I q s J G G C J F a V 6 m V e X 1 E Q l 2 N 3 s 6 u J 2 q 8 s r U d d K x v Y e r y 7 N j 3 p 8 g 4 Q 7 V + 0 S 7 l Z L u K u + 3 7 H H C X f N 9 y d a 3 9 5 O e g N Z s b p 8 u 8 X y Z N N 8 u 6 U M l + q C s M f p d q 6 z y h M h L n 2 t e E Q 2 / U o I l Y A 2 T P o d f C b E Z M + E 5 H T / u M J T I b 3 K / k H P 0 f f 0 q R D d d d t k 9 D d 6 8 4 n y + Z 4 + 2 G f U 8 v l S z 5 p V u N y 2 1 T 3 l c k N V d 4 P L D V X d Y y 5 P 1 u L y a g D f t q 2 9 Z X N t k 1 b L e c i 2 H 9 f i c 2 0 / + V y X a K 7 8 H f n 7 I 6 X x 9 0 u 8 E V O 2 z a 3 9 V e a r H 7 3 / S 6 z a R h a n y X a B d 4 R N J W w X e 4 w V h 3 F b N O + Q / r d R n m y 8 D W 9 j L + 4 B f S 6 8 N K M B D J F t I G e N 8 G g g V T 9 v 7 J Q C O d o I y z j 8 s d P 5 Y X 3 j 0 E x b j 4 b l r 7 k e z V 6 U v w c w T G W I + 0 y j J Z a D y r k Y u z U X d t d i N Y Z q b q v s a d 9 E 9 s x O 9 p a L H z H Z w z D 1 i s L n 2 J 3 w C e G z N r m r a 6 h W d w / S A r 7 U e u W 4 p q H u 6 T 1 I h m r v S A A f M N 3 b 1 + z F I l P E f R Q W + F G W i + N r P a f E 7 6 6 7 l y / a s 1 x n o F H m h x M 2 n p 5 A 0 R v i M 9 m D J o Z F o H E S / Q 8 Z Z o O Q C w P i 9 + h N v Y 9 Q 8 M X T q t U y b g j Y y N g x 4 Q n m S B 3 g x 0 H g h Z M Z T 3 W D f i 7 / e W E J m M A K g E h C 4 B 8 W w X B V W D g 1 w + n p m l x l S t / R b a o y 9 U B z D 1 K R e A 5 9 G K 5 B + 9 D x N C l L j R 8 E / n 3 i J S + D 3 N I r C Y / m F j W p h D X V Q 9 b y p y Q Z p A Q o O B I Z 3 3 Z + 0 C C O / D A b J D P O W 9 S A U S W G G i c o z q O + + o O q a q x x F v E P G i o q r a H y f H W V N d A b G 9 S 3 + M p U w S w l g y 9 + k s 2 8 Y E B f K O Z D C a O C d F L p A I d N u Z 9 J M l I M Q R A g  
 x o S E w 5 c a I F i n U j 5 I S F D y Q 2 u q e K N R q Q r 8 I F 9 I m K W D a f F 4 X i b 4 1 c 1 L h y 9 D m D 5 x u S m 3 G 7 E 4 R F E f p D F w 2 m h A 1 V / J H D e K K l x 7 F Y U Y n 8 s I T D / M + E P 0 N K i c p h c g e u h C e P H D I E p 8 w M X L z + Z C j b s o v o u O o o z q c W Z I C 8 k B c f G T v D L X w 3 Q 1 i V + S k i r g 0 k D S Y e L H l Q a o / 2 h 6 a P 4 F 0 M H D L n K 1 f J m C M Y Z Z 2 R 4 r a U O x G n p Z M m A v F B Z X D e R R 1 q K Q L X G g 0 y U t M I p m 9 8 X B 3 3 q k S 4 c v h B G P r 7 E j 2 A H y 8 S C K S T i I 2 b G f K g 7 N N V t E i K 1 O H r C N o A I T T 6 d 8 Z p 0 z w Q I r Q E q p 4 6 u g W L B 0 i 3 X N j 6 X 7 f c t 0 G c 4 P f C 3 A l 8 z 4 a i y n n 3 4 + / U O 5 u z n l O Y j z o 8 J P J / I n r i n m c N e X x 9 0 o 4 2 7 r a g V 5 0 + p V k b f 0 K v I 9 T H M m n v K d 3 o C 6 r k I n / 5 y B 1 H l K S v 4 D X 4 l C l w C Q P C W F x V P x l Q z t A w X M H Q D z Q R n 6 0 f / 9 r / L v G T h u v j J 8 I F A r j B T w 4 I Y + S J c C u h + U g j K C s i h J S E J + + O k + + V n 7 X v k C w g q V Y Z 0 E k V b 8 Q D k C x B 6 V U 9 A n W E P / H v v x Q b g m 9 B F 3 x Q t H S u Y 9 E g U E e O x n C t S b Y E / e Z O J H S Y h 9 R Z P Q V y x V Q e Z E G P g / Z o D W E d 9 Y m v h 2 h X E 0 z d H m q K 9 W q W 9 S + 7 / C O q f P g D q u U C u w j l m H v b k C 9 n a F d 4 w 5 3 t H M K v Y 6 b V U N k F 3 i z I + j R J n 6 o T + d T R k v p E s P 5 m t Z P / I 4 w h K W 0 V I 2 w t f / B 1 R Q p 9 I =  
 : f x d r e e m a > * / 