
//+------------------------------------------------------------------+
//| OpenDelta.mq4 |
//| Copyright 2018, AM2 |
//| http://www.forexsyatems.biz |
//+------------------------------------------------------------------+
#property copyright "Copyright 2018, AM2"
#property link "http://www.forexsyatems.biz"
#property version "1.00"
#property strict
#property indicator_chart_window
input int count=5;
input int up1=200;
input int up2=400;
input int up3=600;
input int dn1=200;
input int dn2=400;
input int dn3=600;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//--- indicator buffers mapping
ObjectsDeleteAll();
//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
void PutTrendLine(string name,datetime time1,double price1,datetime time2,double price2,color clr)
{
ObjectDelete(0,name);
ObjectCreate(0,name,OBJ_TREND,0,time1,price1,time2,price2);
//--- установим цвет линии
ObjectSetInteger(0,name,OBJPROP_COLOR,clr);
//--- установим толщину линии
ObjectSetInteger(0,name,OBJPROP_WIDTH,2);
//--- включим (true) или отключим (false) режим продолжения отображения линии вправо
ObjectSetInteger(0,name,OBJPROP_RAY_RIGHT,false);
}
//+------------------------------------------------------------------+
//| 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<count;i++)
{
double op=iOpen(NULL,PERIOD_D1,i);
datetime tm=iTime(NULL,PERIOD_D1,i);
datetime tm1=iTime(NULL,PERIOD_D1,i+1);
PutTrendLine("op"+(string)i,tm,op,tm1,op,Red);
PutTrendLine("up1"+(string)i,tm,op+up1*Point,tm1,op+up1*Point,Blue);
PutTrendLine("up2"+(string)i,tm,op+up2*Point,tm1,op+up2*Point,Blue);
PutTrendLine("up3"+(string)i,tm,op+up3*Point,tm1,op+up3*Point,Blue);
PutTrendLine("dn1"+(string)i,tm,op-dn1*Point,tm1,op-dn1*Point,Lime);
PutTrendLine("dn2"+(string)i,tm,op-dn2*Point,tm1,op-dn2*Point,Lime);
PutTrendLine("dn3"+(string)i,tm,op-dn3*Point,tm1,op-dn3*Point,Lime);
}
//--- return value of prev_calculated for next call
return(rates_total);
}
//+------------------------------------------------------------------+
input int show = 1; // 1-показать дату 0-нет
if(show==1)
{
...
}
я не понимаю!
AM2