Watch how to download trading robots for free
Find us on Telegram!
Join our fan page
Interesting script?
So post a link to it -
let others appraise it
You liked the script? Try it in the MetaTrader 5 terminal
Libraries

Dashboard Panel - library for MetaTrader 5

Hayk Babayan
Hayk Babayan
Algorithmic trader. I build and test Expert Advisors for MetaTrader 5 with one rule: a strategy has to prove itself on data it has never seen before I trust it.
Views:
14
Rating:
(1)
Published:
MQL5 Freelance Need a robot or indicator based on this code? Order it on Freelance Go to Freelance

Most EAs show their state with Comment() or a pile of label objects. Both are hard to read, flicker, and look out of place on modern screens. DashboardPanel.mqh draws the whole card on one CCanvas bitmap, with smooth rounded corners and proper fonts, and it takes a few lines of code.

DashboardDemo card on an XAUUSD chart

What it does

  • Title and subtitle, and a status pill (for example LIVE, PAUSED, LOCKED) in green, amber, red, grey or your accent colour.
  • Text rows: a label on the left and a value on the right. Each value can be coloured by its meaning: normal, dim, good, warn, bad or accent.
  • Progress bars with a value, for example daily loss used, margin used, or progress to a target.
  • Separator lines between groups.
  • Light and dark themes. In automatic mode the card follows the chart background.
  • Anti-aliased rounded corners and bars, drawn pixel by pixel. Sizes follow the Windows display scaling, so the card stays sharp on high-DPI screens.
  • Fast: the card redraws only when a value changes. A full redraw of a 300x300 card takes about 3 ms.
  • A click on the header folds the card down to its title bar and back.
  • Any chart corner.

Example

#include "DashboardPanel.mqh"
CDashboardPanel panel;
int r_equity,r_loss;

int OnInit()
  {
   panel.Create("my_card",12,24,300);
   panel.SetTitle(_Symbol,"My EA");
   r_equity=panel.AddText("Equity");
   r_loss  =panel.AddBar("Daily loss used");
   EventSetTimer(1);
   return(INIT_SUCCEEDED);
  }

void OnTimer()
  {
   panel.SetText(r_equity,DoubleToString(AccountInfoDouble(ACCOUNT_EQUITY),2));
   panel.SetBar(r_loss,0.35,"35%",DASH_WARN);
   panel.SetStatus("LIVE",DASH_GOOD);
   panel.Redraw();
   ChartRedraw();
  }

void OnChartEvent(const int id,const long &lparam,const double &dparam,const string &sparam)
  {
   panel.OnEvent(id,lparam,dparam,sparam);   // fold/unfold on a header click
  }

void OnDeinit(const int reason)
  {
   panel.Destroy();
  }

Example indicator

DashboardDemo shows an account and symbol card: balance, equity, floating and closed-today P/L, open positions, spread, margin used and where the price is inside today's range. It updates every second. Put DashboardPanel.mqh in the same folder as the indicator.

Broker Clock Broker Clock

Broker server time, UTC and the local time of London, Frankfurt, New York, Tokyo and Sydney, with daylight saving time on any date, live and in the Strategy Tester.

Market Structure Visualizer - HH HL LH LL BOS CHoCH Market Structure Visualizer - HH HL LH LL BOS CHoCH

Free non-repainting MT5 market structure indicator that identifies confirmed HH, HL, LH and LL swings, plots BOS and CHoCH structure breaks, and includes close/wick confirmation, dashboard bias and optional alerts.

Accelerator Oscillator (AC) Accelerator Oscillator (AC)

The Acceleration/Deceleration Indicator (AC) measures acceleration and deceleration of the current driving force.

MACD Signals MACD Signals

Indicator edition for new platform.