//*****************************************************************************// //*****************************************************************************// //* BS_On A Wave.mq4 *// //* Copyright © 2013, Backspace *// //* Success Version *// //*****************************************************************************// //*****************************************************************************// //* Торгуй тренды *// //* Уменьшай потери *// //* Давай прибыли расти *// //* Управляй рисками *// //*****************************************************************************// //*****************************************************************************// #property copyright "Copyright © 2013, Backspace" // #property link "Success Version" // // #property indicator_chart_window // #property indicator_buffers 6 // #property indicator_color1 Yellow // #property indicator_color2 Red // #property indicator_color3 Yellow // #property indicator_color4 Red // #property indicator_color5 Snow // #property indicator_color6 Snow // //******************// Ввод параметров индикатора extern int BarQuant =24; // - кол-во просчитываемых баров //******************// Составные части индикатора double ExtrimHi[], // - экстремум High ExtrimLo[], // - экстремум Low BreakHi[], // - экстремум High BreakLo[], // - экстремум Low HiMA[], // LoMA[]; // //******************// Глобальные переменные int Trend; // datetime CurrTime, // - текущее время LastTime; // - время открытия последнего бара // //*****************************************************************************// //**************************-Indicator Initialization-*************************// //*****************************************************************************// // int init() // { // //******************// Настройки графического отображения IndicatorBuffers (6); // SetIndexLabel (0,"ExtrimHi"); // SetIndexBuffer (0,ExtrimHi); // SetIndexStyle (0,DRAW_ARROW,EMPTY,4); // SetIndexArrow (0,159); // SetIndexLabel (1,"ExtrimLo"); // SetIndexBuffer (1,ExtrimLo); // SetIndexStyle (1,DRAW_ARROW,EMPTY,4); // SetIndexArrow (1,159); // SetIndexLabel (2,"HiMA"); // SetIndexBuffer (2,HiMA); // SetIndexStyle (2,DRAW_LINE,EMPTY,1); // SetIndexLabel (3,"LoMA"); // SetIndexBuffer (3,LoMA); // SetIndexStyle (3,DRAW_LINE,EMPTY,1); // SetIndexLabel (4,"BreakHi"); // SetIndexBuffer (4,BreakHi); // SetIndexStyle (4,DRAW_HISTOGRAM,EMPTY,5); // SetIndexArrow (4,159); // SetIndexLabel (5,"BreakLo"); // SetIndexBuffer (5,BreakLo); // SetIndexStyle (5,DRAW_HISTOGRAM,EMPTY,5); // SetIndexArrow (5,159); // //*********// return(0); // } // // //*****************************************************************************// //*************************-Indicator Deinitialization-************************// //*****************************************************************************// // int deinit() // { // Comment(""); // //*********// return(0); // } // // //*****************************************************************************// //**********************************-On A Wave-********************************// //*****************************************************************************// // int start() // { // for(int s=Bars-1-IndicatorCounted(); s>=0; s--) // { // Comment("On A Wave\n","Spread =",MarketInfo(Symbol(),MODE_SPREAD)); // Extrim_Detect(s); //******************// Определение экстремумов } // //*********// return(0); // } // // //*****************************************************************************// //*********************************-SubPogramms-*******************************// //*****************************************************************************// // double Extrim_Detect(int a) //***********************************// Определение экстремумов { // LastTime =iTime(NULL,0,a); // HiMA[a] =iMA(NULL,0,BarQuant,1,3,2,a); // LoMA[a] =iMA(NULL,0,BarQuant,1,3,3,a); // if((TimeDayOfWeek(Time[a])==5 && TimeHour(Time[a])>=20)|| // (TimeDayOfWeek(Time[a])==1 && TimeHour(Time[a])<1)) // {Trend =0; BreakHi[a] =iHigh(NULL,0,a); BreakLo[a] =iLow(NULL,0,a);} // else if(CurrTime!=LastTime) // { // if(Trend!=1 && iHigh(NULL,0,a)>HiMA[a] && iLow(NULL,0,a)HiMA[a] && iHigh(NULL,0,a+1)HiMA[a+1]))) // {ExtrimHi[a] =iOpen(NULL,0,a); Trend =1; CurrTime=LastTime;} // else if(Trend!=-1 && // iLow(NULL,0,a)LoMA[a] && // iOpen(NULL,0,a)>LoMA[a]) // {ExtrimLo[a] =LoMA[a]; Trend =-1; CurrTime=LastTime;} // else if(Trend!=-1 && // ((iOpen(NULL,0,a)LoMA[a+1])|| // (ExtrimHi[a+1]!=EMPTY_VALUE && iClose(NULL,0,a+1)