220 lines
7.7 KiB
MQL5
220 lines
7.7 KiB
MQL5
//+------------------------------------------------------------------+
| |
//| _FrameWork.mq5 |
| |
//| Copyright 2026, Concrete Goonies |
| |
//| https://concrete-goonies.web.app |
| |
//+------------------------------------------------------------------+
| |
#property copyright "Copyright 2026, Concrete Goonies"
| |
#property link "https://concrete-goonies.web.app"
| |
#property version "2.00"
| |
| |
#include "Runtime.mqh"
| |
#include "Graphics/Screen.mqh"
| |
| |
#include "Analysers/Chapter2.mqh"
| |
#include "AnalyserListeners/Chapter2Listener.mqh"
| |
| |
#include "Analysers/Chapter3.mqh"
| |
#include "AnalyserListeners/Chapter3Listener.mqh"
| |
//+------------------------------------------------------------------+
| |
//| |
| |
//+------------------------------------------------------------------+
| |
Runtime* runtime;
| |
Screen* g_screen;
| |
| |
EAConfig eaconfig;
| |
input int fgdfg = 54;
| |
| |
//+------------------------------------------------------------------+
| |
//| |
| |
//+------------------------------------------------------------------+
| |
void AddIndicators() {
| |
//--Fractal Swinga
| |
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;
| |
eaconfig.indConfigs.Add(ic);
| |
}
| |
//+------------------------------------------------------------------+
| |
//| |
| |
//+------------------------------------------------------------------+
| |
void SetSymbols() {
| |
SymbolConfig symbolConfigCrash;
| |
symbolConfigCrash.symbol = _Symbol;
| |
symbolConfigCrash.tradeTimeframe = PERIOD_M15;
| |
| |
//+------------------------------------------------------------------+
| |
STimeframeConfig tfConfig0;
| |
tfConfig0.tf = PERIOD_M15;
| |
tfConfig0.fetchType = FETCH_PREVIOUS_DAY;
| |
tfConfig0.count = 4;
| |
tfConfig0.relaunchOnNewPeriod = true;
| |
symbolConfigCrash.tfConfigs.Add(tfConfig0);
| |
| |
//+------------------------------------------------------------------+
| |
/*STimeframeConfig tfConfig1;
| |
tfConfig1.tf = PERIOD_M15;
| |
tfConfig1.fetchType = FETCH_BY_COUNT;
| |
tfConfig1.count = 1;
| |
tfConfig1.relaunchOnNewPeriod = true;
| |
symbolConfigCrash.tfConfigs.Add(tfConfig1);*/
| |
| |
symbolConfigCrash.rmConfigs = setRiskManagement();
| |
eaconfig.symbolConfigs.Add(symbolConfigCrash);
| |
}
| |
//+------------------------------------------------------------------+
| |
//| |
| |
//+------------------------------------------------------------------+
| |
SymbolRiskManagementConfigs setRiskManagement() {
| |
SymbolRiskManagementConfigs rmConfigsCrash;
| |
rmConfigsCrash.UseAutoClose = true;
| |
rmConfigsCrash.tradeDuration = 15;
| |
| |
rmConfigsCrash.UseBreakEven = false;
| |
rmConfigsCrash.UseTrailingStop = false;
| |
rmConfigsCrash.StopLoss = 2000000;
| |
rmConfigsCrash.TakeProfit = 2000000;
| |
rmConfigsCrash.FixedVolume = 0.01;
| |
| |
return rmConfigsCrash;
| |
}
| |
//+------------------------------------------------------------------+
| |
//| |
| |
//+------------------------------------------------------------------+
| |
void setEaConfigs() {
| |
eaconfig.asSeries = false;
| |
eaconfig.RiskPercent = 2;
| |
eaconfig.Slippage = 3;
| |
eaconfig.magicNumber = 98690477;
| |
eaconfig.maxOpenPositions = 1;
| |
eaconfig.maxPendingOrders = 1;
| |
eaconfig.tradeDuration = 15;
| |
eaconfig.comment = "EA";
| |
| |
eaconfig.indConfigs = new CArrayList<IndicatorConfig>();
| |
eaconfig.symbolConfigs = new CArrayList<SymbolConfig>();
| |
| |
AddIndicators();
| |
SetSymbols();
| |
}
| |
| |
//+------------------------------------------------------------------+
| |
//| Expert initialization function |
| |
//+------------------------------------------------------------------+
| |
int OnInit() {
| |
ObjectsDeleteAll(0);
| |
SetChartInstitutionalTheme();
| |
setEaConfigs();
| |
| |
g_screen = new Screen();
| |
g_screen.SetMinZoomForTexts(2);
| |
| |
runtime = new Runtime();
| |
| |
//runtime.AddAnalyser(new Chapter2());
| |
runtime.AddAnalyser(new Chapter3());
| |
| |
runtime.AddListener(ANALYSIS, new Chapter2Listener(g_screen));
| |
runtime.AddListener(ANALYSIS, new Chapter3Listener(g_screen));
| |
| |
if(runtime.Initialize(eaconfig) < 0) {
| |
Print("Runtime initialisation failed");
| |
return INIT_FAILED;
| |
}
| |
| |
//---
| |
return(INIT_SUCCEEDED);
| |
}
| |
//+------------------------------------------------------------------+
| |
//| Expert deinitialization function |
| |
//+------------------------------------------------------------------+
| |
void OnDeinit(const int reason) {
| |
| |
delete runtime;
| |
delete g_screen;
| |
delete eaconfig.indConfigs;
| |
delete eaconfig.symbolConfigs;
| |
}
| |
//+------------------------------------------------------------------+
| |
//| Expert tick function |
| |
//+------------------------------------------------------------------+
| |
void OnTick() {
| |
//---
| |
runtime.Update(5);
| |
}
| |
//+------------------------------------------------------------------+
| |
//| 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
| |
if(g_screen != NULL)
| |
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_SCALEFIX, false);
| |
| |
}
| |
//+------------------------------------------------------------------+
|