profit_and_drawdown

Download script
profit_and_drawdown

This tool is designed to provide traders with a real-time visual representation of their current portfolio's financial standing. Rather than focusing on individual trades, it aggregates the data of all active positions into a single, easy-to-read metric.

Core Functionality

The script monitors your open orders and calculates the total floating profit or loss (drawdown) across your entire account. It then takes this collective value and maps it onto a dedicated graph in a separate window on your trading platform.

How it Works

  • Continuous Monitoring: The script constantly scans all currently active orders in your account.
  • Profit/Loss Aggregation: It sums up the profit or loss for every open position simultaneously. If you have multiple trades running, the tool combines them into one unified figure.
  • Visual Mapping: This total value is plotted as a continuous line graph. By looking at the trend of this line, you can quickly assess whether your overall market exposure is moving into positive territory or experiencing significant drawdown.

Key Benefits for the Trader

  • Holistic Overview: Instead of manually calculating the net result of multiple trades, this tool provides an instant summary of your total risk and reward.
  • Trend Analysis: Because it plots these values as a line, you can visually track the "journey" of your current positions, seeing how your equity fluctuates in real-time.
  • Simplified Data: It strips away the complexity of individual price action and focuses purely on the bottom line—your current profit or loss status.
Orders Execution
Checks for the total of open orders
Miscellaneous
Implements a curve of type %1
12 Views
0 Downloads
0 Favorites
profit_and_drawdown
/*-----------------------------+
|			       |
| Shared by www.Aptrafx.com    |
|			       |
+------------------------------*/

//+------------------------------------------------------------------+
//| Objective: A line graph that plots total open orders drawdown or profit
//| 
//+------------------------------------------------------------------+

#property indicator_separate_window
#property indicator_buffers 1

#property indicator_color1 DarkGoldenrod
#property indicator_width1 2

double val1[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+

int init()
  {
   string short_name;
//---- indicator line
   IndicatorBuffers(1);
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,val1);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
   ObjectsDeleteAll();
   return(0);
  }
  
//+------------------------------------------------------------------+
//| Start function                                        |
//+------------------------------------------------------------------+
int start()
  {   
   double drawdown,cnt;
   for(cnt=0;cnt<OrdersTotal();cnt++)
      {
      drawdown=OrderProfit();
      }
   
   for(int shift=Bars;shift>=0;shift--)
     {
     val1[shift]=drawdown;
     }
  
   return(0);
  }

//+------------------------------------------------------------------+

Comments