//+------------------------------------------------------------------+ //| gy_mp_rsi_ccx.mq4 | //| | //+------------------------------------------------------------------+ #property indicator_separate_window #property indicator_minimum 0 #property indicator_maximum 1 #property indicator_buffers 2 #property indicator_color1 Lime #property indicator_color2 Red // indicators parameters extern bool EveryTick = false; extern string CCI_Settings = "=== CCI Settings ==="; extern int CCIPeriod = 14; // CCI Period extern int CCI_HighBreakout = 30; // extern color CCI_HighBreakoutC = Red; // extern int CCI_LowBreakout = -30; // extern color CCI_LowBreakoutC = Lime; // extern color CCIColor = Green; // extern string RSI_Settings = "=== RSI Settings ==="; extern int RSIPeriod = 14; // RSI period extern int RSI_HighLevel = 80; // extern color RSI_HighLevelC = Red; // extern int RSI_LowLevel = 20; // extern color RSI_LowLevelC = Lime; // extern color RSIColor = Green; // extern string prefix = " Input proper prefix and suffix for pairs"; extern string prefix1 = " ie: IBFX uses suffix m for MiniAccounts"; extern string symbol_prefix = ""; extern string symbol_suffix = ""; extern bool includeAUDCAD = False; extern bool includeAUDCHF = False; extern bool includeAUDJPY = False; extern bool includeAUDNZD = False; extern bool includeAUDUSD = False; extern bool includeCADJPY = False; extern bool includeCHFJPY = False; extern bool includeEURAUD = False; extern bool includeEURCAD = False; extern bool includeEURCHF = False; extern bool includeEURGBP = False; extern bool includeEURJPY = False; extern bool includeEURNZD = False; extern bool includeEURUSD = True; extern bool includeGBPAUD = False; extern bool includeGBPCAD = False; extern bool includeGBPCHF = False; extern bool includeGBPNZD = False; extern bool includeGBPJPY = False; extern bool includeGBPUSD = True; extern bool includeNZDCHF = False; extern bool includeNZDJPY = False; extern bool includeNZDUSD = False; extern bool includeUSDCAD = False; extern bool includeUSDCHF = True; extern bool includeUSDJPY = True; int num_pairs = 26; string pair_name[26]; string pair[26]; bool chosen_pair[26]; string symbol; string Timeframe = ""; double timeframe; string short_name="gy_mp_rsi_cci2"; int window; int SignalBar; color color_common_line = White; color color_common_text = White; color color_connection; //------------------------------------------ color color_ind = PowderBlue; color color_indic = Green; color color_timeframe=SkyBlue; int time_frame; string ObjectID = "GY_MP"; int CCI_HeaderX = 250; // X position for CCI label int RSI_HeaderX = 610; // X position for RSI label int CCI_ValueX = 40; // X postition for CCI values start int RSI_ValueX = 400; // X position for RSI values start int CCI_SpaceX = 50; // Spacing between CCI values int RSI_SpaceX = 50; // Spacing between RSI Values //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- name for indicator window IndicatorShortName(short_name); //---- Timeframe and symbol time_frame=Period(); symbol=Symbol(); if(time_frame==1) { Timeframe = "M1"; } if(time_frame==5) { Timeframe = "M5"; } if(time_frame==15) { Timeframe = "M15"; } if(time_frame==30) { Timeframe = "M30"; } if(time_frame==60) { Timeframe = "H1"; } if(time_frame==240) { Timeframe = "H4"; } if(time_frame==1440) { Timeframe = "D1"; } if(time_frame==10080) { Timeframe = "W1"; } if(time_frame==43200) { Timeframe = "MN"; } ChoosePairSet(); GetCorrectSymbols(); //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- delete_objects(); //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int x, rt, mrt; int np, cp; string ap, kiir, fejlec, tper; int szorzo; double CCI_1=0; double RSI_1=0; static bool HaveWindow = false; static bool HeadersDisplayed = false; static bool SymbolsDisplayed = false; int yPos = 15; //---- //---- if (!HaveWindow) { window = WindowFind(short_name); HaveWindow = true; } if (EveryTick) SignalBar = 0; else SignalBar = 1; if (SignalBar == 1 && !NewBar()) return(0); // wait until first tick after bar close to take any action; if (!HeadersDisplayed) DisplayHeaders(yPos); // Display only once to save time yPos += 15; if (!SymbolsDisplayed) DisplaySymbols(yPos); for (np=0;np CCI_HighBreakout)) { color_indic = CCI_HighBreakoutC; } if ((CCI_1 < CCI_LowBreakout)) { color_indic = CCI_LowBreakoutC; } DisplayLabel("TR"+DoubleToStr(x,0)+"-"+DoubleToStr(np,0), 7, "Verdana", color_indic, CCI_ValueX+(x*CCI_SpaceX), yPos, DoubleToStr(CCI_1,0) ); // ObjectCreate("TR"+DoubleToStr(x,0)+"-"+DoubleToStr(np,0), OBJ_LABEL, WindowFind("gy_mp_rsi_cci"), 0, 0); // ObjectSetText("TR"+DoubleToStr(x,0)+"-"+DoubleToStr(np,0), DoubleToStr(CCI_1,0) ,7, "Verdana", color_indic); // ObjectSet("TR"+DoubleToStr(x,0)+"-"+DoubleToStr(np,0), OBJPROP_CORNER, 0); // ObjectSet("TR"+DoubleToStr(x,0)+"-"+DoubleToStr(np,0), OBJPROP_XDISTANCE, 40+(x*60)); // ObjectSet("TR"+DoubleToStr(x,0)+"-"+DoubleToStr(np,0), OBJPROP_YDISTANCE, 15+(np*15)); } for (x=1;x<8;x++) { switch (x) { case 1 : { RSI_1=iRSI(ap, PERIOD_M1 , RSIPeriod, PRICE_CLOSE,SignalBar); break; } case 2 : { RSI_1=iRSI(ap, PERIOD_M5 , RSIPeriod, PRICE_CLOSE,SignalBar); break; } case 3 : { RSI_1=iRSI(ap, PERIOD_M15, RSIPeriod, PRICE_CLOSE,SignalBar); break; } case 4 : { RSI_1=iRSI(ap, PERIOD_M30, RSIPeriod, PRICE_CLOSE,SignalBar); break; } case 5 : { RSI_1=iRSI(ap, PERIOD_H1 , RSIPeriod, PRICE_CLOSE,SignalBar); break; } case 6 : { RSI_1=iRSI(ap, PERIOD_H4 , RSIPeriod, PRICE_CLOSE,SignalBar); break; } case 7 : { RSI_1=iRSI(ap, PERIOD_D1 , RSIPeriod, PRICE_CLOSE,SignalBar); break; } } // fejléc kiírása // double RSI_1=iRSI(ap, tper , RSIPeriod, PRICE_CLOSE,0); color_indic = Green; if ((RSI_1 > RSI_HighLevel)) { color_indic = RSI_HighLevelC; } if ((RSI_1 < RSI_LowLevel)) { color_indic = RSI_LowLevelC; } DisplayLabel("TRC"+DoubleToStr(x,0)+"-"+DoubleToStr(np,0), 7, "Verdana", color_indic, RSI_ValueX+(x*RSI_SpaceX), yPos, DoubleToStr(RSI_1,0) ); // ObjectCreate("TRC"+DoubleToStr(x,0)+"-"+DoubleToStr(np,0), OBJ_LABEL, WindowFind("gy_mp_rsi_cci"), 0, 0); // ObjectSetText("TRC"+DoubleToStr(x,0)+"-"+DoubleToStr(np,0), DoubleToStr(RSI_1,0) ,7, "Verdana", color_indic); // ObjectSet("TRC"+DoubleToStr(x,0)+"-"+DoubleToStr(np,0), OBJPROP_CORNER, 0); // ObjectSet("TRC"+DoubleToStr(x,0)+"-"+DoubleToStr(np,0), OBJPROP_XDISTANCE, 500+(x*60)); // ObjectSet("TRC"+DoubleToStr(x,0)+"-"+DoubleToStr(np,0), OBJPROP_YDISTANCE, 15+(np*15)); } } return(0); } void DisplaySymbols(int ypos) { string ap; for (int np=0;np=0;i--) { object_name = ObjectName(i); if (StringFind(object_name, ObjectID) > -1 ) ObjectDelete(object_name); } } void DisplayLabel(string myID, int FontSize, string FontName, color FontColor, int xPos, int yPos, string value) { string thisID = ObjectID + myID; if (ObjectFind(thisID) != 0) { ObjectCreate(thisID, OBJ_LABEL, window, 0, 0); ObjectSet(thisID, OBJPROP_CORNER, 0); ObjectSet(thisID, OBJPROP_XDISTANCE, xPos); ObjectSet(thisID, OBJPROP_YDISTANCE, yPos); } ObjectSetText(thisID,""+value+"", FontSize, FontName, FontColor); } void GetCorrectSymbols() { for (int i = 0; i