Техническое задание
//+------------------------------------------------------------------+
//| AMA.mq4 |
//| Copyright © 2004, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2004, by konKop,wellx"
#property link "http://www.metaquotes.net"
#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 Sienna
#property indicator_color2 DeepSkyBlue
#property indicator_color3 Gold
//---- input parameters
extern int periodAMA=9;
extern int nfast=2;
extern int nslow=30;
extern double G=2.0;
extern double dK=2.0;
//---- buffers
double kAMAbuffer[];
double kAMAupsig[];
double kAMAdownsig[];
//+------------------------------------------------------------------+
int cbars=0, prevbars=0, prevtime=0;
double slowSC,fastSC;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_LINE,0,2);
SetIndexStyle(1,DRAW_ARROW);
SetIndexArrow(1,159);
SetIndexStyle(2,DRAW_ARROW);
SetIndexArrow(2,159);
//SetIndexDrawBegin(0,nslow+nfast);
SetIndexBuffer(0,kAMAbuffer);
SetIndexBuffer(1,kAMAupsig);
SetIndexBuffer(2,kAMAdownsig);
IndicatorDigits(4);
//slowSC=0.064516;
//fastSC=0.2;
//cbars=IndicatorCounted();
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int i,pos=0;
double noise=0.000000001,AMA,AMA0,signal,ER;
double dSC,ERSC,SSC,ddK;
if (prevbars==Bars) return(0);
//---- TODO: add your code here
slowSC=(2.0 /(nslow+1));
fastSC=(2.0 /(nfast+1));
cbars=IndicatorCounted();
if (Bars<=(periodAMA+2)) return(0);
//---- check for possible errors
if (cbars<0) return(-1);
//---- last counted bar will be recounted
if (cbars>0) cbars--;
pos=Bars-periodAMA-2;
AMA0=Close[pos+1];
while (pos>=0)
{
if(pos==Bars-periodAMA-2) AMA0=Close[pos+1];
signal=MathAbs(Close[pos]-Close[pos+periodAMA]);
noise=0.000000001;
for(i=0;i<periodAMA;i++)
{
noise=noise+MathAbs(Close[pos+i]-Close[pos+i+1]);
}
ER =signal/noise;
dSC=(fastSC-slowSC);
ERSC=ER*dSC;
SSC=ERSC+slowSC;
AMA=AMA0+(MathPow(SSC,G)*(Close[pos]-AMA0));
kAMAbuffer[pos]=AMA;
ddK=(AMA-AMA0);
if ((MathAbs(ddK)) > (dK*Point) && (ddK > 0)) kAMAupsig[pos] =AMA; else kAMAupsig[pos]=0;
if ((MathAbs(ddK)) > (dK*Point) && (ddK < 0)) kAMAdownsig[pos]=AMA; else kAMAdownsig[pos]=0;
AMA0=AMA;
pos--;
}
//----
prevbars=Bars;
return(0);
}//+------------------------------------------------------------------+ //| AMA.mq5 | //| Copyright 2013, MetaQuotes Software Corp. | //| http://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "Copyright 2013, MetaQuotes Software Corp." #property link "http://www.mql5.com" #property version "1.00" #property indicator_chart_window #property indicator_buffers 3 #property indicator_color1 Sienna #property indicator_type1 DRAW_LINE #property indicator_width1 2 #property indicator_color2 DeepSkyBlue #property indicator_type2 DRAW_ARROW #property indicator_color3 Gold #property indicator_type3 DRAW_ARROW //---- input parameters input int periodAMA=9; input int nfast=3; input int nslow=13; input double G=2.0; input double dK=2.0; //---- buffers double kAMAbuffer[]; double kAMAupsig[]; double kAMAdownsig[]; //+------------------------------------------------------------------+ int cbars=0, prevbars=0, prevtime=0; double slowSC, fastSC; #property indicator_plots 3 //--- indicator buffers //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int OnInit() { IndicatorSetInteger(INDICATOR_DIGITS,_Digits); //--- indicator buffers mapping SetIndexBuffer(0,kAMAbuffer,INDICATOR_DATA); SetIndexBuffer(1,kAMAupsig,INDICATOR_DATA); SetIndexBuffer(2,kAMAdownsig,INDICATOR_DATA); PlotIndexSetInteger(1, PLOT_ARROW, 159); PlotIndexSetInteger(2, PLOT_ARROW, 159); //--- return(0); } //+------------------------------------------------------------------+ //| 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 (prevbars==rates_total) return (0); // Print("prev_calculated="+prev_calculated+";prevbars="+prevbars ); int i, pos=0; double noise=0.000000001, AMA, AMA0, signal, ER; double dSC, ERSC, SSC, ddK; //---- TODO: add your code here slowSC=(2.0 /(nslow+1)); fastSC=(2.0 /(nfast+1)); //cbars=IndicatorCounted(prev_calculated); if(prev_calculated>0) cbars = prev_calculated-1; if(prev_calculated==0) cbars = 0; cbars=0; //Print(cbars); if (rates_total<=(periodAMA+2)) return (0); //---- check for possible errors if (cbars<0) return (-1); //---- last counted bar will be recounted if (cbars>0) cbars--; pos=periodAMA+2; /* if (rates_total<=(periodAMA+2)) return (0); pos=periodAMA+2; if(prev_calculated>0) pos = prev_calculated-1; */ AMA0=close[pos-1]; while (pos<rates_total) { //Print("pos="+pos+";rates_total="+rates_total); if (pos==periodAMA-2) AMA0=close[pos-1]; signal=MathAbs (close[pos]-close[pos-periodAMA]); noise=0.000000001; for (i=0; i< periodAMA; i++) { noise=noise+MathAbs (close[pos-i]-close[pos-i-1]); } ER =signal/noise; dSC=(fastSC-slowSC); ERSC=ER*dSC; SSC=ERSC+slowSC; AMA=AMA0+(MathPow (SSC, G)*(close[pos]-AMA0)); kAMAbuffer[pos]=AMA; ddK=(AMA-AMA0); if ((MathAbs (ddK)) > (dK*_Point) &&(ddK > 0)) kAMAupsig[pos] =AMA; else kAMAupsig[pos]=0; if ((MathAbs (ddK)) > (dK*_Point) &&(ddK < 0)) kAMAdownsig[pos]=AMA; else kAMAdownsig[pos]=0; AMA0=AMA; pos++; } prevbars=rates_total; //--- return value of prev_calculated for next call return(rates_total); } //+------------------------------------------------------------------+ //| TradeTransaction function | //+------------------------------------------------------------------+ void OnTradeTransaction(const MqlTradeTransaction& trans, const MqlTradeRequest& request, const MqlTradeResult& result) { //--- } //+------------------------------------------------------------------+тормозить дико в сравнении со встроенными индюками
Откликнулись
1
Оценка
Проекты
73
16%
Арбитраж
13
8%
/
92%
Просрочено
37
51%
Свободен
2
Оценка
Проекты
650
28%
Арбитраж
112
19%
/
62%
Просрочено
319
49%
Свободен
3
Оценка
Проекты
0
0%
Арбитраж
0
Просрочено
0
Свободен
4
Оценка
Проекты
5
20%
Арбитраж
2
50%
/
0%
Просрочено
0
Свободен
5
Оценка
Проекты
18
61%
Арбитраж
4
0%
/
100%
Просрочено
8
44%
Свободен
Информация о проекте
Бюджет
10 - 20 USD
Сроки выполнения
от 1 до 3 дн.