194 lines
7.9 KiB
MQL5
194 lines
7.9 KiB
MQL5
//+------------------------------------------------------------------+
| |
//| AnotherTriBible.mq5 |
| |
//| Copyright 2025, MetaQuotes Ltd. |
| |
//| https://www.mql5.com |
| |
//+------------------------------------------------------------------+
| |
#include "Chapter2.mqh"
| |
#include "Chapter3.mqh"
| |
| |
C_Chapter2 chapter2;
| |
C_Chapter3 chapter3;
| |
//+------------------------------------------------------------------+
| |
//| Expert initialization function |
| |
//+------------------------------------------------------------------+
| |
int OnInit() {
| |
//---
| |
SetChartInstitutionalTheme();
| |
int ok2 = chapter2.OnInit(_Symbol, _Period, 3, 1);
| |
if(ok2 != INIT_SUCCEEDED)
| |
return ok2;
| |
| |
int ok3 = chapter3.OnInit(_Symbol, _Period, 3, 1);
| |
if(ok3 != INIT_SUCCEEDED)
| |
return ok3;
| |
| |
ObjectsDeleteAll(0);
| |
//---
| |
return(INIT_SUCCEEDED);
| |
}
| |
//+------------------------------------------------------------------+
| |
//| Expert deinitialization function |
| |
//+------------------------------------------------------------------+
| |
void OnDeinit(const int reason) {
| |
//---
| |
| |
}
| |
//+------------------------------------------------------------------+
| |
//| Expert tick function |
| |
//+------------------------------------------------------------------+
| |
void OnTick() {
| |
// 1) run Chapter 2 first (updates protected high/low anchors)
| |
chapter2.OnCalculate();
| |
| |
// 2) wire Chapter 2 ERL anchors into Chapter 3
| |
chapter3.SetExternalRange(
| |
chapter2.GetProtectedHighIndex(),
| |
chapter2.GetProtectedLowIndex()
| |
);
| |
| |
// 3) run Chapter 3
| |
chapter3.OnCalculate();
| |
| |
}
| |
//+------------------------------------------------------------------+
| |
//+------------------------------------------------------------------+
| |
//| Institutional Theme (built for bg 43,43,43) |
| |
//| Brand: STRATA Institutional |
| |
//+------------------------------------------------------------------+
| |
void SetChartInstitutionalTheme(color bg = C'43,43,43') {
| |
const long cid = 0;
| |
| |
// --- Core palette (institutional dark) ---
| |
color panel = bg; // 43,43,43
| |
color gridSoft = C'58,58,58'; // subtle grid if you enable it
| |
color fg = C'210,210,210'; // labels/axis
| |
color fgMuted = C'150,150,150'; // secondary text
| |
color bull = C'38,166,154'; // your teal (works well on 43 bg)
| |
color bear = C'157,83,123'; // your magenta (works well on 43 bg)
| |
color bidLine = C'120,140,160'; // slate-ish
| |
color askLine = C'175,120,150'; // muted violet
| |
color stopLevel = C'90,130,170'; // steel blue
| |
color lastLine = C'210,190,140'; // warm accent
| |
| |
// --- 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);
| |
}
| |
| |
// Font (clean / institutional)
| |
ObjectSetString(cid, name, OBJPROP_FONT, "Segoe UI");
| |
ObjectSetInteger(cid, name, OBJPROP_FONTSIZE, 11);
| |
ObjectSetInteger(cid, name, OBJPROP_COLOR, textColor);
| |
| |
// Text (institutional name)
| |
ObjectSetString(cid, name, OBJPROP_TEXT,
| |
"STRATA Institutional • Market Structure Suite");
| |
| |
ChartRedraw(cid);
| |
}
| |
| |
//+------------------------------------------------------------------+
| |
//| Optional: Styles for your SMC objects (BOS/CHOCH/POI etc.) |
| |
//| Call these when creating objects to keep everything consistent. |
| |
//+------------------------------------------------------------------+
| |
color SMC_Color_BOS() {
| |
return C'200,200,200'; // clean white-ish
| |
}
| |
//+------------------------------------------------------------------+
| |
//| |
| |
//+------------------------------------------------------------------+
| |
color SMC_Color_CHOCH() {
| |
return C'230,200,120'; // warm gold
| |
}
| |
//+------------------------------------------------------------------+
| |
//| |
| |
//+------------------------------------------------------------------+
| |
color SMC_Color_Weak() {
| |
return C'150,150,150'; // muted gray
| |
}
| |
//+------------------------------------------------------------------+
| |
//| |
| |
//+------------------------------------------------------------------+
| |
color SMC_Color_POI() {
| |
return C'90,160,220'; // calm blue
| |
}
| |
| |
//+------------------------------------------------------------------+
| |
//| |
| |
//+------------------------------------------------------------------+
| |
int SMC_Width_Main() {
| |
return 1;
| |
}
| |
//+------------------------------------------------------------------+
| |
//| |
| |
//+------------------------------------------------------------------+
| |
int SMC_Width_Emph() {
| |
return 2;
| |
}
| |
| |
// Example helpers (use in your debug class or ObjectSetInteger calls)
| |
void SMC_StyleLine(const long cid, const string objName, color c, int width = 1, ENUM_LINE_STYLE style = STYLE_SOLID, bool back = true) {
| |
if(ObjectFind(cid, objName) < 0) return;
| |
ObjectSetInteger(cid, objName, OBJPROP_COLOR, c);
| |
ObjectSetInteger(cid, objName, OBJPROP_WIDTH, width);
| |
ObjectSetInteger(cid, objName, OBJPROP_STYLE, style);
| |
ObjectSetInteger(cid, objName, OBJPROP_BACK, back);
| |
ObjectSetInteger(cid, objName, OBJPROP_HIDDEN, true);
| |
}
| |
//+------------------------------------------------------------------+
|