Price Data Components
Indicators Used
Miscellaneous
0
Views
0
Downloads
0
Favorites
ytg_PRIMITIVE_SYSTEM_1
//+------------------------------------------------------------------+
//| ytg_PRIMITIVE_SYSTEM.mq4 |
//| Yuriy Tokman |
//| http://www.mql-design.ru |
//+------------------------------------------------------------------+
#property copyright "Yuriy Tokman"
#property link "http://www.mql-design.ru"
#property indicator_chart_window
#property indicator_buffers 7
#property indicator_color1 Red
#property indicator_color2 Lime
#property indicator_color3 Gold
#property indicator_color4 Red
#property indicator_color5 Red
#property indicator_color6 Lime
#property indicator_color7 Lime
#property indicator_width1 2
#property indicator_width2 2
extern int bars=10;
extern string Copyright="Yuriy Tokman";
extern string ÏÈØÓ_ÍÀ_ÇÀÊÀÇ_ÝÊÑÏÅÐÒÛ="ÈÍÄÈÊÀÒÎÐÛ_ÑÊÐÈÏÒÛ";
extern string e_mail= "yuriytokman@gmail.com";
extern string Skype = "yuriy.t.g";
double ExtMapBuffer0[];
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double ExtMapBuffer4[];
double ExtMapBuffer5[];
double ExtMapBuffer6[];
string char1[256];
string txt="ytg_PRIMITIVE_SYSTEM";
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,ExtMapBuffer0);
SetIndexStyle(1,DRAW_LINE);
SetIndexBuffer(1,ExtMapBuffer1);
SetIndexStyle(2,DRAW_LINE);
SetIndexBuffer(2,ExtMapBuffer2);
SetIndexStyle(3,DRAW_LINE,STYLE_DOT);
SetIndexBuffer(3,ExtMapBuffer3);
SetIndexStyle(4,DRAW_LINE,STYLE_DOT);
SetIndexBuffer(4,ExtMapBuffer4);
SetIndexStyle(5,DRAW_LINE,STYLE_DOT);
SetIndexBuffer(5,ExtMapBuffer5);
SetIndexStyle(6,DRAW_LINE,STYLE_DOT);
SetIndexBuffer(6,ExtMapBuffer6);
SetIndexLabel(0," HIGH PC ");
SetIndexLabel(1," LOW PC ");
SetIndexLabel(2," EMA 10 ");
SetIndexLabel(3," SL SELL ");
SetIndexLabel(4," SL BUY ");
SetIndexLabel(5," TP BUY ");
SetIndexLabel(6," TP SELLY ");
//----+
for(int i=0; i<256; i++) char1[i]=CharToStr(i);
//----+
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
GetDellName(txt);
GetDellName(e_mail);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
//----
double close;
double open;
//----
int limit;GetAvtor();GetYTG();
/* int counted_bars=IndicatorCounted();
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
limit=Bars-counted_bars;*/
int counted_bars=IndicatorCounted();
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
limit=Bars-counted_bars;
if(counted_bars==0) limit--;
for(int i=0; i<limit; i++)
{
double high= High[iHighest(Symbol(),0,MODE_HIGH,bars,i+1)];
double low = Low[iLowest(Symbol(),0,MODE_LOW,bars,i+1)];
double ma=iMA(Symbol(),0,bars,0,MODE_EMA,PRICE_MEDIAN,i+1);
double atr=iATR(Symbol(),0,25,i+1);
ExtMapBuffer0[i] = high;
ExtMapBuffer1[i] = low;
ExtMapBuffer2[i] = ma;
ExtMapBuffer3[i] = ma + atr;
ExtMapBuffer4[i] = ma - atr;
ExtMapBuffer5[i] = ma + atr*2;
ExtMapBuffer6[i] = ma - atr*2;
}
//----
for(i=0; i<limit; i++)
{
close= iClose(Symbol(),0,i);
open = iOpen(Symbol(),0,i);
atr=iATR(Symbol(),0,11,i)/4;
string pod=txt+"#"+i+"#"+DoubleToStr(ExtMapBuffer0[i],Digits)+"#";
if(close>ExtMapBuffer0[i] && ExtMapBuffer0[i]>open)
RICE_ARROW(pod,Time[i],High[i]+atr,Magenta,2,254);
pod=txt+"#"+i+"#"+DoubleToStr(ExtMapBuffer1[i],Digits)+"#";
if(ExtMapBuffer1[i]>close && open>ExtMapBuffer1[i])
RICE_ARROW(pod,Time[i],Low[i],LawnGreen,2,254);
}
//----
RICE_ARROW(txt+"1",Time[0],ExtMapBuffer2[0],Gold,1);
RICE_ARROW(txt+"2",Time[0],ExtMapBuffer3[0],Red,1);
RICE_ARROW(txt+"3",Time[0],ExtMapBuffer4[0],Red,1);
RICE_ARROW(txt+"4",Time[0],ExtMapBuffer5[0],Lime,1);
RICE_ARROW(txt+"5",Time[0],ExtMapBuffer6[0],Lime,1);
RICE_ARROW(txt+"6",Time[0],ExtMapBuffer0[0],Gainsboro,1);
RICE_ARROW(txt+"7",Time[0],ExtMapBuffer1[0],Gainsboro,1);
//----
for(i=0; i<100; i++)
{
close= iClose(Symbol(),0,i);
open = iOpen(Symbol(),0,i);
if(close>ExtMapBuffer0[i] && ExtMapBuffer0[i]>open)
{
string pyd="Âåðõíèé ïðîáîé "+TimeToStr(Time[i],TIME_DATE)+" áàð¹"+i;
Label(txt,pyd,1,10,20,14,"Arial Black",Magenta);
break;
}
if(ExtMapBuffer1[i]>close && open>ExtMapBuffer1[i])
{
pyd="Íèæíèé ïðîáîé "+TimeToStr(Time[i],TIME_DATE)+" áàð¹"+i;
Label(txt,pyd,1,10,20,14,"Arial Black",LawnGreen);
break;
}
}
//----
return(0);
}
//+------------------------------------------------------------------+
//| Ôóíêöèÿ îòîáðàæåíèÿ öåíîâîé ìåòêè |
//| àâòîð: Þðèé Òîêìàíü |
//| e-mail: yuriytokman@gmail.com |
//| ICQ# 481-971-287 |
//| Skype: yuriy.g.t |
//+------------------------------------------------------------------+
void RICE_ARROW(string label="",datetime time1=0,double price1=0,color colir=Red,int WIDTH=1,int arw=SYMBOL_RIGHTPRICE)
{
if(ObjectFind(label)!=-1) ObjectDelete(label);
ObjectCreate(label,OBJ_ARROW,0,time1,price1);
ObjectSet(label,OBJPROP_ARROWCODE,arw);
ObjectSet(label,OBJPROP_COLOR,colir);
ObjectSet(label,OBJPROP_WIDTH,WIDTH);
ObjectSet(label,OBJPROP_BACK,true);
}
//+------------------------------------------------------------------+
//| Ôóíêöèÿ óäàëÿåò îáúåêòû |
//| àâòîð: Þðèé Òîêìàíü |
//| e-mail: yuriytokman@gmail.com |
//| ICQ# 481-971-287 |
//| Skype: yuriy.g.t |
//+------------------------------------------------------------------+
void GetDellName(string name_n="ytg_")
{
string vName;
for(int i=ObjectsTotal()-1; i>=0;i--)
{
vName=ObjectName(i);
if(StringFind(vName,name_n)!=-1) ObjectDelete(vName);
}
}
//-----
color GetColor(int n,int t)
{
color colir=LimeGreen;
if(n==t || n+1==t || n+2==t)colir=Yellow;
if(n+10==t || n+11==t || n+12==t)colir = Aqua;
if(n+20==t || n+21==t || n+22==t)colir = Gold;
return(colir);
}
//----
void GetYTG()
{
static int count=0;
count++;if(count>2)count=0;
color color_Y=Lime;color color_T=DodgerBlue;color color_G=OrangeRed;
if(count==1){color_Y = OrangeRed; color_T = Lime; color_G = DodgerBlue;}
if(count==2){color_Y = DodgerBlue; color_T = OrangeRed; color_G = Lime;}
Label(e_mail+"_Y",char1[89],3,40,20,25,"Arial Black",color_Y);
Label(e_mail+"_T",char1[84],3,25,5,25,"Arial Black",color_T);
Label(e_mail+"_G",char1[71],3,13,32,25,"Arial Black",color_G);
}
//----
void Label(string name_label,string text_label,int corner=2,int x=3,int y=15,int font_size=10,string font_name="Arial",color text_color=LimeGreen)
{
if(ObjectFind(name_label)!=-1) ObjectDelete(name_label);
ObjectCreate(name_label,OBJ_LABEL,0,0,0,0,0);
ObjectSet(name_label,OBJPROP_CORNER,corner);
ObjectSet(name_label,OBJPROP_XDISTANCE,x);
ObjectSet(name_label,OBJPROP_YDISTANCE,y);
ObjectSetText(name_label,text_label,font_size,font_name,text_color);
}
//----+
void GetAvtor()
{
static int tick= 0;
tick++;if(tick>=42)tick=0;
string char1[256]; int i;
string f_n="Arial";
for(i=0; i<256; i++) char1[i]=CharToStr(i);
Label(e_mail+"label",char1[70],2,5,15,10,f_n,GetColor(41,tick));
Label(e_mail+"label1",char1[97],2,12,15,10,f_n,GetColor(0,tick));
Label(e_mail+"label2",char1[99],2,19,15,10,f_n,GetColor(1,tick));
Label(e_mail+"label3",char1[116],2,26,15,10,f_n,GetColor(2,tick));
Label(e_mail+"label4",char1[111],2,30,15,10,f_n,GetColor(3,tick));
Label(e_mail+"label5",char1[114],2,37,15,10,f_n,GetColor(4,tick));
Label(e_mail+"label6",char1[121],2,42,15,10,f_n,GetColor(5,tick));
Label(e_mail+"label8",char1[111],2,53,15,10,f_n,GetColor(6,tick));
Label(e_mail+"label9",char1[102],2,60,15,10,f_n,GetColor(7,tick));
Label(e_mail+"label11",char1[116],2,70,15,10,f_n,GetColor(8,tick));
Label(e_mail+"label12",char1[104],2,75,15,10,f_n,GetColor(9,tick));
Label(e_mail+"label13",char1[101],2,81,15,10,f_n,GetColor(10,tick));
Label(e_mail+"label15",char1[97],2,94,15,10,f_n,GetColor(11,tick));
Label(e_mail+"label16",char1[100],2,101,15,10,f_n,GetColor(12,tick));
Label(e_mail+"label17",char1[118],2,108,15,10,f_n,GetColor(13,tick));
Label(e_mail+"label18",char1[105],2,115,15,10,f_n,GetColor(14,tick));
Label(e_mail+"label19",char1[115],2,118,15,10,f_n,GetColor(15,tick));
Label(e_mail+"label20",char1[101],2,125,15,10,f_n,GetColor(16,tick));
Label(e_mail+"label21",char1[114],2,133,15,10,f_n,GetColor(17,tick));
Label(e_mail+"label22",char1[115],2,138,15,10,f_n,GetColor(18,tick));
Label(e_mail+"label23",char1[58],2,147,15,10,f_n,GetColor(19,tick));
Label(e_mail+"label24",char1[121],2,153,15,10,f_n,GetColor(20,tick));
Label(e_mail+"label25",char1[117],2,160,15,10,f_n,GetColor(21,tick));
Label(e_mail+"label26",char1[114],2,167,15,10,f_n,GetColor(22,tick));
Label(e_mail+"label28",char1[105],2,172,15,10,f_n,GetColor(23,tick));
Label(e_mail+"label29",char1[121],2,176,15,10,f_n,GetColor(24,tick));
Label(e_mail+"label311",char1[116],2,184,15,10,f_n,GetColor(25,tick));
Label(e_mail+"label312",char1[111],2,188,15,10,f_n,GetColor(26,tick));
Label(e_mail+"label313",char1[107],2,195,15,10,f_n,GetColor(27,tick));
Label(e_mail+"label315",char1[109],2,203,15,10,f_n,GetColor(28,tick));
Label(e_mail+"label316",char1[97],2,214,15,10,f_n,GetColor(29,tick));
Label(e_mail+"label317",char1[110],2,221,15,10,f_n,GetColor(30,tick));
Label(e_mail+"label318",char1[64],2,230,15,10,f_n,GetColor(31,tick));
Label(e_mail+"label319",char1[103],2,244,15,10,f_n,GetColor(32,tick));
Label(e_mail+"label3411",char1[109],2,251,15,10,f_n,GetColor(33,tick));
Label(e_mail+"label3412",char1[97],2,261,15,10,f_n,GetColor(34,tick));
Label(e_mail+"label3413",char1[105],2,268,15,10,f_n,GetColor(35,tick));
Label(e_mail+"label3415",char1[108],2,271,15,10,f_n,GetColor(36,tick));
Label(e_mail+"label33",char1[46],2,274,15,10,f_n,GetColor(37,tick));
Label(e_mail+"label34",char1[99],2,278,15,10,f_n,GetColor(38,tick));
Label(e_mail+"label35",char1[111],2,286,15,10,f_n,GetColor(39,tick));
Label(e_mail+"label36",char1[109],2,294,15,10,f_n,GetColor(40,tick)); //42
}
//+------------------------------------------------------------------+
Comments
Markdown Formatting Guide
# H1
## H2
### H3
**bold text**
*italicized text*
[title](https://www.example.com)

`code`
```
code block
```
> blockquote
- Item 1
- Item 2
1. First item
2. Second item
---