//+------------------------------------------------------------------+
//| totalpipsdisplay.mq4 |
//| Copyright © 2009, MetaQuotes Software Corp. |
//|
http://www.oasiswealthbuilders.com |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2009, Lukpayat -1000 pips Club"
#property link "http://www.metaquotes.net"
#property indicator_chart_window
#define NL "\n"
extern int WhatCorner = 3;
extern int xAxis = 400;
extern int yAxis = 10;
extern int FontSize = 20;
extern string FontType = "Arial Bold" ; //"Comic Sans MS";
extern string note2 = "Default Font Color";
extern color FontColor = Blue;
extern color FontColorUp = Lime;
extern color FontColorDn = Red;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
ObjectsDeleteAll();
ObjectsDeleteAll(0,OBJ_LABEL);
ObjectDelete("Market_Price_Label");
Comment ("");
return(0);
}
//------------------------------------------------------------------------------------
int CalculatePipsProfit()
{
int Profit=0;
for (int cc=0; cc<OrdersTotal()-1; cc++)
{
OrderSelect(cc,SELECT_BY_POS);
if (OrderType()==OP_BUY) double ThisTradeProfit = MarketInfo(OrderSymbol(),MODE_BID)-OrderOpenPrice();
if (OrderType()==OP_SELL) ThisTradeProfit = OrderOpenPrice()-MarketInfo(OrderSymbol(), MODE_ASK);
if (MarketInfo(OrderSymbol(),MODE_DIGITS)==4) int multiplier=10000;
if (MarketInfo(OrderSymbol(),MODE_DIGITS)==2) multiplier=100;
ThisTradeProfit = ThisTradeProfit * multiplier;
int iThisTradeProfit=ThisTradeProfit;
Profit=Profit+iThisTradeProfit;
}//for (int cc=0; cc<OrdersTotal(); cc++)
return(Profit);
}// end int CalculatePipsProfit()
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();
if (OrdersTotal()==0)
{
Comment("No trades to monitor");
return;
}
int PipsProfit=CalculatePipsProfit();
// string ScreenMessage;
Comment("Profit = ", PipsProfit, NL);
string Market_Price='';
Market_Price = StringConcatenate("PipsProfit = ",PipsProfit,"\n");
if (PipsProfit > 0) FontColor = FontColorUp;
if (PipsProfit < 0) FontColor = FontColorDn;
if (PipsProfit ==0) FontColor = FontColor;
ObjectCreate("Market_Price_Label", OBJ_LABEL, 0, 0, 0);
ObjectSetText("Market_Price_Label", Market_Price, FontSize, FontType, FontColor);
ObjectSet("Market_Price_Label", OBJPROP_CORNER, WhatCorner);
ObjectSet("Market_Price_Label", OBJPROP_XDISTANCE, xAxis);
ObjectSet("Market_Price_Label", OBJPROP_YDISTANCE, yAxis);
return(0);
}
//+------------------------------------------------------------------+