//+------------------------------------------------------------------+ //| MultiPair HAS.mq4 | //| Copyright © 2011, John Wustrack | //| Mofified by GVC 04/12/2012 | //+------------------------------------------------------------------+ #property copyright "Copyright © 2011, John Wustrack" #property link "" #property indicator_chart_window #define TitleY 10 #define PairX 10 #define SignalX 100 #define BarsX 160 #define LineStartY 30 #define LineOffY 20 #define Font "Arial" #define FontSize 12 #define TextColor Yellow #define BullColor Blue #define BearColor Red #define ObjPfx "MP_HAS" extern string HAS = "----HAS SETTINGS----"; extern int MaMetod = 2; extern int MaPeriod = 15; extern int MaMetod2 = 2; extern int MaPeriod2 = 15; extern bool AlertOn = true; extern int MinimumSignalPairs = 9; string TradePair[14] = {"GBPUSD","GBPJPY","EURJPY","NZDUSD","AUDJPY","USDJPY","NZDJPY","CHFJPY","USDCHF","EURUSD","AUDUSD", "GBPCHF","EURCHF","EURGBP"}; int NoOfPairs = 14; datetime LastAlert; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- Create_Title_Line(); //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- Delete_Objects(); //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { //---- int ld_Signal,li_BullSignal,li_BearSignal; int OffsetY = LineStartY; color lc_color; string ls_arrow; // For each pair in the array for (int i=0; i HA10 && HA20 > HA30) ld_Signal=-1; } // Create the pair on the screen Object_Create(ObjPfx+"Pair"+i,PairX,OffsetY,TradePair[i],FontSize,Font,TextColor); { if (ld_Signal == 1) { ls_arrow = CharToStr(233); lc_color = BullColor; li_BullSignal++; } if (ld_Signal == -1) { ls_arrow = CharToStr(234); lc_color = BearColor; li_BearSignal++; } Object_Create(ObjPfx+"Signal"+i,SignalX,OffsetY,ls_arrow,FontSize,"Wingdings",lc_color); } OffsetY += LineOffY; } //end of pairs loop // Alerts if ( li_BullSignal >= MinimumSignalPairs && LastAlert != Time[0]) { Alert("BUY SIGNAL at ",TimeToStr(Time[0],TIME_DATE|TIME_MINUTES)); LastAlert = Time[0]; } if ( li_BearSignal >= MinimumSignalPairs && LastAlert != Time[0]) { Alert("SELL SIGNAL at ",TimeToStr(Time[0],TIME_DATE|TIME_MINUTES)); LastAlert = Time[0]; } //---- return(0); } //+------------------------------------------------------------------+ //| create the title line | //+------------------------------------------------------------------+ int Create_Title_Line() { //---- Object_Create(ObjPfx+"Pair",PairX,TitleY,"Pair",FontSize,Font,TextColor); Object_Create(ObjPfx+"Signal",SignalX,TitleY,"Has-Signal",FontSize,Font,TextColor); return(0); } //+------------------------------------------------------------------+ //| create screen objects | //+------------------------------------------------------------------+ void Object_Create(string ps_name,int pi_x,int pi_y,string ps_text=" ",int pi_size=12, string ps_font="Arial",color pc_colour=CLR_NONE) { //---- ObjectCreate(ps_name,OBJ_LABEL,0,0,0,0,0); ObjectSet(ps_name,OBJPROP_CORNER,0); ObjectSet(ps_name,OBJPROP_COLOR,pc_colour); ObjectSet(ps_name,OBJPROP_XDISTANCE,pi_x); ObjectSet(ps_name,OBJPROP_YDISTANCE,pi_y); ObjectSetText(ps_name,ps_text,pi_size,ps_font,pc_colour); //---- return(0); } //+------------------------------------------------------------------+ //| Delete the objects | //+------------------------------------------------------------------+ void Delete_Objects() { //---- string ls_Obj.Name; for (int i=ObjectsTotal()-1; i>=0; i--) { ls_Obj.Name=ObjectName(i); if (StringFind(ls_Obj.Name,ObjPfx)>-1) ObjectDelete(ls_Obj.Name); } ObjectsRedraw(); //---- return(0); } //+------------------------------------------------------------------+