Relax_GoToSleep_v01_play2_sw





//=======================================================================================================================
// Relax_GoToSleep.mq4
// (c) 2008 DolSergon
//
//        :)
//
//=======================================================================================================================
#property copyright "(c) 2008 DolSergon"
#property link      ""
//-------------------------------------------------------------------------------------------------------------------
#property indicator_separate_window      
#property indicator_buffers 4
#property indicator_color1 Blue
#property indicator_color2 Red
#property indicator_width2 1
#property indicator_color3 Blue
#property indicator_width3 2
#property indicator_color4 White
#property indicator_width4 2

double BufMA[];     
double BufFace[];     
double BufAir[];     
double BufHand[];     
               
double BufMA1[1000];
double BufMA1Rnd[1000];
double BufMA2[];
double BufMA3[];     

int		Face1 = 74, Face1Pos = 0, FaceDirect = 1;
int		AirPos = 0;
double 	AirPrice;

//=======================================================================================================================
int init() {
	IndicatorBuffers(4);
	
   SetIndexStyle(0, DRAW_LINE);
   SetIndexBuffer(0, BufMA2);

   SetIndexStyle (1,  DRAW_LINE);
   SetIndexBuffer(1, BufMA3);
 
 
    SetIndexStyle(3,  DRAW_NONE);
   SetIndexBuffer(3, BufMA);
  
   SetIndexStyle(2, DRAW_ARROW);
   SetIndexArrow(2, 71);
   SetIndexBuffer(2, BufHand);
   SetIndexEmptyValue(2, EMPTY_VALUE);
   SetIndexShift(2, 4);


   return(0);
}


  
//=======================================================================================================================
int start() {
  	int b;
  	int n;
	double   val1;

	ArraySetAsSeries(BufMA1, true);
	ArraySetAsSeries(BufMA1Rnd, true);


	// MA1 ----------------------------------------------------------------------------------------
	for (b=999; b>=1; b--) {
    	BufMA1Rnd[b] = BufMA1Rnd[b-1];  
	}
	// Ôóíêöèÿ âîçâðàùàåò ïñåâäîñëó÷àéíîå öåëîå ÷èñëî â äèïàçîíå îò 0 äî 32767. 
	BufMA1Rnd[0] = (MathRand() / 1000) * Point - 15 * Point;
   
   for (b=0; b<1000; b++) {
      BufMA1[b] = Close[b] + BufMA1Rnd[b];  
   }
   
   for (b=0; b<1000; b++) {
      val1 = iMAOnArray(BufMA1, 1000, 7, 0, MODE_LWMA, b);
      BufMA[b] = val1;  
   }
//
   for (b=0; b<1000; b++) {
      BufMA2[b] =(BufMA[b]-BufMA[b+5])/BufMA[b+5]*1000;  
      BufMA3[b] =(BufMA[b]-BufMA[b+6])/BufMA[b+6]*1000;  

   


	// Hand ---------------------------------------------------------------------------------------
	if (BufMA2[0] > 0) {
   		SetIndexArrow(2, 71);
		BufHand[0] = 0;
	} else {
   		SetIndexArrow(2, 72);
		BufHand[0] = 0 ;
	}
	BufHand[1] = EMPTY_VALUE;

	
}	







	
	
	
	
	
	
	
   return(0);
}

 





Sample





Analysis



Market Information Used:

Series array that contains close prices for each bar


Indicator Curves created:

Implements a curve of type DRAW_LINE

Implements a curve of type DRAW_NONE
Implements a curve of type DRAW_ARROW

Indicators Used:

Moving average indicator


Custom Indicators Used:

Order Management characteristics:

Other Features: