И чтобы машка меняла цвет по рынку а не по закрытым свечам)
А то где синим нарисовал цена была выше машки но цвет так остался красный.
Обратитесь лучше к Оксане она спец по индикаторам, а я здесь делаю только то что быстро можно сделать.
И чтобы машка меняла цвет по рынку а не по закрытым свечам)
А то где синим нарисовал цена была выше машки но цвет так остался красный.
пункт выставлять противоположный ордер — да/нет
//+------------------------------------------------------------------+
//| MailLines.mq4 |
//| Copyright 2016, AM2 |
//| http://www.forexsystems.biz |
//+------------------------------------------------------------------+
#property copyright "Copyright 2016, AM2"
#property link "http://www.forexsystems.biz"
#property version "1.00"
#property strict
#property indicator_chart_window
extern color LineColor = Red; // цвет линии
extern string Line1Name = "Line1"; // имя линии
extern string Line2Name = "Line2"; // имя линии
extern string Line3Name = "Line3"; // имя линии
extern int Delta = 30; // отступ от линии
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//--- indicator buffers mapping
ObjectsDeleteAll(0,OBJ_HLINE);
PutHLine(Line1Name,Ask+200*Point);
PutHLine(Line2Name,Ask+400*Point);
PutHLine(Line3Name,Ask+600*Point);
//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Горизонтальная линия |
//+------------------------------------------------------------------+
void PutHLine(string name,double price)
{
ObjectCreate(0,name,OBJ_HLINE,0,0,price);
//--- установим цвет линии
ObjectSetInteger(0,name,OBJPROP_COLOR,LineColor);
//--- установим толщину линии
ObjectSetInteger(0,name,OBJPROP_WIDTH,1);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
double LinePrice(string name)
{
double pr=0;
for(int i=ObjectsTotal()-1;i>=0;i--)
{
pr=ObjectGetDouble(0,name,OBJPROP_PRICE);
}
return(pr);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
const int prev_calculated,
const datetime &time[],
const double &open[],
const double &high[],
const double &low[],
const double &close[],
const long &tick_volume[],
const long &volume[],
const int &spread[])
{
//---
if(Bid<LinePrice(Line1Name)+Delta*Point && Bid>LinePrice(Line1Name)-Delta*Point)
{
SendMail("Сообщение индикатора: ","Цена у линии "+(string)LinePrice(Line1Name));
Print("Сообщение индикатора: ","Цена у линии "+(string)LinePrice(Line1Name));
}
if(Bid<LinePrice(Line2Name)+Delta*Point && Bid>LinePrice(Line2Name)-Delta*Point)
{
SendMail("Сообщение индикатора: ","Цена у линии "+(string)LinePrice(Line2Name));
Print("Сообщение индикатора: ","Цена у линии "+(string)LinePrice(Line2Name));
}
if(Bid<LinePrice(Line3Name)+Delta*Point && Bid>LinePrice(Line3Name)-Delta*Point)
{
SendMail("Сообщение индикатора: ","Цена у линии "+(string)LinePrice(Line3Name));
Print("Сообщение индикатора: ","Цена у линии "+(string)LinePrice(Line3Name));
}
Comment("\n Line1 Price: ",LinePrice(Line1Name),
"\n Line2 Price: ",LinePrice(Line2Name),
"\n Line3 Price: ",LinePrice(Line3Name));
//--- return value of prev_calculated for next call
return(rates_total);
}
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
//| Mashka.mq4 |
//| Copyright 2016, AM2 |
//| http://www.forexsystems.biz |
//+------------------------------------------------------------------+
#property copyright "Copyright 2016, AM2"
#property link "http://www.forexsystems.biz"
#property version "1.00"
#property strict
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Lime
#property indicator_color2 Red
#property indicator_width1 1
#property indicator_width2 1
input int MAPeriod = 20;
input int BarsCount = 5555;
input int MAStyle=0; //0-Points 1-Line
double up[];
double dn[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//--- indicator buffers mapping
SetIndexBuffer(0,up);
SetIndexBuffer(1,dn);
if(MAStyle==1)
{
SetIndexStyle(0,DRAW_LINE);
SetIndexStyle(1,DRAW_LINE);
}
if(MAStyle==0)
{
SetIndexStyle(0,DRAW_ARROW);
SetIndexArrow(0,159);
SetIndexStyle(1,DRAW_ARROW);
SetIndexArrow(1,159);
}
//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
const int prev_calculated,
const datetime &time[],
const double &open[],
const double &high[],
const double &low[],
const double &close[],
const long &tick_volume[],
const long &volume[],
const int &spread[])
{
//---
for(int i=0;i<=BarsCount;i++)
{
if(Close[i]>iMA(NULL,0,MAPeriod,0,0,0,i)) up[i]=iMA(NULL,0,MAPeriod,0,0,0,i);
if(Close[i]<iMA(NULL,0,MAPeriod,0,0,0,i)) dn[i]=iMA(NULL,0,MAPeriod,0,0,0,i);
}
//--- return value of prev_calculated for next call
return(rates_total);
}
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
//| Mashka.mq4 |
//| Copyright 2016, AM2 |
//| http://www.forexsystems.biz |
//+------------------------------------------------------------------+
#property copyright "Copyright 2016, AM2"
#property link "http://www.forexsystems.biz"
#property version "1.00"
#property strict
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Lime
#property indicator_color2 Red
#property indicator_width1 1
#property indicator_width2 1
input int MAPeriod = 20;
input int BarsCount = 5555;
input int MAStyle=0; //0-Points 1-Line
double up[];
double dn[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//--- indicator buffers mapping
SetIndexBuffer(0,up);
SetIndexBuffer(1,dn);
if(MAStyle==1)
{
SetIndexStyle(0,DRAW_LINE);
SetIndexStyle(1,DRAW_LINE);
}
if(MAStyle==0)
{
SetIndexStyle(0,DRAW_ARROW);
SetIndexArrow(0,159);
SetIndexStyle(1,DRAW_ARROW);
SetIndexArrow(1,159);
}
//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
const int prev_calculated,
const datetime &time[],
const double &open[],
const double &high[],
const double &low[],
const double &close[],
const long &tick_volume[],
const long &volume[],
const int &spread[])
{
//---
for(int i=0;i<=BarsCount;i++)
{
up[i]=iMA(NULL,0,MAPeriod,0,0,0,i);
if(iMA(NULL,0,MAPeriod,0,0,0,i)<iMA(NULL,0,MAPeriod,0,0,0,i+1)) dn[i]=iMA(NULL,0,MAPeriod,0,0,0,i);
}
//--- return value of prev_calculated for next call
return(rates_total);
}
//+------------------------------------------------------------------+
AM2