
//+------------------------------------------------------------------+
//| 4MA.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 8
#property indicator_color1 Red
#property indicator_color2 Red
#property indicator_color3 Red
#property indicator_color4 Red
#property indicator_color5 Blue
#property indicator_color6 Aqua
#property indicator_color7 Blue
#property indicator_color8 Aqua
#property indicator_style1 2
#property indicator_style2 2
#property indicator_style3 2
#property indicator_style4 2
input int MA1Period = 10;
input int MA2Period = 20;
input int MA3Period = 30;
input int MA4Period = 40;
input int MA1Shift = 0;
input int MA2Shift = 0;
input int MA3Shift = 0;
input int MA4Shift = 0;
input int MA1Method = 0;
input int MA2Method = 0;
input int MA3Method = 0;
input int MA4Method = 0;
input int MA1Price = 0;
input int MA2Price = 0;
input int MA3Price = 0;
input int MA4Price = 0;
input int EN1Period = 15;
input int EN2Period = 25;
input int EN1Method = 0;
input int EN2Method = 0;
input int EN1Shift = 0;
input int EN2Shift = 0;
input int EN1Price = 0;
input int EN2Price = 0;
input int EN1Mode = 0;
input int EN2Mode = 0;
input double EN1Dev = 0.2;
input double EN2Dev = 0.2;
double MA1Buffer[];
double MA2Buffer[];
double MA3Buffer[];
double MA4Buffer[];
double EN1UPBuffer[];
double EN2UPBuffer[];
double EN1DNBuffer[];
double EN2DNBuffer[];
//+------------------------------------------------------------------+
//| 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);
SetIndexStyle(5,DRAW_LINE);
SetIndexStyle(6,DRAW_LINE);
SetIndexStyle(7,DRAW_LINE);
SetIndexBuffer(0,MA1Buffer);
SetIndexBuffer(1,MA2Buffer);
SetIndexBuffer(2,MA3Buffer);
SetIndexBuffer(3,MA4Buffer);
SetIndexBuffer(4,EN1UPBuffer);
SetIndexBuffer(5,EN2UPBuffer);
SetIndexBuffer(6,EN1DNBuffer);
SetIndexBuffer(7,EN2DNBuffer);
//---
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<=10000;i++)
{
MA1Buffer[i]=iMA(NULL,0,MA1Period,MA1Shift,MA1Method,MA1Price,i);
MA2Buffer[i]=iMA(NULL,0,MA2Period,MA2Shift,MA2Method,MA2Price,i);
MA3Buffer[i]=iMA(NULL,0,MA3Period,MA3Shift,MA3Method,MA3Price,i);
MA4Buffer[i]=iMA(NULL,0,MA4Period,MA4Shift,MA4Method,MA4Price,i);
EN1UPBuffer[i]=iEnvelopes(NULL,0,EN1Period,EN1Method,EN1Shift,EN1Price,EN1Dev,0,i);
EN2UPBuffer[i]=iEnvelopes(NULL,0,EN2Period,EN2Method,EN2Shift,EN2Price,EN2Dev,0,i);
EN1DNBuffer[i]=iEnvelopes(NULL,0,EN1Period,EN1Method,EN1Shift,EN1Price,EN1Dev,1,i);
EN2DNBuffer[i]=iEnvelopes(NULL,0,EN2Period,EN2Method,EN2Shift,EN2Price,EN2Dev,1,i);
}
//--- return value of prev_calculated for next call
return(rates_total);
}
//+------------------------------------------------------------------+
Желающие могут ставить в любое время. Доработки через стол заказов.
AM2