Сделаю выложу здесь, но попоже.
//+------------------------------------------------------------------+ //| Sidus_Bago Entry Indicator.mq4 | //| AHA | //| Ideas by Sidus, Bagovino, OrangeRoshan, and many others | //+------------------------------------------------------------------+ #property copyright "AHA" #property link "" #property indicator_chart_window #property indicator_buffers 4 #property indicator_color1 Yellow #property indicator_color2 Red #property indicator_color3 Yellow #property indicator_color4 Red //---- input parameters extern int FastEMA=5; extern int SlowEMA=12; extern int RSIPeriod=21; extern bool Alerts=true; //---- buffers double ExtMapBuffer1[]; double ExtMapBuffer2[]; double ExtMapBuffer3[]; double ExtMapBuffer4[]; //---- variables int sigCurrent=0; int sigPrevious=0; double pipdiffCurrent=0; double pipdiffPrevious=0; datetime LastTime=0; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators SetIndexStyle(0,DRAW_LINE); SetIndexBuffer(0,ExtMapBuffer1); SetIndexStyle(1,DRAW_LINE); SetIndexBuffer(1,ExtMapBuffer2); SetIndexStyle(2,DRAW_ARROW,EMPTY,3); SetIndexArrow(2,217); SetIndexBuffer(2,ExtMapBuffer3); SetIndexEmptyValue(2,0.0); SetIndexStyle(3,DRAW_ARROW,EMPTY,3); SetIndexArrow(3,218); SetIndexBuffer(3,ExtMapBuffer4); SetIndexEmptyValue(3,0.0); //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int limit; int counted_bars=IndicatorCounted(); double rsi_sig=0; bool entry=false; double entry_point=0; //---- check for possible errors if(counted_bars<0) return(-1); //---- last counted bar will be recounted if(counted_bars>0) counted_bars--; limit=Bars-counted_bars; //---- main loop for(int i=0; i<limit; i++) { //---- ma_shift set to 0 because SetIndexShift called abowe ExtMapBuffer1[i]=iMA(NULL,0,FastEMA,0,MODE_EMA,PRICE_CLOSE,i+1); ExtMapBuffer2[i]=iMA(NULL,0,SlowEMA,0,MODE_EMA,PRICE_CLOSE,i+1); rsi_sig = iRSI(NULL, 0, RSIPeriod, PRICE_CLOSE, i+1); pipdiffCurrent=(ExtMapBuffer1[i]-ExtMapBuffer2[i]); if (pipdiffCurrent>0 && rsi_sig>50) { sigCurrent = 1; //Up } else if (pipdiffCurrent<0 && rsi_sig<50) { sigCurrent = 2; //Down } if (sigCurrent==1 && sigPrevious==2) { ExtMapBuffer4[i-1] = High[i]+5*Point; entry=true; entry_point=Ask; } else if (sigCurrent==2 && sigPrevious==1) { ExtMapBuffer3[i-1] = Low[i]-5*Point; entry=true; entry_point=Bid; } sigPrevious=sigCurrent; pipdiffPrevious=pipdiffCurrent; } //---- if(Alerts && entry) { string f = Symbol(); PlaySound("alert.wav"); if (sigPrevious==1&&Time[i]!= LastTime) { Alert("Покупка "," Период ",GetNameTF()," Символ ",f); LastTime = Time[i]; } else if (sigPrevious==2&&Time[i]!= LastTime) { Alert("Продажа "," Период ",GetNameTF()," Символ ",f); LastTime = Time[i]; } entry=false; } //---- return(0); } //+----------------------------------------------------------------------------+ //| Автор : Ким Игорь В. aka KimIV, http://www.kimiv.ru | //+----------------------------------------------------------------------------+ //| Версия : 01.09.2005 | //| Описание : Возвращает наименование таймфрейма | //+----------------------------------------------------------------------------+ //| Параметры: | //| TimeFrame - таймфрейм (количество секунд) (0 - текущий ТФ) | //+----------------------------------------------------------------------------+ string GetNameTF(int TimeFrame=0) { if (TimeFrame==0) TimeFrame=Period(); switch (TimeFrame) { case PERIOD_M1: return("M1"); case PERIOD_M5: return("M5"); case PERIOD_M15: return("M15"); case PERIOD_M30: return("M30"); case PERIOD_H1: return("H1"); case PERIOD_H4: return("H4"); case PERIOD_D1: return("Daily"); case PERIOD_W1: return("Weekly"); case PERIOD_MN1: return("Monthly"); default: return("UnknownPeriod"); } }
Файлы:
sidus_bago.mq4
6 kb
Добавляйте условие проверки времени
Time[i]!= LastTime
Вы упускаете торговые возможности:
- Бесплатные приложения для трейдинга
- 8 000+ сигналов для копирования
- Экономические новости для анализа финансовых рынков
Регистрация
Вход
Вы принимаете политику сайта и условия использования
Если у вас нет учетной записи, зарегистрируйтесь
как заставить индикатор Sidus
https://www.mql5.com/ru/code/7528
подавать сигнал при появлении стрелки?