//+------------------------------------------------------------------+ //| #MTF_HULL_TREND.mq4 | //|------------------------------------------------------------------+ #property indicator_chart_window #property indicator_buffers 4 #property indicator_color1 RoyalBlue #property indicator_color2 OrangeRed #property indicator_color3 Aqua #property indicator_color4 Yellow #property indicator_width1 5 #property indicator_width2 5 //---- input parameters /************************************************************************* PERIOD_M1 1 PERIOD_M5 5 PERIOD_M15 15 PERIOD_M30 30 PERIOD_H1 60 PERIOD_H4 240 PERIOD_D1 1440 PERIOD_W1 10080 PERIOD_MN1 43200 You must use the numeric value of the timeframe that you want to use when you set the TimeFrame' value with the indicator inputs. ---------------------------------------*/ extern int TimeFrame = 15;// 0 = current time frame extern int SSP = 19; //ïåðèîä ëèíåéíîãî ðàçâîðîòà èíäèêàòîðà extern int RISK = 3; extern int CountBars = 18250; //ðàñ÷åòíûé ïåðèîä - äëÿ 30 ìèí áîëüøå ãîäà extern double SkyCh = 23.6; extern int alert = 90; //---- int Shift = 0; int TSP = 9; int PrevAlertTime; double smin, smax; //---- buffers double val1[]; // áóôåð äëÿ áàé double val2[]; // áóôåð äëÿ ñåëë double Sky_BufferH[]; double Sky_BufferL[]; double prev; double alertBar; extern bool SoundAlert = true; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicator line SetIndexStyle(0, DRAW_ARROW); SetIndexArrow(0, 233); // arrowbuy SetIndexStyle(1, DRAW_ARROW); SetIndexArrow(1, 234); // arrowsell SetIndexBuffer(0, val1); // èíäåêñ áóôåðà äëÿ buy SetIndexBuffer(1, val2); // èíäåêñ áóôåðà äëÿ sell //---- SetIndexStyle(2, DRAW_LINE); SetIndexBuffer(2, Sky_BufferH); SetIndexShift(2, Shift); SetIndexLabel(2, "Sky-channel High"); //---- SetIndexStyle(3, DRAW_LINE); SetIndexBuffer(3, Sky_BufferL); SetIndexShift(3, Shift); SetIndexLabel(3, "Sky-channel Low"); //---- if(CountBars >= Bars) CountBars=Bars; // CountBars ðàâíî êîëè÷åñòâó áàðîâ íà ãðàôèêå // äëÿ êðèâîé "0"- ñàìî ðèñîâàíèå; íå ðàñ÷èòûâàòü ïåðâûå SSP áàðîâ (ñíà÷àëà SSP=9) SetIndexDrawBegin(0, Bars - CountBars + SSP); // äëÿ êðèâîé "1"- ñàìî ðèñîâàíèå; íå ðàñ÷èòûâàòü ïåðâûå SSP áàðîâ (ñíà÷àëà SSP=9) SetIndexDrawBegin(1, Bars - CountBars + SSP); SetIndexDrawBegin(2, SSP + Shift - 1); SetIndexDrawBegin(3, SSP + Shift - 1); //---- name for DataWindow and indicator subwindow label switch(TimeFrame) { case 1 : string TimeFrameStr="Period_M1"; break; case 5 : TimeFrameStr="Period_M5"; break; case 15 : TimeFrameStr="Period_M15"; break; case 30 : TimeFrameStr="Period_M30"; break; case 60 : TimeFrameStr="Period_H1"; break; case 240 : TimeFrameStr="Period_H4"; break; case 1440 : TimeFrameStr="Period_D1"; break; case 10080 : TimeFrameStr="Period_W1"; break; case 43200 : TimeFrameStr="Period_MN1"; break; default : TimeFrameStr="Current Timeframe"; } IndicatorShortName("#MTF_Arrows&Curves("+TimeFrameStr+")"); } //---- return(0); //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int start() { datetime TimeArray[]; int i,limit,y=0,counted_bars=IndicatorCounted(); // Plot defined time frame on to current time frame ArrayCopySeries(TimeArray,MODE_TIME,Symbol(),TimeFrame); limit= Bars-1; for(i=0,y=0;i<limit;i++) { if (Time[i]<TimeArray[y]) y++; /*********************************************************** Add your main indicator loop below. You can reference an existing indicator with its iName or iCustom. Rule 1: Add extern inputs above for all neccesary values Rule 2: Use 'TimeFrame' for the indicator time frame Rule 3: Use 'y' for your indicator's shift value **********************************************************/ if (Time[i]==TimeArray[y]) val1[i]=iCustom(Symbol(),TimeFrame,"arrows&curves lucas1",0,y); if (Time[i]==TimeArray[y]) val2[i]=iCustom(Symbol(),TimeFrame,"arrows&curves lucas1",1,y); Sky_BufferH[i]=iCustom(Symbol(),TimeFrame,"arrows&curves lucas1",2,y); Sky_BufferL[i]=iCustom(Symbol(),TimeFrame,"arrows&curves lucas1",3,y); if(prev == 0) prev = val1[i]; if(i <= alert && val1[i] > val2[i] && SoundAlert == true && Bars>alertBar) {Alert("#MTF arrows&curves going Up "," i= ",i + " on the " + Period() + " minute chart.");alertBar = Bars;} if(i <= alert && val1[i] < val2[i] && SoundAlert == true && Bars>alertBar) {Alert("#MTF arrows&curves going Down "," i= ",i + " on the " + Period() + " minute chart.");alertBar = Bars;} } return(0); } //+------------------------------------------------------------------+
Sample
Analysis
Market Information Used:
Series array that contains open time of each bar
Indicator Curves created:
Implements a curve of type DRAW_ARROW
Implements a curve of type DRAW_LINE
Indicators Used:
Custom Indicators Used:
arrows&curves lucas1
Order Management characteristics:
Other Features:
It issuies visual alerts to the screen