Relax_GoToSleep_v01

Download script
Author: (c) 2008 DolSergon
Relax_GoToSleep_v01

This tool functions as a specialized visual overlay for trading charts, designed to provide unique aesthetic and statistical data points on the screen. Rather than following standard technical analysis rules, it uses a combination of randomized logic and mathematical offsets to create dynamic visual markers.

The underlying logic operates through four distinct components:

1. Randomized Moving Average (MA) The script takes the standard closing prices of the market but applies a layer of "noise" to them. It generates a random numerical value for every data point and adds it to the actual price before calculating a Linear Weighted Moving Average. This results in a smoothed line that behaves differently than a standard indicator, creating a unique visual path on your chart.

2. Dynamic Face Markers The script places specific arrow symbols (visualized as "faces") at various points along the price history. These markers do not appear randomly; they move according to a controlled oscillation logic. The script tracks their position and switches their direction automatically once they reach predefined boundaries, creating a rhythmic movement of symbols across the chart area.

3. Air Price Tracking This component identifies specific historical price points, specifically focusing on low prices from previous periods. It places these markers at significant offsets from the current live price, allowing you to see "Air" price references visually separated from the immediate action.

4. Probability-Based Hand Signals The final layer of logic provides real-time signals based on a coin-flip style probability (a 50/50 chance). On every update, the script decides whether to display a specific arrow pointing up or down at the current price. These are purely randomized indicators that react instantly to each new tick of market data.

Summary for the User In essence, this tool is a "visualizer" that mixes real market data with algorithmic randomness. It creates a stylized environment where you can see oscillating markers, historical price anchors, and randomized signals, all overlaid on a modified moving average line.

Indicators Used
Moving average indicator
Miscellaneous
Implements a curve of type %1
12 Views
0 Downloads
0 Favorites
Relax_GoToSleep_v01
//=======================================================================================================================
// Relax_GoToSleep.mq4
// (c) 2008 DolSergon
//
//        :)
//
//=======================================================================================================================
#property copyright "(c) 2008 DolSergon"
#property link      ""
//-------------------------------------------------------------------------------------------------------------------
#property indicator_chart_window      
#property indicator_buffers 4
#property indicator_color1 Red
#property indicator_color2 Magenta
#property indicator_width2 6
#property indicator_color3 White
#property indicator_width3 20
#property indicator_color4 Blue
#property indicator_width4 10

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

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

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

   SetIndexStyle(1, DRAW_ARROW);
   SetIndexArrow(1, 74);
   SetIndexBuffer(1, BufFace);
   SetIndexEmptyValue(1, 0.0);
   
   SetIndexStyle(2, DRAW_ARROW);
   SetIndexArrow(2, 81);
   SetIndexBuffer(2, BufAir);
   SetIndexEmptyValue(2, 0.0);
   SetIndexShift(2, 100);
   
   SetIndexStyle(3, DRAW_ARROW);
   SetIndexArrow(3, 71);
   SetIndexBuffer(3, BufHand);
   SetIndexEmptyValue(3, 0.0);
   SetIndexShift(3, 2);

   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;  
   }




	// FACE1 --------------------------------------------------------------------------------------
   	SetIndexArrow(1, Face1);
   	Face1++;
	if (Face1 > 76) {
   		Face1 = 74;
   		Face1Pos = Face1Pos + FaceDirect;
   		if (Face1Pos > 50) {
   			FaceDirect = -1;
   		}
   		if (Face1Pos < 0) {
   			FaceDirect = 1;
   		}
   	}
   for (b=0; b<1000; b++) {
      BufFace[b] = 0;  
   }
   	//SetIndexArrow(1, Face1);
	BufFace[Face1Pos] = High[Face1Pos] + 10*Point;






	// AIR ----------------------------------------------------------------------------------------
	AirPos--;
	if (AirPos < 0) {
		AirPos = 200;
		AirPrice = Low[1];
	}
	
   	for (b=0; b<1000; b++) {
    	BufAir[b] = 0;  
   	}
    BufAir[AirPos] = AirPrice;  
	
	
	
	
	
	// Hand ---------------------------------------------------------------------------------------
	if (MathRand() > 16383) {
   		SetIndexArrow(3, 71);
		BufHand[0] = Close[0] + 0*Point;
	} else {
   		SetIndexArrow(3, 72);
		BufHand[0] = Close[0] - 0*Point;
	}
	BufHand[1] = 0;
	
	
   return(0);
}

 

Comments