TSequential

Author: James OBrien
TSequential
Miscellaneous
Implements a curve of type %1
0 Views
0 Downloads
0 Favorites
TSequential
//+--------------------------------------------------------------------------+
//| TD Sequential.mq4                                9-óñòàíîâêà             |
//|                                                  Õ-ïåðåñå÷åíèå           |
//|                                                  +-îòñ÷åò                |
//|                                                  V èëè^- Ñèãíàë íà âõîä  |
//| Copyright © 2004, MetaQuotes Software Corp.                              |
//| http://www.metaquotes.net                                                |
//+--------------------------------------------------------------------------+
#property copyright "James OBrien"
#property link "http://www.metaquotes.net"

#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 LimeGreen
//#property indicator_color2 Red
//---- input parameters
//int shift=0;
int i;
int num=0;
int num1=0,a1=true,a2=false,setup1=false,setup=false,per=false,cc=0,per1=false;
int skok1,skok,cc1=0;
string textVar;
//---- buffers
double ExtMapBuffer1[];
//double ExtMapBuffer2[];

//double b4plusdi,b4minusdi,nowplusdi,nowminusdi;

//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators

SetIndexStyle(1,DRAW_ARROW);
SetIndexArrow(1,222);
SetIndexBuffer(1, ExtMapBuffer1);
/*
SetIndexStyle(1,DRAW_ARROW,EMPTY);
SetIndexArrow(1,234);
SetIndexBuffer(1, ExtMapBuffer2);
*/
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//---- TODO: add your code here
int limit;
limit=1500;
for(int i=limit; i>=0; i--)
{
	ObjectDelete(""+i);
	ObjectDelete("11"+i);
	ObjectDelete("22"+i);
	ObjectDelete("21"+i);
	ObjectDelete("12"+i);

}	

//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int limit;
int counted_bars=IndicatorCounted();
//---- check for possible errors
if(counted_bars<0) return(-1);

//---- last counted bar will be recounted
if(counted_bars>0) counted_bars--;
limit=1500-counted_bars;
//---- macd counted in the 1-st buffer



for(int i=limit; i>=0; i--)
{
//Óñòàíîâêà
if((Close[i+1]<Close[i+5])&& a1==true) {num = num + 1; a2=true;} 
else {num = 0;}	
		if (num == 9) {
		ObjectCreate(""+i, OBJ_TEXT, 0, Time[i+1],Low[i+1]-10*Point );
      ObjectSetText(""+i, ""+DoubleToStr(num,0), 16, "Arial", RoyalBlue);
      setup=true;
      a1=false;
      per=false;
      skok1=false;
      cc1=0;
      }				

if(Close[i+1]>Close[i+5]&& a2==true) {num1 = num1 + 1; a1=true;} 
else {num1 = 0; }
		if (num1 == 9) {
		ObjectCreate(""+i, OBJ_TEXT, 0, Time[i+1],High[i+1]+50*Point );
      ObjectSetText(""+i, ""+DoubleToStr(num1,0), 16, "Arial", Red);
      setup1=true;
      a2=false;
      per1=false;
      skok=false;
      cc=0;
      }				
//Ïåðåñå÷åíèå
if (setup==true && High[i+1]>Low[i+4]){ObjectCreate("11"+i, OBJ_TEXT, 0, Time[i+1],Low[i+1]-10*Point );
                                     ObjectSetText("11"+i, "X", 10, "Arial", Green);
									        	per1=true; cc=0; setup=false;}

if (setup1==true && Low[i+1]<High[i+4]){ObjectCreate("11"+i, OBJ_TEXT, 0, Time[i+1],High[i+1]+30*Point );
                                     ObjectSetText("11"+i, "X", 10, "Arial", Yellow);
									        	per=true; cc=0; setup1=false;}
 	
//Îòñ÷åò
if (per==true && Close[i+1]>High[i+3]) {cc=cc+1;
												   if (cc>12) {cc=0; per=false; skok=true;
												   ObjectCreate("22"+i, OBJ_TEXT, 0, Time[i+1],High[i+1]+100*Point );
                                       ObjectSetText("22"+i, "+", 10, "Arial", Yellow); }}
if (per1==true && Close[i+1]<Low[i+3]) {cc1=cc1+1;
												   if (cc1>12) {cc1=0; per1=false; skok1=true;
												   ObjectCreate("22"+i, OBJ_TEXT, 0, Time[i+1],Low[i+1]-10*Point );
                                       ObjectSetText("22"+i, "+", 10, "Arial", Green); }}
//Âõîä
if (skok==true && Close[i+1]<Low[i+3]) {skok=false; 
												   ObjectCreate("12"+i, OBJ_TEXT, 0, Time[i+1],High[i+1]+100*Point );
                                       ObjectSetText("12"+i, "V", 10, "Arial", Red); 


}
if (skok1==true && Close[i+1]>High[i+3]) {skok1=false;
												   ObjectCreate("21"+i, OBJ_TEXT, 0, Time[i+1],Low[i+1]-10*Point );
                                       ObjectSetText("21"+i, "^", 12, "Arial", Blue); 

                                        

}

}

//----
return(0);
}




Comments

Markdown supported. Formatting help

Markdown Formatting Guide

Element Markdown Syntax
Heading # H1
## H2
### H3
Bold **bold text**
Italic *italicized text*
Link [title](https://www.example.com)
Image ![alt text](image.jpg)
Code `code`
Code Block ```
code block
```
Quote > blockquote
Unordered List - Item 1
- Item 2
Ordered List 1. First item
2. Second item
Horizontal Rule ---