mql5/Experts/Motivated/Motivated.mq5
younglubah-gmail 9639b8b362
2026-06-23 21:44:37 +02:00

191 lines
7.4 KiB
MQL5

//+------------------------------------------------------------------+
//| Motivated |
//| Copyright 2025, MetaQuotes Ltd. |
//| https://www.mql5.com |
//+------------------------------------------------------------------+
#include "_includeEa.mqh"
#include "Graphics/VisualSystem.mqh"
#include "Systems/EventBus.mqh"
#include "Graphics/VisualLevels.mqh"
#include "ListenersBoot.mqh"
EventBus bus;
VisualSystem *g_visuals = NULL;
ListenersBoot *listenersBoot = NULL;
EAConfig config;
_includeEa *ea;
//--- Inputs
input group " "
input int TradeCount = 1; // Trades Count
input int TradeDuration = 3; // Trade Duration
input double Lots = 0.001; // Lot Size
input int Stop_Loss = 100000; // Stop Loss (points)
input int Take_Profit = 400000; // Take Profit (points)
input ulong MagicNumber = 123456; // Magic Number
//--- Trade Direction Control
//input group "Trade Direction Control"
input bool Allow_Buy = true; // Allow Buy Trades
input bool Allow_Sell = true; // Allow Sell Trades
//--- Risk Management
//input group " "
input bool UseMM = true; // Use Money Management
input double RiskPercent = 5; // Risk Percentage
input group " "
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
ObjectsDeleteAll(0);
SetAetherNoirTheme(); // dark, muted, alien
config.name = _Symbol;
config.enabled = true;
config.tradeDuration = TradeDuration;
config.tradeCount = TradeCount;
config.lotSize = Lots;
config.stopLoss = Stop_Loss;
config.takeProfit = Take_Profit;
config.magicNumber = MagicNumber;
config.allowBuy = Allow_Buy;
config.allowSell = Allow_Sell;
config.useMM = UseMM;
config.riskPercent = RiskPercent;
config.hidden = false;
config.timeframe = PERIOD_CURRENT;
ea = new _includeEa(config);
g_visuals = new VisualSystem();
g_visuals.SetMinZoomForTexts(2); // Hide text if zoomed out too far (0-5 scale)
g_visuals.SetAutoUpdate(true); // Automatically recalculate view bounds on render
listenersBoot = new ListenersBoot(bus, g_visuals);
//---
return(ea.OnInit());
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
delete ea;
delete g_visuals;
delete listenersBoot;
// Force a chart redraw to clear the visual objects immediately
ChartRedraw();
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
ea.OnTick();
// g_visuals.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_visuals.OnChartEvent(id, lparam, dparam, sparam);
}
//+------------------------------------------------------------------+
//| ÆTHER NOIR THEME – dark, muted, powdery alien luxury |
//+------------------------------------------------------------------+
void SetAetherNoirTheme(color bg = C'38,36,34') // warm charcoal dust
{
const long cid = 0;
// --- Muted dark palette: no glow, only soft dusty whispers ---
color panel = bg; // 38,36,34
color gridSoft = C'52,50,48'; // barely visible grid
color fg = C'185,180,175'; // soft limestone text (not white)
color fgMuted = C'130,125,120'; // warm stone grey
color bull = C'130,148,138'; // muted sage-grey (not green)
color bear = C'165,140,145'; // dusty rose-mauve (not pink)
color bidLine = C'140,145,155'; // faded steel blue-grey
color askLine = C'160,150,160'; // ash lavender
color stopLevel = C'120,130,140'; // muted slate
color lastLine = C'180,165,150'; // soft blush-beige
// --- Chart background / foreground ---
ChartSetInteger(cid, CHART_COLOR_BACKGROUND, panel);
ChartSetInteger(cid, CHART_COLOR_FOREGROUND, fg);
ChartSetInteger(cid, CHART_COLOR_GRID, clrNONE);
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) ---
ChartSetInteger(cid, CHART_COLOR_VOLUME, C'90,95,90');
// --- Clean, silent interface ---
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);
ChartSetInteger(cid, CHART_SCALE, 2);
// ChartSetInteger(cid, CHART_AUTOSCROLL, true);
// ChartSetInteger(cid, CHART_SHIFT, true);
ChartSetInteger(cid, CHART_SCALEFIX, false);
ChartRedraw(cid);
// Alien signature – muted and deliberate
AetherNoirTag(cid, C'155,150,148'); // soft grey-taupe
}
//+------------------------------------------------------------------+
//| Æther Noir HUD Tag – "I whisper in the dark" |
//+------------------------------------------------------------------+
void AetherNoirTag(const long cid, color textColor)
{
const string name = "AETHER_NOIR_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, 16);
ObjectSetInteger(cid, name, OBJPROP_YDISTANCE, 16);
ObjectSetInteger(cid, name, OBJPROP_SELECTABLE, false);
ObjectSetInteger(cid, name, OBJPROP_HIDDEN, true);
ObjectSetInteger(cid, name, OBJPROP_ZORDER, 500);
}
// Refined, light font – no harshness
ObjectSetString(cid, name, OBJPROP_FONT, "Segoe UI Semilight");
ObjectSetInteger(cid, name, OBJPROP_FONTSIZE, 11);
ObjectSetInteger(cid, name, OBJPROP_COLOR, textColor);
// Tagline: dark, muted, structural alien
ObjectSetString(cid, name, OBJPROP_TEXT,
"◈ ÆTHER NOIR • muted:structure");
ChartRedraw(cid);
}
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+