Файл:
Ссылка на изображение:
Выравнивание: нет слева справа
Описание:
//+------------------------------------------------------------------+ //| Copyright © 2022, forex-time@mail.ru | //+------------------------------------------------------------------+ #property copyright "Copyright © 2022, forex-time@mail.ru" #property strict //+------------------------------------------------------------------+ #property indicator_separate_window #property indicator_buffers 3 #property indicator_color1 Yellow #property indicator_color2 Green #property indicator_color3 Red #property indicator_width1 2 #property indicator_width2 2 #property indicator_width3 2 //+------------------------------------------------------------------+ extern int MA_Shift = 60; extern int Ma_Period = 5; extern int Ma_Method = 0; extern int Ma_Price = 0; extern double MA_Koef = 1.0; //---- buffers double CA[]; double UpBuffer[]; double DnBuffer[]; double Price[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators IndicatorBuffers(4); SetIndexStyle(0,DRAW_LINE); SetIndexStyle(1,DRAW_LINE); SetIndexStyle(2,DRAW_LINE); SetIndexBuffer(0,CA); SetIndexBuffer(1,UpBuffer); SetIndexBuffer(2,DnBuffer); SetIndexDrawBegin(0,Ma_Period); SetIndexDrawBegin(1,Ma_Period); SetIndexDrawBegin(2,Ma_Period); IndicatorShortName("CMA("+string(Ma_Period)+")"); SetIndexLabel(1,"UP"); SetIndexLabel(2,"DN"); return(0);} //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int i,limit; int counted_bars=IndicatorCounted(); if (counted_bars<0) return(-1); if (counted_bars>0) counted_bars--; limit = MathMin(Bars-counted_bars,Bars-1); if (counted_bars==0) {limit--; limit-=MA_Shift+1;} else limit++; double K=0.0, v1=0.0, v2=0.0, MA=0.0; for(i=limit; i>=0; i--) { CA[i]=Close[i]-Close[i+MA_Shift]; MA=iMAOnArray(CA,0,Ma_Period,0,Ma_Method,i); v1=MA_Koef*MathSqrt(iStdDevOnArray(CA,0,Ma_Period,0,Ma_Method,i)); v2=MathSqrt(MathAbs(CA[i+1]-MA)); if (v2<v1 || v2==0.0) K=0.0; else K=1-(v1/v2); if (CA[i]-CA[i+1] > 0) UpBuffer[i] = CA[i]; if (CA[i]-CA[i+1] < 0) DnBuffer[i] = CA[i]; } return(0);} //+------------------------------------------------------------------+
15 forextime Сообщений: 141 - ExpertFX
22 ruslan71 Автор Сообщений: 1009 - Руслан
Добавить возможность входа динамическим лотом от... <>[Читать..]
Комментарии (2)
15 forextime Сообщений: 141 - ExpertFX
22 ruslan71 Автор Сообщений: 1009 - Руслан
Зарегистрируйтесь или авторизуйтесь, чтобы оставить комментарий