//+------------------------------------------------------------------+ //| ConcreteMagenta_EA.mq5 | //| (Institutional Magenta Dominant) | //+------------------------------------------------------------------+ #property copyright "Concrete Goonies" #property link "https://www.example.com" #property version "1.00" #include "Runtime.mqh" #include "Graphics/Screen.mqh" #include "Strategies/SampleStrategy.mqh" #include "Analysers/Chapter2.mqh" #include "AnalyserListeners/AbstractChapterListener.mqh" Runtime* g_runtime; Screen* g_screen ; bool isInit = false; EAConfig config; //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int OnInit() { ObjectsDeleteAll(0); SetChartInstitutionalTheme(); isInit = false; g_screen = new Screen(); g_screen.SetMinZoomForTexts(2); g_runtime = new Runtime(); g_runtime.AddAnalyser(new Chapter2()); g_runtime.AddStrategy(new SampleStrategy()); g_runtime.AddListener(ANALYSIS, new AbstractChapterListener(g_screen)); return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void OnDeinit(const int reason) { delete config.indConfigs; delete g_screen; delete g_runtime; } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void OnTick() { if(!isInit) { config.asSeries = false; config.RiskPercent = 2; config.Slippage = 3; config.magicNumber = 98690477; config.maxOpenPositions = 1; config.maxPendingOrders = 1; config.tradeDuration = 15; config.comment = "EA"; config.indConfigs = new CArrayList(); IndicatorConfig ic ; ic.location = "DexterrFX - SMC Bible/Fractal"; ic.bufferCount = 2; ArrayResize(ic.params, 1); ic.params[0].type = TYPE_INT; ic.params[0].integer_value = 3; config.indConfigs.Add(ic); SymbolConfig symbolConfigCrash; symbolConfigCrash.symbol = _Symbol; symbolConfigCrash.tradeTimeframe = PERIOD_M15; symbolConfigCrash.allowBuy = true; symbolConfigCrash.allowSell = true; //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ STimeframeConfig tfConfig0; tfConfig0.tf = PERIOD_M15; tfConfig0.fetchType = FETCH_PREVIOUS_DAY; tfConfig0.count = 1; tfConfig0.relaunchOnNewPeriod = true; symbolConfigCrash.tfConfigs.Add(tfConfig0); /* STimeframeConfig tfConfig1; tfConfig1.tf = PERIOD_H1; tfConfig1.fetchType = FETCH_PREVIOUS_WEEK; tfConfig1.count = 1; tfConfig1.relaunchOnNewPeriod = true; symbolConfigCrash.tfConfigs.Add(tfConfig1); STimeframeConfig tfConfig2; tfConfig2.tf = PERIOD_H4; tfConfig2.fetchType = FETCH_PREVIOUS_WEEK; tfConfig2.count = 3; tfConfig2.relaunchOnNewPeriod = true; symbolConfigCrash.tfConfigs.Add(tfConfig2);-*/ //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ SymbolRiskManagementConfigs rmConfigsCrash; rmConfigsCrash.UseAutoClose = true; rmConfigsCrash.tradeDuration = 15; rmConfigsCrash.UseBreakEven = false; rmConfigsCrash.UseTrailingStop = false; rmConfigsCrash.StopLoss = 2000000; rmConfigsCrash.TakeProfit = 2000000; rmConfigsCrash.FixedVolume = 0.01; symbolConfigCrash.rmConfigs = rmConfigsCrash; config.tfConfigs.Add(symbolConfigCrash); /* // =================================================== // 品种 2:第二个交易品种(示例为 EURUSD) // =================================================== SymbolConfig symbolConfigEUR; symbolConfigEUR.symbol = _Symbol; // 可替换为 "GBPUSD" 或 "Boom1000Index" symbolConfigEUR.tradeTimeframe = PERIOD_M15; // --- 必须新建时间框架对象(不可复用上面的变量)--- /*STimeframeConfig tfConfig0_2; tfConfig0_2.tf = PERIOD_M15; tfConfig0_2.fetchType = FETCH_PREVIOUS_DAY; tfConfig0_2.count = 1; tfConfig0_2.relaunchOnNewPeriod = true; symbolConfigEUR.tfConfigs.Add(tfConfig2); /* STimeframeConfig tfConfig1_2; tfConfig1_2.tf = PERIOD_H1; tfConfig1_2.fetchType = FETCH_PREVIOUS_WEEK; tfConfig1_2.count = 1; tfConfig1_2.relaunchOnNewPeriod = true;; symbolConfigEUR.tfConfigs.Add(tfConfig1); /* STimeframeConfig tfConfig2_2; tfConfig2_2.tf = PERIOD_H4; tfConfig2_2.fetchType = FETCH_PREVIOUS_WEEK; tfConfig2_2.count = 3; tfConfig2_2.relaunchOnNewPeriod = true;*//*/ symbolConfigEUR.tfConfigs.Add(tfConfig0); /* SymbolRiskManagementConfigs rmConfigsEUR; rmConfigsEUR.StopLoss = 2000000; rmConfigsEUR.TakeProfit = 2000000; rmConfigsEUR.FixedVolume = 0.01;*/ /* symbolConfigEUR.rmConfigs = rmConfigsCrash; config.tfConfigs.Add(symbolConfigEUR); */ if(g_runtime.Initialize(config) < 0) { Print("Runtime initialisation failed"); return; } g_screen.Render(); isInit = true; } if(isInit) { g_runtime.Update(5); // g_screen.Render(); } } //+------------------------------------------------------------------+ //| ChartEvent function | //+------------------------------------------------------------------+ void OnChartEvent(const int id, const long &lparam, const double &dparam, const string &sparam) { // Pass the event to the visual system so it can update its bounds if the user zooms or scrolls g_screen.OnChartEvent(id, lparam, dparam, sparam); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void SetChartInstitutionalTheme(color bg = C'43,43,43') { const long cid = 0; // Background // Background color panel = C'22,24,24'; // Text color fg = C'235,235,235'; color fgMuted = C'160,160,160'; // Candles color bull = C'126,188,62'; color bear = C'203,117,33'; // Lines color bidLine = C'170,170,170'; color askLine = C'226,160,48'; color stopLevel = C'100,150,75'; color lastLine = C'255,215,95'; color volume = C'140,180,90'; // --- Chart background / foreground --- ChartSetInteger(cid, CHART_COLOR_BACKGROUND, panel); ChartSetInteger(cid, CHART_COLOR_FOREGROUND, fg); ChartSetInteger(cid, CHART_COLOR_GRID, clrNONE); // keep clean (institutional) ChartSetInteger(cid, CHART_COLOR_CHART_LINE, fgMuted); // --- Candles / bars --- ChartSetInteger(cid, CHART_COLOR_CANDLE_BULL, bull); ChartSetInteger(cid, CHART_COLOR_CANDLE_BEAR, bear); ChartSetInteger(cid, CHART_COLOR_CHART_UP, bull); ChartSetInteger(cid, CHART_COLOR_CHART_DOWN, bear); // --- Market lines --- ChartSetInteger(cid, CHART_COLOR_BID, bidLine); ChartSetInteger(cid, CHART_COLOR_ASK, askLine); ChartSetInteger(cid, CHART_COLOR_LAST, lastLine); ChartSetInteger(cid, CHART_COLOR_STOP_LEVEL, stopLevel); // --- Volumes (hidden by default below) --- ChartSetInteger(cid, CHART_COLOR_VOLUME, C'90,140,120'); // --- Clean institutional layout --- ChartSetInteger(cid, CHART_SHOW_GRID, false); ChartSetInteger(cid, CHART_SHOW_VOLUMES, CHART_VOLUME_HIDE); ChartSetInteger(cid, CHART_SHOW_ONE_CLICK, false); ChartSetInteger(cid, CHART_SHOW_TICKER, false); ChartSetInteger(cid, CHART_SHOW_PERIOD_SEP, false); // Optional: keep chart crisp (you can tweak) ChartSetInteger(cid, CHART_SCALE, 2); ChartSetInteger(cid, CHART_AUTOSCROLL, true); ChartSetInteger(cid, CHART_SHIFT, true); //ChartSetInteger(cid, CHART_SHIFT_SIZE, 12); // Price scale readability //ChartSetInteger(cid, CHART_COLOR_SCALE, fgMuted); // some terminals honor this ChartSetInteger(cid, CHART_SCALEFIX, false); // Apply and redraw ChartRedraw(cid); // Branding tag / HUD StrataTag(cid, fgMuted); } //+------------------------------------------------------------------+ //| STRATA Institutional HUD Tag | //+------------------------------------------------------------------+ void StrataTag(const long cid, color textColor) { const string name = "STRATA_TAG"; if(ObjectFind(cid, name) < 0) { ObjectCreate(cid, name, OBJ_LABEL, 0, 0, 0); ObjectSetInteger(cid, name, OBJPROP_CORNER, CORNER_LEFT_LOWER); ObjectSetInteger(cid, name, OBJPROP_XDISTANCE, 18); ObjectSetInteger(cid, name, OBJPROP_YDISTANCE, 18); ObjectSetInteger(cid, name, OBJPROP_SELECTABLE, false); ObjectSetInteger(cid, name, OBJPROP_HIDDEN, true); ObjectSetInteger(cid, name, OBJPROP_ZORDER, 500); } color titleColor = C'216,132,36'; // Orange color accent = C'108,203,44'; // Green color text = C'215,215,215'; ObjectSetString(cid, name, OBJPROP_FONT, "Segoe UI"); ObjectSetInteger(cid, name, OBJPROP_FONTSIZE, 11); ObjectSetInteger(cid, name, OBJPROP_COLOR, textColor); ObjectSetString(cid, name, OBJPROP_TEXT, "CONCRETE GOONIES • EA"); ObjectSetInteger(cid, name, OBJPROP_COLOR, titleColor); ChartRedraw(cid); } //+------------------------------------------------------------------+