Voir comment télécharger gratuitement des robots de trading
Retrouvez-nous sur Facebook !
Rejoignez notre page de fans
Un script intéressant ?
Poster un lien vers celui-ci -
laisser les autres l'évaluer
Vous avez aimé le script ? Essayez-le dans le terminal MetaTrader 5
Bibliothèque

Dashboard Panel - bibliothèque pour 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.
Vues:
187
Note:
(1)
Publié:
MQL5 Freelance Besoin d'un robot ou d'un indicateur basé sur ce code ? Commandez-le sur Freelance Aller sur 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.

LotFromRisk: position size from risk, stop and commission LotFromRisk: position size from risk, stop and commission

An include file for calculating the size of a position to be opened. It turns a risk figure (percent of the balance, percent of the equity or money), a stop and a commission per lot into a lot size whose loss at the stop never goes over that risk. The lot is always rounded down to the volume step and a risk below the minimum volume returns 0 lots with a reason.

Trade Cost Meter Trade Cost Meter

Shows the real cost of a trade on the current symbol (spread, commission, swap) and which share of your risk (R) it takes on every timeframe from M1 to D1.