Margin_DrawDown_TrackerEZ
Download scriptThis tool is designed to act as a real-time monitoring dashboard for your trading account, specifically focused on tracking risk and performance metrics while you have active trades. It provides a live summary of your account's extremes to help you understand the "peaks and valleys" of your current trading session.
Here is how the logic works:
Active Trade Monitoring The script first checks if there are any open positions in your account. If no trades are currently open, the tracker remains idle. As soon as a trade is initiated, the script begins monitoring your account data continuously.
Tracking Key Performance Metrics While you are trading, the tool keeps a running record of three specific variables:
- Maximum Margin: It monitors the total margin required by your broker. If your current margin requirements increase at any point during your session, the script records that highest number.
- Maximum Drawdown (Floating Loss): The script constantly watches your unrealized profit/loss. If your account enters a "negative" state (a floating loss) that is deeper than anything it has seen previously in the current session, it captures that lowest point. This helps you visualize the worst-case scenario of your current trades.
- Maximum Floating Profit: Conversely, it also tracks your best performance during the session. If your open trades hit a new high for profit, the script updates this value to reflect your peak gain.
Live Data Display Instead of requiring you to navigate through complex account menus, the script automatically calculates these values and displays them directly on your trading chart as a comment. This display includes:
- Your current account leverage.
- The highest profit level reached during the session.
- The highest margin used.
- The deepest drawdown experienced.
In simple terms, this script serves as a "high-water mark" tracker. It remembers the best and worst moments of your current trading activity so you can see exactly how much risk you have taken and how well your trades have performed in real-time.
//+------------------------------------------------------------------+
//| Margin_DrawDown_Tracker.mq4 |
//| Copyright © 2007, P. Kubitzki |
//| fxtogo4me@yahoo.com |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2007, P. Kubitzki. All Rights Reserved"
#property link "http://www.SecretsFromTheHeart.com"
double MaxAccountMargin = 0.0;
double MaxDrawDown = 0.0;
double MaxFloatingProfit = 0.0;
int AcctLeverage = 0;
int deinit()
{
return(0);
}
int init()
{
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
if( OrdersTotal() == 0)
return;
if (AccountMargin() > MaxAccountMargin)
MaxAccountMargin = AccountMargin();
if (AccountProfit() < MaxDrawDown)
MaxDrawDown = AccountProfit();
if (AccountProfit() > MaxFloatingProfit)
MaxFloatingProfit = AccountProfit();
AcctLeverage = AccountLeverage();
Comment ("http://www.SecretsFromTheHeart.com","\nAccount Leverage is ",AcctLeverage,":1"," MaxFloatingProfit = ",MaxFloatingProfit,"\nMaxAccountMargin = ",MaxAccountMargin," MaxDrawdown = ",MaxDrawDown);
return(0);
}
//+------------------------------------------------------------------+
Comments