48 lines
		
	
	
	
		
			888 B
		
	
	
	
		
			MQL5
		
	
	
	
	
	
		
		
			
		
	
	
			48 lines
		
	
	
	
		
			888 B
		
	
	
	
		
			MQL5
		
	
	
	
	
	
| 
								 | 
							
								struct CHANNEL_UNIT
							 | 
						||
| 
								 | 
							
								{
							 | 
						||
| 
								 | 
							
								public:
							 | 
						||
| 
								 | 
							
								  double High;
							 | 
						||
| 
								 | 
							
								  double Low;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  CHANNEL_UNIT( void ) : High(0), Low(0)
							 | 
						||
| 
								 | 
							
								  {
							 | 
						||
| 
								 | 
							
								  }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  void operator +=( const double Value )
							 | 
						||
| 
								 | 
							
								  {
							 | 
						||
| 
								 | 
							
								    this.High += Value;
							 | 
						||
| 
								 | 
							
								    this.Low -= Value;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    return;
							 | 
						||
| 
								 | 
							
								  }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  void operator *=( const double Value )
							 | 
						||
| 
								 | 
							
								  {
							 | 
						||
| 
								 | 
							
								    const double Size = Value * (this.High - this.Low) / 2;
							 | 
						||
| 
								 | 
							
								    const double Avg = (this.High + this.Low) / 2;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    this.High = Avg + Size;
							 | 
						||
| 
								 | 
							
								    this.Low = Avg - Size;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    return;
							 | 
						||
| 
								 | 
							
								  }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  bool Check( void ) const
							 | 
						||
| 
								 | 
							
								  {
							 | 
						||
| 
								 | 
							
								    return(this.High > this.Low);
							 | 
						||
| 
								 | 
							
								  }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  void Normalize( void )
							 | 
						||
| 
								 | 
							
								  {
							 | 
						||
| 
								 | 
							
								    this.High = ::NormalizeDouble(this.High, _Digits);
							 | 
						||
| 
								 | 
							
								    this.Low = ::NormalizeDouble(this.Low, _Digits);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    return;
							 | 
						||
| 
								 | 
							
								  }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  string ToString( void ) const
							 | 
						||
| 
								 | 
							
								  {
							 | 
						||
| 
								 | 
							
								    return("High = " + ::DoubleToString(this.High, _Digits) +
							 | 
						||
| 
								 | 
							
								           "\nLow = " + ::DoubleToString(this.Low, _Digits));
							 | 
						||
| 
								 | 
							
								  }
							 | 
						||
| 
								 | 
							
								};
							 |