//+------------------------------------------------------------------+ //| ElderImpulseSystem_HTF_Signal.mq5 | //| Copyright © 2010, Nikolay Kositsin | //| Khabarovsk, farria@mail.redcom.ru | //+------------------------------------------------------------------+ #property copyright "Copyright © 2010, Nikolay Kositsin" #property link "farria@mail.redcom.ru" //--- indicator version #property version "1.00" //+----------------------------------------------+ //| Indicator drawing parameters | //+----------------------------------------------+ //--- drawing the indicator in the main window #property indicator_chart_window #property indicator_buffers 1 #property indicator_plots 1 //+-----------------------------------+ //| Declaration of constants | //+-----------------------------------+ #define RESET 0 // the constant for getting the command for the indicator recalculation back to the terminal //+-----------------------------------+ //| Indicator input parameters | //+-----------------------------------+ input string Symbol_=""; // Financial asset input ENUM_TIMEFRAMES Timeframe=PERIOD_H6; // Indicator timeframe for the indicator calculation input int ma_period=13; // MA period input int fast_ema_period=12; // MACD fast line period input int slow_ema_period=26; // MACD slow line period input int signal_period=9; // MACD signal line period //--- indicator display settings input string symbols_Sirname="ElderImpulseSystem_Label_"; // Indicator labels name input uint BarTotal=4; // Number of displayed bars input color Upsymbol_Color=SpringGreen; // Growth symbol color input color Flsymbol_Color=Blue; // Flat symbol color input color Dnsymbol_Color=Red; // Downfall symbol color input color IndName_Color=DarkOrchid; // Indicator name color input uint symbols_Size=34; // Signal symbols size input uint Font_Size=15; // Indicator name font size input int Xn=5; // Horizontal shift of the name input int Yn=-20; // Vertical shift of the name input bool ShowIndName=true; // Indicator name display input ENUM_BASE_CORNER WhatCorner=CORNER_RIGHT_UPPER; // Location corner input uint X_=0; // Horizontal shift input uint Y_=30; // Vertical shift //+-----------------------------------+ //--- declaration of integer variables for the indicators handles int Elder_Handle; //--- declaration of the integer variables for the start of data calculation int min_rates_total,total; //--- declaration of integer variables of the indices horizontal and vertical location uint X1[],Y1[],X_n,Y_n; //--- declaration of variables arrays for the indicators values storage double Elder[]; //--- color Color1[]; //--- declaration of variables for labels names string name1[],namen,IndName,Symb; //+------------------------------------------------------------------+ //| Getting a timeframe as a line | //+------------------------------------------------------------------+ string GetStringTimeframe(ENUM_TIMEFRAMES timeframe) { //--- return(StringSubstr(EnumToString(timeframe),7,-1)); //--- } //+------------------------------------------------------------------+ //| Creation of a text label | //+------------------------------------------------------------------+ void CreateTLabel(long chart_id, // chart ID string name, // object name int nwin, // window index ENUM_BASE_CORNER corner, // base corner location ENUM_ANCHOR_POINT point, // anchor point location int X, // the distance from the base corner along the X-axis in pixels int Y, // the distance from the base corner along the Y-axis in pixels string text, // text string textTT, // tooltip text color Color, // text color string Font, // text font int Size) // font size { //--- ObjectCreate(chart_id,name,OBJ_LABEL,0,0,0); ObjectSetInteger(chart_id,name,OBJPROP_CORNER,corner); ObjectSetInteger(chart_id,name,OBJPROP_ANCHOR,point); ObjectSetInteger(chart_id,name,OBJPROP_XDISTANCE,X); ObjectSetInteger(chart_id,name,OBJPROP_YDISTANCE,Y); ObjectSetString(chart_id,name,OBJPROP_TEXT,text); ObjectSetInteger(chart_id,name,OBJPROP_COLOR,Color); ObjectSetString(chart_id,name,OBJPROP_FONT,Font); ObjectSetInteger(chart_id,name,OBJPROP_FONTSIZE,Size); ObjectSetString(chart_id,name,OBJPROP_TOOLTIP,textTT); ObjectSetInteger(chart_id,name,OBJPROP_BACK,true); // background object //--- } //+------------------------------------------------------------------+ //| Text label reinstallation | //+------------------------------------------------------------------+ void SetTLabel(long chart_id, // chart ID string name, // object name int nwin, // window index ENUM_BASE_CORNER corner, // base corner location ENUM_ANCHOR_POINT point, // anchor point location int X, // the distance from the base corner along the X-axis in pixels int Y, // the distance from the base corner along the Y-axis in pixels string text, // text string textTT, // tooltip text color Color, // text color string Font, // text font int Size) // font size { //--- if(ObjectFind(chart_id,name)==-1) CreateTLabel(chart_id,name,nwin,corner,point,X,Y,text,textTT,Color,Font,Size); else { ObjectSetString(chart_id,name,OBJPROP_TEXT,text); ObjectSetInteger(chart_id,name,OBJPROP_XDISTANCE,X); ObjectSetInteger(chart_id,name,OBJPROP_YDISTANCE,Y); ObjectSetInteger(chart_id,name,OBJPROP_COLOR,Color); ObjectSetInteger(chart_id,name,OBJPROP_FONTSIZE,Size); } //--- } //+------------------------------------------------------------------+ //| BrainTrend indicator initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- initialization of variables of the start of data calculation min_rates_total=MathMax(ma_period,MathMax(fast_ema_period,slow_ema_period)+signal_period)+2+4; total=int(BarTotal); if(total<1) total=1; //--- memory distribution for variables' arrays if(ArrayResize(X1,total)