
Машки
//+------------------------------------------------------------------+
//| 5MA.mq4 |
//| Copyright 2017, AM2 |
//| http://www.forexsystems.biz |
//+------------------------------------------------------------------+
#property copyright "Copyright 2017, AM2"
#property link "http://www.forexsystems.biz"
#property version "1.00"
#property strict
#property indicator_chart_window
#property indicator_buffers 5
#property indicator_color1 Red
#property indicator_color2 Red
#property indicator_color3 Red
#property indicator_color4 Red
#property indicator_color5 Red
#property indicator_width1 1
#property indicator_width2 1
#property indicator_width3 1
#property indicator_width4 1
#property indicator_width5 1
input int ma1period=5;
input int ma2period=10;
input int ma3period=15;
input int ma4period=20;
input int ma5period=25;
//--- indicator buffers
double ma1[];
double ma2[];
double ma3[];
double ma4[];
double ma5[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//--- indicator buffers mapping
SetIndexStyle(0,DRAW_LINE);
SetIndexStyle(1,DRAW_LINE);
SetIndexStyle(2,DRAW_LINE);
SetIndexStyle(3,DRAW_LINE);
SetIndexStyle(4,DRAW_LINE);
SetIndexBuffer(0,ma1);
SetIndexBuffer(1,ma2);
SetIndexBuffer(2,ma3);
SetIndexBuffer(3,ma4);
SetIndexBuffer(4,ma5);
//---
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<1000;i++)
{
ma1[i]=iMA(NULL,0,ma1period,0,0,0,i);
ma2[i]=iMA(NULL,0,ma2period,0,0,0,i);
ma3[i]=iMA(NULL,0,ma3period,0,0,0,i);
ma4[i]=iMA(NULL,0,ma4period,0,0,0,i);
ma5[i]=iMA(NULL,0,ma5period,0,0,0,i);
}
//--- return value of prev_calculated for next call
return(rates_total);
}
//+------------------------------------------------------------------+
Столбики
//+------------------------------------------------------------------+
//| 5Mashek.mq4 |
//| Copyright 2017, AM2 |
//| http://www.forexsystems.biz |
//+------------------------------------------------------------------+
#property copyright "Copyright 2017, AM2"
#property link "http://www.forexsystems.biz"
#property version "1.00"
#property strict
#property indicator_separate_window
#property indicator_buffers 1
#property indicator_maximum 1
#property indicator_minimum -0.2
#property indicator_color1 Red
#property indicator_width1 2
input int ma1period=5;
input int ma2period=10;
input int ma3period=15;
input int ma4period=20;
input int ma5period=25;
//--- indicator buffers
double buff[];
datetime t=0;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//--- indicator buffers mapping
SetIndexStyle(0,DRAW_HISTOGRAM);
SetIndexBuffer(0,buff);
//---
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[])
{
//---
int lim=rates_total-prev_calculated;
for(int i=0;i<lim;i++)
{
double MA1=iMA(NULL,0,ma1period,0,0,0,i);
double MA2=iMA(NULL,0,ma2period,0,0,0,i);
double MA3=iMA(NULL,0,ma3period,0,0,0,i);
double MA4=iMA(NULL,0,ma4period,0,0,0,i);
double MA5=iMA(NULL,0,ma5period,0,0,0,i);
if((MA1>high[i] || MA1<low[i]) &&
(MA2>high[i] || MA2<low[i]) &&
(MA3>high[i] || MA3<low[i]) &&
(MA4>high[i] || MA4<low[i]) &&
(MA5>high[i] || MA5<low[i])) buff[i]=0.9;
}
if(t!=time[0])
{
if(buff[1]==0.9) Alert(_Symbol+" Не было пересечения с МА!!!");
t=time[0];
}
//--- return value of prev_calculated for next call
return(rates_total);
}
//+------------------------------------------------------------------+
Скачал версию из базы. Ставит усредненный тейк:
Когда у вас такая штука проявляется и что в журнале?
AM2